View Single Post
  #5  
Old 08-18-2008, 05:11 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
You can use the ARCamera.setGlobalMarker() command to use a marker as a global reference frame. For example, if you have a marker that is 300mm wide and hanging on the wall 1 meter away and 0.5 meters above the table, then you would use the following code:
Code:
import viz
viz.go()

#Add ARToolkit extension
ar = viz.add('artoolkit.dle')

#Create camera from texture
camera = ar.addWebCamera()

#Create marker from pattern file
marker = camera.addMarker('ar/patt.worldviz',width=300)

#Generate matrix of marker in global reference frame
m = viz.Matrix()
m.setPosition(0,0.5,1)
m.setEuler(0,-90,0)

#Use marker as global reference frame for camera
camera.setGlobalMarker(marker,m)

#Add object that should appear on table
viz.add('logo.ive')
If you are not using a camera parameter file that has been calibrated for your camera then the offset positions won't exactly match the physical positions. So you might need to tweak them for the object to appear at the correct location.
Reply With Quote