00:00
49
More
See all Show me
22. Forever Enough
2 years ago
21. Isolated Beauty
2 years ago
20. All Hail Pdx
2 years ago
19. Belize
2 years ago
18. Wheels
2 years ago
17. Gravy
2 years ago
16. Sunday
2 years ago
15. The Neural Orb
3 years ago
14. Painting
3 years ago
11. Thanksgiving
3 years ago
10. AS3 Webcam Drawing
3 years ago
9. Tracking Multiple Objects Using a Webcam
3 years ago
3. War on War
3 years ago
2. Back Yard Tour
3 years ago
1. Tacos
3 years ago
In continuing exploration into motion tracking using flash and a webcam I've created an application that enables you to track multiple objects based on color. The holy grail of the application is of course to track multiple objects without specifying color. However, this is a good step forward and actually opens up many other avenues for use. Color, after all, is ubiquitous.

The truly useful part of the code is getColorBoundsRect. If you're unfamiliar with this function, it determines a rectangular region that either fully encloses all the pixels of a specified color within a BitmapData object, or fully encloses all pixels that do not include the color. The function returns a rectangle around the color area. You can then reference this rectangles x and y respectively.

var areaColor:Rectangle = SomeBitmapData.getColorBoundsRect( 0xFFFFFFFF, _colorArray[i].color, true );

The function is rather finicky about the depth of where the object is. Since it's only searching for a certain RGB value it tends to lose it if the lighting or the object gets too small in the camera's depth of field. To overcome this you could search for similar colors. Soulwire has written a sweet Color utility class that can aid you in this endeavor. However, searching for a range of colors will also come with it's challenges, as the more range of color you search on the tougher it will be to pinpoint the exact object you want to track.

Check out the demo here: Tracking Multiple Objects Using a Webcam [webcam obv required]

Music: My Morning Jacket - I'm Amazed

Credits

Likes

This conversation is missing your voice. Take five seconds to join Vimeo or log in.

Advertisement

About this video

FLV
00:00:49
  • 504x380, 3.25MB
  • Uploaded Mon November 24, 2008
  • Please join or log in to download

Statistics

Date Plays Comments
Totals 5,768 4 0
Feb 14th 0 0 0
Feb 13th 0 0 0
Feb 12th 0 0 0
Feb 11th 0 0 0
Feb 10th 0 0 0
Feb 9th 0 0 0
Feb 8th 0 0 0