Exemplo n.º 1
0
        static void Main()
        {
           var reader = new CameraCapture(0); //capture from camera
           //reader = new FileCapture(Path.Combine(getResourceDir(), "Welcome.mp4"));
           reader.Open();

           var writer = new VideoWriter(@"output.avi", reader.FrameSize, /*reader.FrameRate does not work Cameras*/ 30); //TODO: bug: FPS does not work for cameras
           writer.Open();

            Bgr<byte>[,] frame = null;
            do
            {
                reader.ReadTo(ref frame);
                if (frame == null)
                    break;

                using (var uFrame = frame.Lock())
                { writer.Write(uFrame); }

                frame.Show(scaleForm: true);
            }
            while (!(Console.KeyAvailable && Console.ReadKey(true).Key == ConsoleKey.Escape));

            reader.Dispose();
            writer.Dispose();
        }
Exemplo n.º 2
0
        static void Main()
        {
            Console.WriteLine("Press ESC to stop playing");

            var reader = new CameraCapture(0); //capture from camera
            (reader as CameraCapture).FrameSize = new Size(640, 480);

            //reader = new FileCapture(Path.Combine(getResourceDir(), "Welcome.mp4")); //capture from video
            //reader = new ImageDirectoryCapture(Path.Combine(getResourceDir(), "Sequence"), "*.jpg");
            reader.Open();

            Bgr<byte>[,] frame = null;
            do
            {
                reader.ReadTo(ref frame);
                if (frame == null)
                    break;

                frame.Show(scaleForm: true);
            }
            while (!(Console.KeyAvailable && Console.ReadKey(true).Key == ConsoleKey.Escape));

            reader.Dispose();
        }