3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

Web controlled Surveillance Camera

Step 7Easy Motion Detector Program

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.
4. Delay 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,jpgor 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 folder. & option, put it to run on background.

And next..

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
PATH=/usr/webcam/pictures/
while(true)
do
cp $PATH/caption.jpg $PATH/tmp/caption2.jpg
sleep 10
compare -metric PSNR $PATH/caption.jpg $PATH/tmp/caption2,jpg null > result
result2=`head -c 4 result`
result2=${result2/./}
if test $result2 -lt 300
then
time=`date +%_T_%F`
cp $PATH/caption,jpg $PATH/save/$time.jpg
fi
done

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
« Previous StepDownload PDFView All StepsNext Step »

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
25
Followers
4
Author:iideetee