ChromaTracker – A color detection and tracking library
The ChromaTracker ActionScript 3 library has been created to detect and track blobs of color in any DisplayObject. It is typically used to track colors in a live video camera (webcam) feed.
Demo
I guess the best way to understand what this library does is to actually see it in action. To view this live demo, simply authorize webcam access (don’t worry, I’m not saving this feed – it does not even go further than your own computer). Of course, you will need Flash and a webcam.
Try to pick a color that’s different from the rest of the environment. If the result is not convincing, take time to adjust the tolerance and blur parameters. In my experience, those two are the first parameters you should fiddle with to improve the results.
As you can see the green rectangle encompasses all detected pixels. You can retrieve this information by using the rect property of the ChromaTracker object. The red dot is positionned by using the center property of the object. Finally, the preview of detected pixels on the right is simply the bitmap property of the ChromaTracker object that has been placed on the stage.
This demo (with source code), the library and the full API documentation can all be found in the package below. The API documentation can also be viewed online.
Warning
This is beta software. It might contain bugs and is probably not ready for production use yet. Your comments, bug reports and suggestions will help me improve this library. You can send them on my contact page or simply by leave a comment at the bottom of this page.
If you make something cool with this library, let me know!
Download
Here is the full ChromaTracker download pakage (version 1.0b). It contains the library, the full API documentation and a working example.
2 comments