A bash script using streamer and convert to detect the ambient room brightness using webcam.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
filename=capture.ppm | |
streamer -o $filename >/dev/null 2>&1 | |
rgb=$(convert $filename -resize 1x1 txt:- | sed -n 2p | grep -Po "#\w+" | cut -c 2-) | |
if [[ 0x$rgb -lt 0x212121 ]] | |
then | |
echo yes | |
else | |
echo no | |
fi | |
rm $filename |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment