views:

42

answers:

1

Hey, i was wondering what do the AS3 experts would do to detect a color with the webcam (red) and draw a sprite on those color boundaries.

Thanks in advance.

+1  A: 

You can access the pixel data in BitMap (Or more correctly, the associated BitMapData) to write your own filter, or you could use a BitmapFilter.

You should be able to capture a bitmap from the webcam by drawing Video to a bitmap you create (use draw() to draw the current video image).

So this should get you a bitmap and a way of detecting pixels in it. Now you can change the bitmap to add your own graphics (or put them in a sprite that is on top of the bitmap). Show the bitmap on screen after you've changed it, and repeat this for every frame :-)

See http://www.kasperkamperman.com/blog/flash-code/as3-apply-bitmap-filters-to-a-webcam-image/ for some inspiration.

Simon Groenewolt