I am using Video Input library to get frames from a webcam. I want to set FOCUS of this camera in C code.
Camera has AUTO FOCUS enabled. Isn't there a way to disable autofocus and set a specific focus value.
Regards, Saleh...
Have you tried this: https://stackoverflow.com/a/1718009/7531 It requires you use directshow, but this should be possible.
Otherwise, have you looked at the OpenCV documentation for CameraCapture. the section concerning camera parameters shows how --in general- you control camera parameters, a quick look in videoinput.h
should show you the parameters for autofocus.
This is a complete example of setting autofocus this way.
IAMCameraControl
is the windows interface for controlling parameters.
Note that depending on the webcam you use, and/or the specific firmware version it might not be possible to control focus / autofocus at all.