Schemaphic Systems Blog

Sharing experiences in Flash, Flex and AIR

Archive for the ‘Augmented Reality’ Category

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
}

Written by Deepanjan Das

July 8, 2010 at 9:17 PM

Playing WebCamera in Adobe Director

leave a comment »

Download the webcam Xtra from here and place it in Xtra folder.

Then place the following piece of code in script window:

————————————-

global webcamxtra

property w

property h

on beginsprite

w = 320

h = 240

webcamxtra = new xtra(“webcamxtra”)

webcamxtra.start(w, h)

end

on exitframe

–process one frame

webcamxtra.update()

–draw the images to the stage

img = webcamxtra.cameraImage() (the stage).image.copypixels(img, rect(0, 0, w*2, h*2), rect(0, 0, w, h))

end

———————–

Written by Deepanjan Das

June 5, 2010 at 10:16 PM