I’m working in embebed system in the beagleboard. The source code is in Python, but I import libraries from OpenCV to do image processing. Actually, I’m using the webcam Logitech c910, it’s a excellent camera but it has autofocus. I would like to know if I can disable the autofocus from Python or any program in Linux?
Advertisement
Answer
Use program v4l2-ctl
from your shell to control hardware settings on your webcam. To turn off autofocus just do:
v4l2-ctl -c focus_auto=0
You can list all possible controls with:
v4l2-ctl -l
The commands default to your first Video4Linux device, i.e. /dev/video0
. If you got more than one webcam plugged in, use -d
switch to select your target device.
Installing v4l-utils
Easiest way to install the utility is using your package manager, e.g. on Ubuntu or other Debian-based systems try:
apt-get install v4l-utils
or on Fedora, CentOS and other RPM-based distros use:
yum install v4l-utils