Search code examples
c#emgucv

Take Snapshot using webcam and EmguCV in c# in console application


I need a simple, but complete, example of capturing a snapshot from Logitech USB webcam in a console application, but I don't find.

The next instruction not works.

private Capture _capture = null; //Camera

Where is Capture definition? In the Emgu.CV.World not it is.

I use the 3.2.0 version of EmguCV.

http://www.emgu.com/wiki/index.php?title=Camera_Capture

Thank you in advance.

The error is the attached image


Solution

  • Did you read the entire article? It is instantiated here:

     private void SetupCapture(int Camera_Identifier)
        {
            //update the selected device
            CameraDevice = Camera_Identifier;
    
           //Dispose of Capture if it was created before
            if (_capture != null) _capture.Dispose();
            try
            {
                //Set up capture device
                _capture = new Capture(CameraDevice);
                _capture.ImageGrabbed += ProcessFrame;
            }
            catch (NullReferenceException excpt)
            {
                MessageBox.Show(excpt.Message);
            }
        }
    

    Hope this helps.

    Doug