FLARCodeImage:Utility for FLARToolKit

example that using FLARCodeImage

I made a utility class for FLARToolKit.
FLARCodeImage is a child of Sprite.

This class makes FLARCode an image. And, you can use it as a substitute of the marker.

How to use

  1. Create a instannce of FLARCode and load .pat file.
    1
    2
    3
    4
    5
    6
    
    [Embed(source = "assets/patt.hiro", mimeType = "application/octet-stream")]private var CodeData:Class;
    //...
     
    var code:FLARCode = new FLARCode(16, 16);
    var codeFile:ByteArray = new CodeData() as ByteArray;
    code.loadARPatt(codeFile.readMultiByte(codeFile.length, "shift-jis"));
  2. Create a instance of FLARCodeImage.
    1
    
    var codeImg:FLARCodeImage = new FLARCodeImage(code, 300, 300);
  3. Create a instance of MovieMaterial(Papervision3D’s material classs), and create a instance of Plane using it as material.
    1
    2
    3
    4
    
    var mat:TriangleMaterial = new MovieMaterial(codeImg);
    mat.doubleSided = true;
    var plane:Plane = new Plane(mat, 300, 300, 4, 4);
    this._modelView = new PV3DPanel(this.stage.stageWidth, this.stage.stageHeight, plane);
  4. Use its image as a input for FLARToolKit instead of WebCamera.
Ads

Ad

Ad

Share

  • Add this article to hatena bookmark
  • 0

Follow

Ads

Ad

Comments

  1. oruchreis says:

    Hi,
    I’m trying to calculate 3D position of a mouse click position by detected marker’s plane. Is there any easy way to find 3D postion on the marker’s plane? I’ve tried to intersect 2D position with marker’s plane. I can get the ray vector fo the mouse click position by flarCamera3D’s unproject method. I also can get the marker’s 3D position. But I need to find the normal vector of the marker’s plane. So I can build a plane3D with setNormalAndPoint method. Then I can intersect the ray with this plane and the result will be the 3D position of the 2D mouse position. My codes are here:
    var ray:Number3D = flarCamera3D.unproject(mouse.x,mouse.y);
    var p:Plane3D = new Plane3D();
    var normal: Number3D = I DONT KNOW HOW TO FIND??
    p.setNormalAndPoint(normal, markerPosition);
    var intersect:Number3D = p.getIntersectionLineNumbers(flarCamera3D.position, ray);

    I will appreciated if you can help, I didn’t any solutions for days.

  2. tarotarorg says:

    Hi, oruchreis.

    Sorry. I could not find a solution for you.

    Thank you.

Leave a Comment

Your email address will not be published. Required fields are marked *