Skip to content

Instantly share code, notes, and snippets.

@gene1wood
Created February 7, 2021 17:52
Show Gist options
  • Save gene1wood/a05dc51531be0b7c02b99b4d5a7e8ebd to your computer and use it in GitHub Desktop.
Save gene1wood/a05dc51531be0b7c02b99b4d5a7e8ebd to your computer and use it in GitHub Desktop.
#!/bin/bash -x
if [ -n "$2" ]; then
percent="$2"
else
percent=0
fi
camera="$(v4l2-ctl --list-devices | grep -A1 "$1" | tail -1 | awk '{print $1}')"
$(v4l2-ctl -d "$camera" -l | awk '$1 == "white_balance_temperature" {print "export "$5" "$6}')
(( range = max - min ))
(( step = range / 100 ))
(( temp = percent * step + min ))
v4l2-ctl -d "$camera" --set-ctrl=white_balance_temperature_auto=0
v4l2-ctl -d "$camera" --set-ctrl=white_balance_temperature=$temp
#!/bin/bash
if [ -z "$1" ]; then
temp=25
else
temp=$1
fi
~/bin/set-whitebalance "Integrated_Webcam_HD" $temp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment