Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
A bash script using streamer and convert to detect the ambient room brightness using webcam.
#!/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