instantreality 1.0

Vision Marker Tracking

Keywords:
vision, tracking, marker, augmented reality
Author(s): Mario Becker, Michael Zoellner
Date: 2007-06-13

Summary: This tutorial shows you how to use instant reality's vision module for marker tracking.

Introduction

instantvision is a set of visual tracking systems starting with simple marker tracking going to markerless tracking like line trackers and KLT. The true power of the system lies in the ability to combine of several such tracking procedures, for instance using a line tracker for initialisation with an absolute pose and KLT for frame to frame tracking.

In this example we will focuson a simple marker tracking example using the VisionLib backend.

IOSensor

The marker tracking is loaded like any other Instant IO device via an IOSensor. These are instantvision's fields:

  • VideoSourceImage (SFImage): Camera image
  • TrackedObjectCamera_ModelView (SFMatrix): Camera's modelview matrix
  • TrackedObjectCamera_Projection (SFMatrix): Camera' projection matrix
  • TrackedObjectCamera_Position (SFVec3f): Camera's position
  • TrackedObjectCamera_Orientation (SFRotation): Camera's orientation

Code: IOSensor

<IOSensor DEF='VisionLib' type='VisionLib' configFile='visionlib.pm'>
    <field accessType='outputOnly' name='VideoSourceImage' type='SFImage'/>
    <field accessType='outputOnly' name='TrackedObjectCamera_ModelView' type='SFMatrix4f'/>
    <field accessType='outputOnly' name='TrackedObjectCamera_Projection' type='SFMatrix4f'/>
    <field accessType='outputOnly' name='TrackedObjectCamera_Position' type='SFVec3f'/>
    <field accessType='outputOnly' name='TrackedObjectCamera_Orientation' type='SFRotation'/>
</IOSensor>
        

In order to use the camera's right modelview and projection in the scene we are using a Viewfrustrum instead of a standard Viewpoint. By routing the IOSensor's TrackedObjectCamera_ModelView and TrackedObjectCamera_Projection to the ViewFrustrum's modelview and projection the virtual camera matches the real camera's position and orientation realtive to the marker.

Code: Mapping the Camera's values on a Viewfrustrum

<Viewfrustum DEF='vf' />

<ROUTE fromNode='VisionLib' fromField='TrackedObjectCamera_ModelView' toNode='vf' toField='modelview'/>
<ROUTE fromNode='VisionLib' fromField='TrackedObjectCamera_Projection' toNode='vf' toField='projection'/>
        

With the camera's image in background we are creating an Augmented Reality scenario.

Code: Camera Image on Polygon BackGround

<PolygonBackground>
    <Appearance positions='0 0, 1 0, 1 1, 0 1' >
      	<TextureTransform rotation='0' scale='1 -1'/>
       	<PixelTexture2D DEF='tex' autoScale='false'/>
    </Appearance>
</PolygonBackground>
    
<ROUTE fromNode='VisionLib' fromField='VideoSourceImage' toNode='tex' toField='image'/>
        

This example works with standard webcams with vga resolution. An example how to manipulate instantvision's configuration file and to create and use different markers will follow.

Image: visionlib.jpg
Files:

Comments

This tutorial has no comments.


Add a new comment

Due to excessive spamming we have disabled the comment functionality for tutorials. Please use our forum to post any questions.