Auto focus webcam before snap image using OPENCV

How to turn on the webcam for auto focus before snap the image?

My image capture code looks like this:

{
    CvCapture* capture = cvCaptureFromCAM(0); // capture from video device #0


    cvSetCaptureProperty(capture ,CV_CAP_PROP_FRAME_WIDTH , 800); 
    cvSetCaptureProperty(capture ,CV_CAP_PROP_FRAME_HEIGHT , 600); 


    if(!cvGrabFrame(capture))  //if no webcam detected or failed to capture anything
    {              
        cout << "Could not grab a frame\n\7";
        exit(0);
    }

    IplImage* img=cvRetrieveFrame(capture);           // retrieve the captured frame
}

I tried using the wait key, etc., tried to use Google, but to no avail. Does anyone know how I can guarantee that autofocus is applied even before the image is clicked? Because the image is now a little more “blurry” than I would like.

+3
source share
1 answer

" - Logitech B910, C910 C920 " , - Logitech C920 factory . factory.

+1

All Articles