Official website for Web Designer - defining the internet through beautiful design
FOLLOW US ON:
Author: Mark Billen
24th November 2009

Getting started with Augmented Reality and the FlarToolKit

09 Camera_para

09 Camera_para

Getting started with Augmented Reality and the FlarToolKit

The next file you need to add is the camera_para.dat, this file adds the webcam with lens distortion and image quality, and you don’t really need to know more than that. You can find this file in the Libspark folder you got from SVN in libspark/samples/Data/camera_para.dat. Like before drag the file to the ‘src’ folder.ges.

10 Materials

Getting started with Augmented Reality and the FlarToolKit

Now you have one more file to add to the ‘src’ folder and this can be found on the cover disc in the folder for this tutorials project files. Get the material2.jpg and drag it into the ‘src’ folder. Save your progress because it’s time to code now.

11 Flar class
You will notice that Flex actually produces the framework of your class to work from, throughout the tutorial we will be including some of the included parts just so there is no confusion about how the end result should look. So to begin let’s set the properties of our movie using he SWF tag, set the width and height and make the frame rate 30 like below.

package{
import flash.display.Sprite

[SWF(width=”640”, height=”480”, framerate=”30”, backgroundColor=”#FFFFFF”)]

public class Flar extends Sprite
{

12 Embed
Inside the Flar.as class add the embed tags to include the material2.jpg, pat1.pat and camera_para.dat files. Also create a class variable for each of the embeds so we can reference them a little later in the code. Also note that you have added the mimeType to the .pat and .dat files.

[Embed(source=”material2.jpg”)]
private var Matt:Class;
[Embed(source=”pat1.pat”, mimeType=”application/octet-stream”)]
private var pattern:Class;
[Embed(source=”camera_para.dat”, mimeType=”application/octet-stream”)]
private var params:Class;

13 Flar variables
Next add a few variables, the fparams variable will control the webcam to work with Augmented Reality, it uses the camera_para.dat file a bit later. The mpattern variable will be used alongside the pattern you imported to match up the pattern on the webcam. Then you have a vid and cam variables which you should be familiar with if you have used the webcam with Flash before.

Flar toolkit:
private var fparams:FLARParam;
private var mpattern:FLARCode;

Camera:
private var vid:Video;
private var cam:Camera;

Pages: 1 2 3 4 5

  • Tell a Friend
  • Follow our Twitter to find out about all the latest web development, news, reviews, previews, interviews, features and a whole more.

    2 Comments »

    • David Vafa said:

      It’s hard to believe how lucky I am to come across the -Web Designer- webpage I followed one of your tutorials.Getting Started w Augmented Reality and it is well-written ,cool , and easy-to-follow your website is a Gem to web. I’m already started on a subscription!

    • zaid said:

      how could i download the smart Grid sample with source code ?

    What's your opinion?

    Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

    Be nice. Keep it clean. Stay on topic. No spam.

    * Required fields