Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable webcam's Autofocus in Linux

Tags:

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?

like image 462
Margarita Gonzalez Avatar asked May 01 '13 14:05

Margarita Gonzalez


1 Answers

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 
like image 128
Velimir Mlaker Avatar answered Oct 04 '22 22:10

Velimir Mlaker