Skip to content

Instantly share code, notes, and snippets.

Avatar

Uzzal Podder uzl

View GitHub Profile
@jwhendy
jwhendy / set_opencv_webcam.py
Last active Nov 2, 2020
An example of setting webcam settings via v4l2-ctl in a python script. Some of the CAP_* settings in opencv didn't seem to work.
View set_opencv_webcam.py
import cv2
import subprocess
### for reference, the output of v4l2-ctl -d /dev/video1 -l (helpful for min/max/defaults)
# brightness (int) : min=0 max=255 step=1 default=128 value=128
# contrast (int) : min=0 max=255 step=1 default=128 value=128
# saturation (int) : min=0 max=255 step=1 default=128 value=128
# white_balance_temperature_auto (bool) : default=1 value=1
# gain (int) : min=0 max=255 step=1 default=0 value=0
# power_line_frequency (menu) : min=0 max=2 default=2 value=2
You can’t perform that action at this time.