コード例 #1
0
        static void Main(string[] args)
        {
            //initialize capture and buffer
            VideoCaptureBase capture = new FileCapture("../Resources/video-vignette.mp4"); // /*or*/ capture = new CameraCapture();

            Bgr <byte>[,] frame = null;

            //initialize devignetting alg
            capture.ReadTo(ref frame);
            var devignetting = new Devignetting(frame, optimizeVignettingCentre: true);

            Bgr <byte>[,] correctedIm = frame.CopyBlank();

            //do the job
            do
            {
                capture.ReadTo(ref frame);
                if (frame == null)
                {
                    break;
                }
                frame.Show("Original");

                frame.CopyTo(correctedIm, Point.Empty);
                bool isDone = devignetting.DevignetteSingleStep(correctedIm);
                correctedIm.Show("Corrected");

                Console.WriteLine("Frame: {0:000}, is done: {1}", capture.Position, isDone);
            }while (!(Console.KeyAvailable && Console.ReadKey(true).Key == ConsoleKey.Escape));

            capture.Close();
        }