Schemaphic Systems Blog

Sharing experiences in Flash, Flex and AIR

Augmented Reality using FLARToolkit – restrict unnecessary model jumping

with 8 comments

I have used FLARToolkit for many Augmented Reality projects.
At one point I felt that while holding the marker in a particular position, makes the 3D model appear and moves continuously even though the marker is still. After much debugging, I found out that this was happening due to light-shade change. To eliminate this sensitive issue in tracking lighting environment, I tried to restrict the renderViewport based on web-camera’s activity level. A level of 16 worked ideal for me. Check it out here:

//function called on enter frame
function renderViewport(event:Event):void
{
updateCaptureBitmap();// draws the web-camera image constantly
try{
//checks for marker existence using ARDetector
if (arDetector.detectMarker()) {
//restricts model form movement due to light change
if(arCamera.activityLevel > 16){
this.arDetector.calculateTransformMatrix(resultMatrix);
baseNode.setTransformMatrix(resultMatrix);
}
}else{
//do nothing
}
}catch(error:Error) {
trace(error);
}
renderer.renderScene(scene, camera, viewport); // renders model
}

Advertisements

Written by Deepanjan Das

July 8, 2010 at 9:17 PM

8 Responses

Subscribe to comments with RSS.

  1. это, сука, гениально

    makc

    September 23, 2010 at 9:46 PM

  2. […] learning today about a very clever trick by Deepanjan Das, I decided to implement it in […]

  3. this is great, thanks for posting!

    it’s now included in FLARManager as activityThreshold:
    http://words.transmote.com/wp/20100923/flarmanager-activitythreshold/

    ericsoco

    September 24, 2010 at 8:07 AM

  4. Thanks Guys 🙂

    deepanjandas

    September 24, 2010 at 8:22 AM

  5. Thanks for this.

    WARlock

    September 26, 2010 at 4:17 AM

  6. […] (Sakri), Otsu thresholding (Andrew), automatic thresholding (some unknown guy), brilliant camera activity trick (Deepanjan). Even my complex numbers experiment found its way into this – I used it for pose […]

  7. or use this condition instead :

    ar_bmp.bitmapData.draw(video);
    if (detector.detectMarkerLite(raster, 80) && detector.getConfidence() > 0.5)
    {
    detector.getTransformMatrix(resultMat);
    baseNode.setTransformMatrix(resultMat);
    baseNode.visible = true;
    } else {
    baseNode.visible = false;
    }
    renderer.render();

    Jackal

    June 21, 2011 at 5:16 AM

    • Hello Jackal,
      You are absolutely right. What I tried to fix is: if you keep your camera on set your marker at a fixed place under the same lighting condition, you will often see the model in AR (if its an animated one on loading) will be starting again and again, though the marker is fixed.

      That is due to the camera accepting some normal movements in air I guess.
      To eliminate that I tracked the camera activityLevel as well.

      Best
      DD

      Deepanjan Das

      June 21, 2011 at 7:41 AM


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: