Example #1
0
        public override void Process()
        {
            FireProcessingStateChanged(ProcessingState.Started);
            var frame = (IImage)_input.GetData();

            if (frame is Image <Bgr, byte> )
            {
                var t        = (Image <Bgr, byte>)frame;
                var channels = t.Split();
                _outputB.SetData(channels[0]);
                _outputG.SetData(channels[1]);
                _outputR.SetData(channels[2]);
            }
            else if (frame is Image <Rgb, byte> )
            {
                var t        = (Image <Rgb, byte>)frame;
                var channels = t.Split();
                _outputR.SetData(channels[0]);
                _outputG.SetData(channels[1]);
                _outputB.SetData(channels[2]);
            }
            frame.Dispose();

            FireProcessingStateChanged(ProcessingState.Finished);
        }
Example #2
0
        public override void Process()
        {
            FireProcessingStateChanged(ProcessingState.Started);
            var frame0 = (IImage)_input0.GetData();
            var frame1 = (IImage)_input1.GetData();

            var gray0 = frame0 as Image <Gray, byte>;
            var gray1 = frame1 as Image <Gray, byte>;

            if (gray0 != null && gray1 != null)
            {
                _output.SetData(gray0.Xor(gray1));
            }
            else
            {
                var rgb0 = frame0 as Image <Bgr, byte>;
                var rgb1 = frame1 as Image <Bgr, byte>;
                if (rgb0 != null && rgb1 != null)
                {
                    _output.SetData(rgb0.Xor(rgb1));
                }
                else
                {
                    throw new NotImplementedException();
                }
            }

            frame0.Dispose();
            frame1.Dispose();

            FireProcessingStateChanged(ProcessingState.Finished);
        }
Example #3
0
        public override void Process()
        {
            FireProcessingStateChanged(ProcessingState.Started);
            var image = (IImage)_inputPin.GetData();

            image.Save((string)_filepathProperty.Value);
            image.Dispose();
            FireProcessingStateChanged(ProcessingState.Finished);
        }
        public override void Process()
        {
            FireProcessingStateChanged(ProcessingState.Started);
            var frame0 = (IImage)_input.GetData();

            var gray0 = frame0 as Image <Gray, byte>;

            throw new NotImplementedException();
            frame0.Dispose();

            FireProcessingStateChanged(ProcessingState.Finished);
        }
Example #5
0
        public override void Process()
        {
            FireProcessingStateChanged(ProcessingState.Started);
            var frameB = (Image <Gray, byte>)_inputB.GetData();
            var frameG = (Image <Gray, byte>)_inputG.GetData();
            var frameR = (Image <Gray, byte>)_inputR.GetData();

            _output.SetData(new Image <Bgr, byte>(new[] { frameB, frameG, frameR }));

            frameB.Dispose();
            frameG.Dispose();
            frameR.Dispose();

            FireProcessingStateChanged(ProcessingState.Finished);
        }
Example #6
0
        public override void Process()
        {
            FireProcessingStateChanged(ProcessingState.Started);
            var frame = (IImage)_input.GetData();

            lock (_outputs)
            {
                for (int index = 0; index < _outputs.Count; index++)
                {
                    OutputPin outputPin = _outputs[index];
                    object    clone     = frame.Clone();
                    outputPin.SetData(clone);
                    FireProcessingProgressChanged((index + 1) / (double)_outputs.Count);
                }
            }
            _originalOutput.SetData(frame);
            FireProcessingStateChanged(ProcessingState.Finished);
        }
Example #7
0
        public override void Process()
        {
            FireProcessingStateChanged(ProcessingState.Started);
            var frame = (IImage)_input.GetData();

            var gray8 = frame as Image <Gray, byte>;

            if (gray8 != null)
            {
                _output.SetData(gray8.Not());
            }
            else
            {
                throw new NotImplementedException();
            }

            frame.Dispose();

            FireProcessingStateChanged(ProcessingState.Finished);
        }
Example #8
0
        public override void Process()
        {
            FireProcessingStateChanged(ProcessingState.Started);
            var frame = (IImage)_input.GetData();
            var gray  = frame as Image <Gray, byte>;

            if (gray != null)
            {
                Image <Gray, byte> output = gray.InRange(new Gray(_minProperty.Value), new Gray(_maxProperty.Value));
                _output.SetData(output);
            }
            else
            {
                throw new NotImplementedException();
            }

            frame.Dispose();

            FireProcessingStateChanged(ProcessingState.Finished);
        }
        public override void Process()
        {
            FireProcessingStateChanged(ProcessingState.Started);
            var frame = (IImage)_input.GetData();

            if (frame is Image <Rgb, byte> )
            {
                _output.SetData((frame as Image <Rgb, byte>).Convert <Hsv, byte>());
            }
            else if (frame is Image <Bgr, byte> )
            {
                _output.SetData((frame as Image <Bgr, byte>).Convert <Hsv, byte>());
            }
            else
            {
                throw new NotImplementedException();
            }

            frame.Dispose();

            FireProcessingStateChanged(ProcessingState.Finished);
        }
Example #10
0
        public override void Process()
        {
            FireProcessingStateChanged(ProcessingState.Started);

            lock (_)
            {
                _viewer = new ImageViewer
                {
                    StartPosition   = FormStartPosition.Manual,
                    FormBorderStyle = (FormBorderStyle)Enum.Parse(typeof(FormBorderStyle), _borderStyleProperty.Value.ToString()),
                    Size            = (Size)_sizeProperty.Value,
                    Location        = (Point)_locationProperty.Value,
                    Text            = _nameProperty.Value as string,
                    Image           = (IImage)_inputPin.GetData(),
                    TopMost         = true,
                };
                _viewer.ImageBox.SetZoomScale(_zoomProperty.Value / 100f, Point.Empty);
            }
            Application.Run(_viewer);
            _viewer = null;

            FireProcessingStateChanged(ProcessingState.Finished);
        }
Example #11
0
        public override void Process()
        {
            FireProcessingStateChanged(ProcessingState.Started);
            var image    = (IImage)_input.GetData();
            var detector = new MSERDetector
                           (
                _deltaProperty.Value,
                _maxAreaProperty.Value,
                _minAreaProperty.Value,
                _maxVariationProperty.Value,
                _minDiversityProperty.Value,
                _maxEvolutionProperty.Value,
                _areaThresholdProperty.Value,
                _minMarginProperty.Value,
                _edgeBlurSizeProperty.Value
                           );

            using (var storage = new MemStorage())
                detector.ExtractContours(image, null, storage);
            detector.Dispose();
            image.Dispose();

            FireProcessingStateChanged(ProcessingState.Finished);
        }