More
See all Show me
17. Gravy
9 months ago
16. Sunday
9 months ago
15. The Neural Orb
10 months ago
14. Painting
10 months ago
11. Thanksgiving
1 year ago
4. Tracking Multiple Objects Using a Webcam
1 year ago
3. War on War
1 year ago
2. Back Yard Tour
1 year ago
1. Tacos
1 year 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: north.com/labs/actionscript-3-webcam-track-multiple-objects.asp

Credits

1 Like

Tags

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

Advertisement

Statistics

  •  
    plays
    likes
    comments
  • Total
    plays 93
    likes 1
    comments 0
  • Dec 5th
    plays 0
    likes 0
    comments 0
  • Dec 4th
    plays 0
    likes 0
    comments 0
  • Dec 3rd
    plays 0
    likes 0
    comments 0
  • Dec 2nd
    plays 0
    likes 0
    comments 0
  • Dec 1st
    plays 0
    likes 0
    comments 0
  • Nov 30th
    plays 0
    likes 0
    comments 0
  • Nov 29th
    plays 0
    likes 0
    comments 0
  • Nov 28th
    plays 0
    likes 0
    comments 0
Previous Week

Downloads

Please join Vimeo or log in to download the original file. It only takes a few seconds.