Created
December 14, 2015 13:44
-
-
Save amol9/89579987949bfb0c651e to your computer and use it in GitHub Desktop.
A bash script using streamer and convert to detect the ambient room brightness using webcam.
This file contains hidden or 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