Camera Capture in 7 lines of code

From EMGU
Revision as of 21:11, 10 January 2023 by Canming (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This example has been tested on Emgu CV 4.6.0.0

Only a few lines of code are required to perform a camera capture loop.

using Emgu.CV;
...

            String win1 = "Test Window (Press any key to close)"; //The name of the window
            CvInvoke.NamedWindow(win1); //Create the window using the specific name
            using (Mat frame = new Mat()) 
            using (VideoCapture capture = new VideoCapture())
                while (CvInvoke.WaitKey(1) == -1) 
                {
                    capture.Read(frame);
                    CvInvoke.Imshow(win1, frame);
                }