I have still images captured over the course of one night by a webcam. The majority are identical, since the lighting in the images is uniform. However, some are significantly different from the rest - they have visible human movement through the frame.
How can I detect which of the images are significantly distinct, so that the movement will be included in them? Better yet, is there a way of specifically detecting motion?
I'm guessing that a library like OpenCV or SimpleCV can accomplish this easily, but I'm not limited to using those ones.
In SimpleCV,
cam = Camera()
prev = cam.getImage()
while True:
current = cam.getImage()
fs = current.findMotion(prev, method="LK")
if fs: #if there's motion
print "motion found"
prev = current
Image.findMotion()
uses Optical Flow to detect motion. You can use this very easily. Add some condition regarding how much motion do you expect.
fs.dx
and fs.dy
will give you all the points where motion has been detected.
I have made an example in which I take input from camera and by detecting horizontal and vertical motion, I control Banshee Media Player. you can find it here on my GitHub.