Reputation: 59
I'm trying to code some program to detect a video freeze on a RaspberryPi and I'm having trouble on my bash script. Here is what I've done to compare two screenshots in order to detect the freeze :
#!bin/bash
while true
do
sudo rm -rf /home/pi/shots/*
sudo raspi2png -p /home/pi/shots/screen1.png -d 5
sudo raspi2png -p /home/pi/shots/screen2.png -d 5
ndiff=`compare -metric AE /home/pi/shots/screen1.png /home/pi/shots/screen1.png null:`
if [ "$ndiff" -lt "100" ] ;
then
sudo reboot
fi
done
I followed those intructions : Compare 2 images and find % difference but I think the illegal number comes from ndiff, can you please tell me what can I do ? Thanks
Upvotes: 0
Views: 789