Flash® 8 - WebCam Snapshot by Robert M. Hall
Robert M. Hall completed this amazing example. It provides WebCam to JPEG conversion using a PHP application using the new flash.display.BitmapData class. Simply take a picture using an attached webcam and you will receive a JPEG as output.
Robert used flash.Display.BitmapData and getPixel to read image data and post it to a PHP application for JPEG processing. Roberts example is very useful for Kiosk installations where you might want to send postcard images or provide printed output to a end user.
Flash® By Example ships with more than client-side software. In this example, Robert provides a PHP application to add JPEG output from client side Flash®. We will be providing other server-side software in Flash® By Example because data integration is critically important in building Rich Internet Applications.
If you are interested in exploring Macromedia® Flash® from a different perspective, we invite you to license Flash® By Example. Robert M. Hall is one of 24 amazing authors contributing to our ever growing library of examples. Great example Robert!
More to come,
Ted :)
7 Comments:
Hi excuse my english, I'm from Venezuela :).
I have a problem that I cannot seem to solve on my own...
Here it is :
When i run the webcam_snapshot.swf file directly from the example it take the snapshot, but, when i open the source file named webcam_snapshot.fla and generate a new .swf file, it doesn't take the snapshot and the second image (clone) it's white.
I am using Flash 8 Pro (Trial).
Any idea?
Please help me !!!!
rafael,
There is a typo in the snap_mc.onPress function. A reference to the _root is missing an underscore:
snap_mc.onPress = function () {
_root.bmpData1.draw( _root.local_video , scaleMatrix );
...
}
Hi,
In your sample, when I press 'take snapshot' the flash snapshot shows fine however, the php image is different to the flash image...It seems to show bright red or bright yellow instead of black in some places...Is this just my webcam or is it a bug?
Brendon
Hi Brendon,
I've ran into the same troubles as you have. It turns out that Robert's script did not correctly handle the case where the value for red is less than 0x10. Since the script started processing the values from left to right, all the values are shifted 4 (or in case of a red value of 0 even 8) bits. Using the following code in the first line of the hex2int function in php solves the problem:
$hex = str_repeat("0", (6-strlen($hex))).$hex;
There may be faster or better solutions but I had to come up with something quickly.
Sincerely, Raphael (not the one from Venezuela)
hi, i wanna know how to change the size of the image that i recieve in the php script because it's too small. thanks, Diego.
Diego, you can use different sizes for the video output, then you get different captures. Actually, you can adjust all 100% to the container, so the user can modify the framig just by resizing the window, see the examples in http://demofoto.hurriquest.eu/
It's nice that Flash can be exported to JPG (with a bunch of fussing and PHP/ASP help), see some of my image making samples @ www.SillyWebcam.com
Post a Comment
<< Home