C # Emgu webcam - select capture size

I am using the Emgu library to integrate the open features of a CV webcam in C #.

I use this code to select a capture device and set its size:

camera = new Capture(0); camera.SetCaptureProperty(CAP_PROP.CV_CAP_PROP_FRAME_WIDTH, videoSettings.width); camera.SetCaptureProperty(CAP_PROP.CV_CAP_PROP_FRAME_HEIGHT, videoSettings.height); 

Then I show it in imageBox as follows: imageBox1.Image = camera.QueryFrame();

Then, to capture a snapshot of the current frame, I use this code:

 Image<Bgr, byte> snapshot = camera.QueryFrame(); snapshot.Save("snapshot.jpg"); 

Although I would like to be able to save a picture with a higher resolution than the preview window.

But the problem is that, as far as I know, I can not create a new "Capture" object using the same webcam. So I wonder if it is possible to set the height and width of camera.setCaptureProperty to say 1028x720, but then somehow crop it to display it in an imageBox with a resolution of 514x360?

Or is there any other way to do this?

+7
source share
2 answers

I solved it using

 imageBox1.SizeMode = PictureBoxSizeMode.StretchImage; 
+9
source

I solved this with the Resize () method in QueryFrame ()

 currentFrame = grabber.QueryFrame().Resize(320, 240, Emgu.CV.CvEnum.INTER.CV_INTER_CUBIC); 
+2
source

All Articles