Hello Everybody, this last trimester i've decided to create a photo application, it's called Photorama.
I'll be developing Photorama, using as3, pixel bender (mainly).
This week I've done some research about how to activate a computer's camera using as3. I have also gone over pixel bender, on how to create filters and to understand how the syntax works.
So far i've created a prototype of a very simple photo booth application, using as3.
The way I have approached the camera activation is by instantiating a camera & video in my as3 document.
Then I had to make an "if" statement: "if the camera exists in the device, this creates (addChild) my video (attaching the camera to it), if not, trace that a camera has not been found".
The camera allowance is part of adobe flash, which can be done by importing the following:
import flash.media.Camera;
import flash.media.Video;
To this point, I have not added any plug-ins or extra folders to make the camera access.
The result of the mentioned is the following:
By clicking on "Allow", you are allowing flash to make use of your device's camera. This activates it and displays the live video of what the camera is pointing at. (It does not record whatever it is displaying).
The next step was a bit confusing to me: to capture an image by clicking a button.
I had to play around using Bitmap & BitmapData (you can work with pixels of a bitmap object).
So I went over the same thing again, instantiating both (Bitmap & BitmapData) and giving them a variable name to each one of them. In my "capture" function, I added both variables and parsed the video (child) variable to the BitmapData variable I had previously instantiated (setting widths & heights for the video itself and the "final" product, being the actual photo taken).
bitmapData.draw(video);
After a bit of time playing around I came up with a positive result (please don't laugh at my appearance):
The 'photograph' on the left hand side is the video, the real time display. The one on the right hand side is the photograph taken by clicking on the little camera icon.
Now the next step is to add a 'flash' looking light and then capture the photo, this way the photos can look brighter..
There is a lot to do, as this is only a prototype, "simple game" style app. I will be looking into MVC this weekend and starting to implement at least one filter to analise how the coding is going to be distributed in the as3 classes.





No comments:
Post a Comment