Flash/Air Laser Graffiti
After seeing this amazing video on youtube of laser graffiti (where the software is made in .Net),
I realized that this can also be done in flash. So I made a small laser graffiti Air application.
See here the result:
I would release the source, but it’s not clean and I made it for my screen, projector, camera and webcam settings. But basicly it works like this:
Create a bitmapData object of your video object which displays the camera. With a ColorMatrixFilter you remove all but the red color values. And finally, with the getColorBoundsRect method you get the rectangle object of the red values (= my red laser pointer). the x and y position is the position of the pointer, there you start drawing. Simple as that.
bmd.draw(video) var matrix:Array = new Array(); matrix = matrix.concat([1.5,0 , 0, 0, 0]); matrix = matrix.concat([0,0, 0, 0, 0]); matrix = matrix.concat([0, 0, 0, 0, 0]); matrix = matrix.concat([0, 0, 0, 0, 0]); redFilter = new ColorMatrixFilter(matrix); bmd.applyFilter(bmd,bmd.rect,new Point(0,0),redFilter) var maskColor:uint = 0xFF0000; var color:uint = 0xFF0000; var redBounds:Rectangle = bmd.getColorBoundsRect(maskColor, color, true); trace (redBounds.x) trace (redBounds.y)