Multiple Motion Areas in Flash Motion Detection

Reading Time: 1 minute

Motion detection in Flash relies on a technique that uses frame comparison to detect whether pixels have changed within the camera feed. A “comparison” frame would look something like the image below, where the white areas indicate movement or a change in pixel value.

Using the getColorBoundsRect() method, the application can approximate which areas of the video has motion. Using the example above, I would call the getColorBoundsRect() method to look for white pixels in the BitmapData. This is all fine and dandy, but I was curious to see what performance was like if I was to try and get the position and size of each individual blob in the comparison frame.

Here’s the result of the experiment:

This movie requires Flash Player 9

After this test, it was interesting to see the amount of data that we can extract with this method. The demo returns a list of Rectangle objects every frame, which means that we now have x,y positions and size for every bit of motion that occurs within the frame. I think the next step is to see whether we can write something that checks the distance between these small areas and try to detect some simple gestures.

2 Replies to “Multiple Motion Areas in Flash Motion Detection”

  1. it looks like the squares get larger as you approach the camera. If the squares were planes on a cube and the opposite planes were anchored to your face, would you be able to calculate depth as they stretch in and out from that anchor point as you wave your arms? And when do we get to see a hyduken? 😀

  2. hi this is really awsome work..I really need a help of urs…its a request to u…I need a flash file same like this I mean…I need a simple webcam if our hand go to a button it should go to nextframe..plz only one tht. file…with webcam…when camera is on and when we move our hand near a button it should change its color and it should go to next frame…its for my school project …hope u can do this easily…

Leave a Reply

Your email address will not be published. Required fields are marked *