Motion Detection
CamCapture was working perfectly and was uploading every picture it took to the internet. However, this feature was slowly becoming very annoying. CamCapture took pictures at fixed intervals of time, and most of the pictures had nothing but an empty room! It uploaded hundreds of picture of an empty room and bombarded my email account with useless notifications. I wanted my application to take pictures only when someone entered my room. In other words, I had to make my program detect motion!
Well at first, I had no clue where to start. I had to spend several hours thinking of ways to detect motion. I found some very helpful articles on the Internet related to motion detection. After some research, I came up with an algorithm which detected motion by comparing each frame captured by the camera with the previous one. If the frames were more or less the same, fine, but if they had differences above a certain limit, the program would trigger a motion detection event. So, for every frame captured, I compared the pixels with the previous frame for brightness changes. If the brightness change of a certain pixel exceeded a tolerance limit, the program would increment a counter. At the end of the scan, it checked the value of the counter and if it exceeded a certain limit, it triggered a motion detection event. There was actually a time when I scanned each and every pixel for brightness changes. However, I quickly realized that it wasn’t a very good idea because scanning each pixel took several seconds, and time is a crucial factor for quick motion detection. So, after some experimentation, I decided to scan each frame diagonally and check only a limited number of pixels for changes. This reduced the scan time considerably. This algorithm works quite nicely. Now, I won’t have to delete several useless CamCapture notifications from my mail account because I only get notifications when something actually moves. :) Click here to see a snapshot of my motion detector. Before I created the actual motion detector, I created a motion analyzer for testing different algorithms. Click here to see a snapshot of the motion analyzer.
Reference:
- Webcam Motion Detection: Using the BitmapData API in Flash 8 by Guy Watson: http://www.adobe.com/devnet/flash/articles/webcam_motion.html
- Motion Detection Algorithms by Andrew Kirillov: http://www.codeproject.com/cs/media/Motion_Detection.asp
- Motion Detection and Recognition Research by Randal C. Nelson and Ramprasad Polana: http://www.cs.rochester.edu/u/nelson/research/motion/motion.html


15 comments:
hey man! found your site. ill try and get some pics scanned in and email em to you when i can. nice sunglasses
WELL DONE AND KEEP IT UP.
TIMULMAMA
Ashish, this is really great! that u r experimenting various ideas...keep this spirit always..
All the best!
hi ashish.. thats a wonderful program.. could you please mail me at "fiseye at gmail dot com".. i need some help for my project.. hope u do reply! :) thanks in advance
Hi ashish. I am really excited to find your website and see that you are doing something related to my project. I am currently trying to track multiple objects in a moving camera and I wonder whether you could mail me your source code to robinlee_1128 at yahoo.com.cn, so that I can learn sth. from you. Thank you very much!
Hi, I like your bot. I work with NXT lego mindstorm. I would like to use your motion detection algorithms, can you help me?
write me to bren[at]juanantonio.info
visit my webpage www.juanantonio.info or visit lejos.org
HI THERE
I M WORKING ON A PROJECT ON COLOUR BASED OBJECT SENSING FOR FOR IMPARTING VISION TO MY ROBOT .. I M NEW TO PROGRAMMING . AN U PLEASE SEND ME THE SOURCE CODE OF THIS PROJECT OF URS TO HELP ME OUT .. PLS
MY EMAIL ID IS (kunalbhalla.1986@gmail.com)
hey man, nice work u doing there....
me jus starting from basics for robotics... had a difficult time trying to move a four wheel vehicle using pic micro controller... now after achieving that, i wish to go for webcam installed on robot... but before that i need to study motion detection. can u send me more info on ur work and the source files if poss... if u have any ideas to help me out, i would be very thankful... my email is ajay_karuna@hotmail.com
See some of my Flash webcam experiments & interactive samples on http://www.SillyWebcam.com .
nice work... i'm really interested in your projects. i'm a beginer in VB6 programming and still studying. i'm interesred in your motion detection projects. i want to study your programs. could you please mail me the source code at pachinko27@gmail.com. thanx a lot.
erm how do u make windows apps? i am a very big beginner lol=] and i really like the self navigating viper robot ***** great work, even though i've no idea how to do it. is it c# or c++ or something???
do u know anything about java?
Awesome Project, Well Done!! Do you use VB 2005? If so, Would you like to send the sample project to my email (homeland_edelweiss@yahoo.com) I'm still newbie on webcam programming, especially on motion detector. Thx B4...
hi ashish.......i am trying to develop motion detection algorithm...but the problem is i am new to programming could you send me source code of this.....it will help me to understand better.....plz it is quit urgent plz help me on this...
my address is wajihazaidi@hotmail.com
great work ashish and keep sharing
Regards
PM NG Mark
Post a Comment