Here i am explaining a simple motion detection project. Platform used is raspberry pi. Motion is detected using the simplecv libraries in python.

What is SimpleCV ?
SimpleCV is an open source framework for building computer vision applications. With it, you get access to several high-powered computer vision libraries such as OpenCV – without having to first learn about bit depths, file formats, color spaces, buffer management, eigenvalues, or matrix versus bitmap storage.

Step 1:

Parts needed

1.Raspberry pi

2.USB Camera

Now we can see how the motion is detected using the camera. By taking multiple images and subtracting their pixel matrix. If their is no motion, the difference between the images will be almost equal to zero or a small value. Otherwise if motion detected, their will be a particular big value for the difference matrix. This is the basic idea behind the motion detection.

The python code for motion detection is given below

from SimpleCV import Camera,Display
import time
cam=Camera() //Intializing camera
time.sleep(3) //delay for three seconds
a=cam.getImage()//capturing the first image
b=cam.getImage()//capturing the second image after one second
d=b-a //subtracting the image pixels
d.show() // display the subtracted image
mat=d.getNumpy() //converting to numpy array
avg=mat.mean() //take the mean
print avg //print average value on the screen
if avg>6:
print("Motion Detected")
else: print("not detected")

<p>Nice job! The Raspberry Pi is amazing! :D</p><p>Going to try soon.</p><p>#RaspberryPI</p>

About This Instructable



More by mebinpm:Motion Detection Using Raspberry Pi INTELLIGENT BABY ROCKER 
Add instructable to: