Skip to content

Instantly share code, notes, and snippets.

@quantombone
Created June 6, 2015 00:58
Show Gist options
  • Save quantombone/8999b28fab088a01a6c3 to your computer and use it in GitHub Desktop.
Save quantombone/8999b28fab088a01a6c3 to your computer and use it in GitHub Desktop.
Plays Astley when eyes detected. A rick_roll example using VMX and VMXwebcam.
#!/bin/sh
# Needs VMX with an "eyes" model, jq, and the vmx_detect.sh script
# This will open up the rick astley video when a face is detected from the webcam.
# vision.ai 2015
./Contents/Macos/VMXwebcam 2 :0 > url 2> log&
./Contents/Macos/VMXwebcam 2 :0 > url &
sleep 1
URL=http://`cat url`
echo URL IS $URL
for i in `seq 1 100000`; do
./vmx_detect.sh eyes $URL > json.json
REALSCORE=`cat json.json | jq '.objects[0].score'`
SCORE=`cat json.json | jq '.objects[0].score > 1'`
echo "SCORE is " $REALSCORE
if [ "$SCORE" == "true" ]; then
#say "Rick roll"
open https://www.youtube.com/watch?v=dQw4w9WgXcQ
exit
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment