How to set video capture using raster data

I am using the Augmented Reality app for Android using Flash. For the application to work on my Android phone (nexus One), you must also activate the phone camera. So I need 2 layers, one for the background, which is the channel of my phoneโ€™s camera, and the other on top of it, which in this case is from away3d.

Thus, to create a BitmapData object to store information about the last frame of the webcam, I can do this job.

If I use the papervision3D library and FLARToolkit, we install BitmapData using the following part of the code found from this video tutorial :

//import libraries import org.libspark.flartoolkit.core.raster.rgb.FLARRgbRaster_BitmapData; import org.libspark.flartoolkit.detector.FLARSingleMarkerDetector; private function setupCamera():void { vid = new Video(640, 480); cam = Camera.getCamera(); cam.setMode(320, 240, 10); vid.attachCamera(cam); addChild(vid); } private function setupBitmap():void { bmd = new BitmapData(640, 480); bmd.draw(vid); raster = new FLARRgbRaster_BitmapData(bmd); detector = new FLARSingleMarkerDetector(fparams, mpattern, 80); } private function loop(e:Event):void { if(detector.detectMarkerLite(raster, 80) && detector.getConfidence() > 0.5) { vp.visible = true; detector.getTransformMatrix(trans); container.setTransformMatrix(trans); bre.renderScene(scene, camera, vp); } else{ vp.visible = false} } catch(e:Error){}}}} 

However, to implement my Im application using the Away3D engine and FLARManager, the way to do this is very different, as I understand it. I am implementing the following code, but the only thing he thinks is just to show the Flash camera before the 3D view, and I canโ€™t check if my application is working or not, because it does not show me any 3D object when I place the marker in front of the screen.

My code is:

 //Setting Up Away3DLite Camera3D import com.transmote.flar.camera.FLARCamera_Away3DLite; private var camera3D:FLARCamera_Away3DLite; this.camera3D = new FLARCamera_Away3DLite(this.flarManager, new Rectangle(0, 0, this.stage.stageWidth, this.stage.stageHeight)); //Setting Up the bitmapData private function bitmap():void { c = Camera.getCamera(); c.setMode(320,240,10) this.v.attachCamera(c); addChild(this.v); bmd = new BitmapData(640,480); bmd.draw(this.v); } 

Could you help me find out how I can combine these two?

I will be very grateful for any advice that I can get from you.

thanks

+2
source share
1 answer

To isolate your problem, I would try to break these two things down and make sure that each part works first. It seems that you have a part of the camera, try to make only some 3D (without AR), draw a cube or something else. Then try to implement AR, but try to do something simple, for example, to trace something or to make an object visible or invisible. Then start combining them.

+1
source

All Articles