This works only under Linux!
1. Install your webcamera.
2. Install capture software called Xawtv. It creates file called .webcamrc
3. Open the file with your favorite editor.
defines how often the still-picture is sent to server. I used 7 seconds. Dir
defines location folder where the picture goes. Something like: /usr/webcam/pictures/ File
defines name of the picture. Something like caption,jpg
or what you want to use.
5. Save and exit.
6. Now you can try the command webcam &
. The program start updating the picture on every 7 second to
the defined dir
option, put it to run on background.
Install ImageMagick software.
Under Fedora command is: yum install ImageMagick
Software contains function called compare
and this is what we need.
Now you have to code a Shell script. Use your editor to do that.#!bin/sh
cp $PATH/caption.jpg $PATH/tmp/caption2.jpg
compare -metric PSNR $PATH/caption.jpg $PATH/tmp/caption2,jpg null > result
result2=`head -c 4 result`
if test $result2 -lt 300
cp $PATH/caption,jpg $PATH/save/$time.jpg
Now you can run your script with command: sh gived_script_name
If the picture contains difference, it will be saved to defined folder. In my example it goes to /usr/webcam/pictures/ save/
About the ImageMagick and the compare function you will find more information from here http://www.imagemagick.org/script/compare.php