Augmented Reality Tutorial coding
This Augmented Reality Coding will be created by Flash as known as FLARToolKit. This application will be viewed by using webcam from laptop or PC. There are two different of codings and I had followed one of the codings to create a mock-up prototype for my project.Â
First I need to create flash project file to include all of the documentations into one folder. Then, I need to create External library so that the data will be imported through library.Â
Below is the example of the marker detection coding that needs to be included so that the AR game will work. It has been provided along with the article.
private function prepareMarkerDetection() : void {
// The parameters file corrects imperfections // In the webcam's image. The pattern file // defines the marker graphic for detection // by the FLAR tools.
flarParam = new FLARParam(); flarParam.loadARParam(new Params() as ByteArray); flarCode = new FLARCode(FLAR_CODE_SIZE, FLAR_CODE_SIZE); flarCode.loadARPatt(new Pattern()); // A BitmapData is Flash's version of a JPG image in memory. // FLAR studies this image every frame with its // marker-detection code.
bitmapData = new BitmapData(VIDEO_WIDTH, VIDEO_HEIGHT); bitmapData.draw(video);
flarRgbRaster_BitmapData = new FLARRgbRaster_BitmapData(bitmapData); flarSingleMarkerDetector = new FLARSingleMarkerDetector(flarParam, flarCode, MARKER_WIDTH);
}
Second article is the tutorial in how to detect different marker at the same time. It is about beginner's guide to produce Augmented Reality application. It is also using the same software from the above tutorial.
Below is the example of the coding to see the changes inside the AR application interaction.
if (id==0){ var cube : Cube = new Cube( new MaterialsList( {all: fmat} ) , 40 , 40 , 40 ); cube.z = 60; dispObj.addChild( cube ); } else if(id==1){ var cube2 : Cube = new Cube( new MaterialsList( {all: fmat} ) , 40 , 40 , 40 ); cube2.z = 0; dispObj.addChild( cube2 ); } else if (id==2) { var cube3 : Cube = new Cube( new MaterialsList( {all: fmat} ) , 40 , 40 , 40 ); cube3.z = 20; dispObj.addChild( cube3 ); } else if (id==3){ var cube4 : Cube = new Cube( new MaterialsList( {all: fmat} ) , 40 , 40 , 40 ); cube4.z = 40; dispObj.addChild( cube4 ); }
Both of these tutorials are very useful for me to develop AR Game application. It will help me to view the possibility of creating the game.
Reid, J. (2010) Beginner’s Guide to Augmented Reality. Available at: http://code.tutsplus.com/tutorials/beginners-guide-to-augmented-reality--active-4948. [Accessed 24 April 2014]
Rivello,  S.A. (2009) Augmented reality using a webcam and Flash. Available at: http://www.adobe.com/devnet/flash/articles/augmented_reality.html.[Accessed 24 April 2014]

















