Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to disable autofocus of a webcam on Windows 10?

I am working with python opencv and I am not able to disable autofocus, autoexposure etc on windows 10.

I am using Logitech BRIO 4k webcam.

On Ubuntu 18.04 with Opencv 3.4.4 using v4l backend I am able to set focus, exposure, video resolution successfully. However the same code doesn't work on windows

I have tried:

  1. Unofficial pre-built OpenCV packages for Python: opencv-contrib-python https://pypi.org/project/opencv-contrib-python/
  2. build from source opencv 3.4.3 with MSMF, VFW, DSHOW backends
  3. build from source opencv 4.1 with MSMF, DSHOW backends

in every case above I am able to use opencv functionality, read and show frames from a webcam, but not able to disable autofocus.

Code that I use https://github.com/opencv/opencv/blob/master/samples/python/video_v4l2.py

I use the following code to specify backend VideoCapture(0 + BACKEND_ID) where BACKEND_ID is taken from here

https://docs.opencv.org/3.4.3/d4/d15/group__videoio__flags__base.html