Exemple #1
0
        public override void Process()
        {
            FireProcessingStateChanged(ProcessingState.Started);
            var frame = (IImage)_input.GetData();
            var size  = (Size)_sizeProperty.Value;

            if (frame is Image <Bgr, byte> )
            {
                var image  = (Image <Bgr, byte>)frame;
                var result = image.Resize(size.Width, size.Height, INTER.CV_INTER_CUBIC);
                _output.SetData(result);
            }
            else if (frame is Image <Gray, byte> )
            {
                var image  = (Image <Gray, byte>)frame;
                var result = image.Resize(size.Width, size.Height, INTER.CV_INTER_CUBIC);
                _output.SetData(result);
            }

            frame.Dispose();

            FireProcessingStateChanged(ProcessingState.Finished);
        }
Exemple #2
0
        public override void Process()
        {
            FireProcessingStateChanged(ProcessingState.Started);
            var frame = (IImage)_input.GetData();
            var mptr  = (MIplImage)Marshal.PtrToStructure(frame.Ptr, typeof(MIplImage));

            if (mptr.nChannels == 3 && mptr.depth == IPL_DEPTH.IPL_DEPTH_8U)
            {
                var image = (Image <Bgr, byte>)frame;
                FireProcessingProgressChanged(0.1);
                var image1 = image.PyrDown();
                image.Dispose();
                FireProcessingProgressChanged(0.5);
                frame = image1.PyrUp();
                image1.Dispose();
                FireProcessingProgressChanged(1);
            }

            _output.SetData(frame);
            FireProcessingStateChanged(ProcessingState.Finished);
        }