(DisplacementMapFilter && WebCam) == (Tons O' Fun!)
I threw this experiment together out of pure boredom while traveling... and what a great idea that was. :) I have spent way too much time sitting here making funny pictures using my webcam and the DisplacementMapFilter object. You can make people look fat, look thin, look distorted... it is like a fun-house mirror through the web. Here is a preview video to start with, and then we'll get into how it works.
Or, you can interact with it here: (Requires a webcam)As usual, I started this experiment by building off of some older experiments. I started with my CameraStream and PaintCanvas components. The PaintCanvas component allows you to draw on a canvas using the mouse. It is really just a simple paint program. The CameraStream component allows you to easily drop a web cam video stream into a Flex application. Where this gets really interesting is how the two components interact with each other.
Basically, There are 2 drawing modes for the application:
There is some great information on DisplacementMapFilters here:
Enjoy!
Or, you can interact with it here: (Requires a webcam)As usual, I started this experiment by building off of some older experiments. I started with my CameraStream and PaintCanvas components. The PaintCanvas component allows you to draw on a canvas using the mouse. It is really just a simple paint program. The CameraStream component allows you to easily drop a web cam video stream into a Flex application. Where this gets really interesting is how the two components interact with each other.
Basically, There are 2 drawing modes for the application:
- Displacement Mode
- Drawing Mode
displacementBitmap = getBitmapData( paintCanvas );I also added some sliders to allow you to adjust the parameters used in the displacement. The blur parameters affect a blur filter that is on the paintCanvas. The displacement parameters allow you to adjust the amount of displacement in the X and Y directions. The color modifies the drawing color (FYI: different colors are affected more by the displacement. Read up on displacementMapFilters for a further understanding.) The thickness parameter adjusts the thickness of the line drawn on the PaintCanvas component.
var displacementMapFilter : DisplacementMapFilter =
new DisplacementMapFilter(
displacementBitmap, new Point(0,0),
2, 4, displacex.value, displacey.value,
DisplacementMapFilterMode.CLAMP );
videoContainer.filters = [ displacementMapFilter ]
There is some great information on DisplacementMapFilters here:
- DisplacementMapFilter API Refference
- Grant Skinner's WebCam Goo (with source)
- Psyark’s DisplacementMapFilter Tutorial
Enjoy!





3 Comments:
Hi,
I'd like to know how you did it.
Is it possible to copy data from webcam (via Camera object) to a ByteArray object ?
Thanks
any hint on how i could get this to work on a mac inte?
Wow... looks like the best displacement map filter application I've ever seen!
One thing that can improve your app is make it possible to use draw optioin in any direction:)
If you are interested, i made one pretty nice app using displacement maps.
Here it is: http://lodging-world.com/flash_fun/flash_morphing.htm?ID=D3RQ3Rvcl27P
Hope you'll find it funny:)
Post a Comment
<< Home