How do I enable the webcam to auto focus before snapping the image?
My code for capturing the image is as shown:
{
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 have tried using wait key, etc, tried googling but to no avail. Does anybody have any idea how I can ensure that autofocus is applied already before snapping the image? Cuz the image now is a little more "blurry" than I would like it.
According to this page "Logitech webcam B910, C910 and C920 Auto-focus fix" it seems that the focus on Logitech C920 webcam is factory adjusted for short and medium distances. The same page has some instructions about changing the factory setup.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With