Example #1
0
        private void RedrawSmallImage()
        {
            //canvasPixels.Source = UtilityWPF.RenderControl(canvasInk, _pixels, _pixels, true);

            _currentSketch = new EncogOCR_SketchData()
            {
                Name    = cboDrawingLabel.Text,
                Strokes = canvasInk.Strokes.
                          Select(o => new EncogOCR_StrokeDefinition(o)).
                          ToArray(),
                InkCanvasSize = new Size(canvasInk.ActualWidth, canvasInk.ActualHeight),
            };

            _currentSketch.GenerateBitmap(_pixels);

            canvasPixels.Source = _currentSketch.Bitmap;

            RecognizeImage();

            if (_visualizer != null)
            {
                _visualizer.AddSketch(_currentSketch.Clone());
            }
        }
Example #2
0
        private void EnsureDotCreated(EncogOCR_SketchData sketch)
        {
            if (_dots == null)
            {
                return;
            }
            else if (_dots.Dots.Any(o => o.Token == sketch.Token))
            {
                return;
            }

            Dot dot = new Dot(sketch.Token)
            {
                VectorSource = sketch.Clone(),      // cloning to ensure the sketch passed in doesn't get manipulated.  NOTE: The clone will have a different token
                Position     = Math3D.GetRandomVector_Spherical(RADIUS).ToPoint(),
            };

            _dots.Dots.Add(dot);

            if (_networkOutputs != null)
            {
                ReconstructDot(dot);
            }
        }
        private void EnsureDotCreated(EncogOCR_SketchData sketch)
        {
            if (_dots == null)
            {
                return;
            }
            else if (_dots.Dots.Any(o => o.Token == sketch.Token))
            {
                return;
            }

            Dot dot = new Dot(sketch.Token)
            {
                VectorSource = sketch.Clone(),      // cloning to ensure the sketch passed in doesn't get manipulated.  NOTE: The clone will have a different token
                Position = Math3D.GetRandomVector_Spherical(RADIUS).ToPoint(),
            };

            _dots.Dots.Add(dot);

            if (_networkOutputs != null)
            {
                ReconstructDot(dot);
            }
        }
        private void RedrawSmallImage()
        {
            //canvasPixels.Source = UtilityWPF.RenderControl(canvasInk, _pixels, _pixels, true);

            _currentSketch = new EncogOCR_SketchData()
            {
                Name = cboDrawingLabel.Text,
                Strokes = canvasInk.Strokes.
                    Select(o => new EncogOCR_StrokeDefinition(o)).
                    ToArray(),
                InkCanvasSize = new Size(canvasInk.ActualWidth, canvasInk.ActualHeight),
            };

            _currentSketch.GenerateBitmap(_pixels);

            canvasPixels.Source = _currentSketch.Bitmap;

            RecognizeImage();

            if (_visualizer != null)
            {
                _visualizer.AddSketch(_currentSketch.Clone());
            }
        }