WorldViz User Forum

WorldViz User Forum (
-   Vizard (
-   -   AR Marker Camera Matrix Transform Problem. (

pwsnow 06-05-2014 06:25 AM

AR Marker Camera Matrix Transform Problem.
Dear Forum,

Has anyone had any experience with the ARToolKit plug in with Vizard? I have a question I need to ask about the camera matrix transform. We are currently using the trial version to ensure we can sort this problem out before purchasing the full version.

We have a scenario in which we want to track markers on cubes on a table that can be moved. Currently we have 2 cameras, but we will be using 3 in total. The user sits at the table and the two cameras are located just in front of the user to the left (facing the userís left side) and just in front of the user above pointing down (facing the table). The setup works find and all the markers can be picked up by the cameras. However the reported eulers of the markers are incorrect.

I have experimented by breaking it down to one camera (the second one, looking down facing the table) and playing around with the camera matrix transform (as per the Vizard 4.0 Documentation on ARToolKit) using the .setMatrix(matrix) function. But with no luck. The eulers being reported are incorrect.

I understand that the marker positions are relative to the camera matrix transform. Just trying to work it out.

For example when I have the camera looking directly down at the marker I should get an euler of [0,0,0] reported from the marker. After applying a 90 degree pitch rotation vector to a matrix and applying that to the camera matrix I get [-1.48,-4.76,-47.86] which is nearly there bar the roll value.

Thanks for any help,


Jeff 06-05-2014 10:02 PM

Are you testing with one of simple examples included with Vizard and a single marker in view? If not, try running or and see if the results are the same. Does the model linked to the marker appear to be oriented correctly?

pwsnow 06-06-2014 07:05 AM


I have tested it out on a very slightly modified version of artoolkit_simple. The parts added included printing out the euler of the marker in an updateView function and adding in axes to link with the marker.

Below are the results from using the WorldViz marker and (number 31) matrix marker.

WorldViz Logo (one camera)

Matrix marker (one camera)

The axes are the correct position but as you can see from the output window the eulers are not what I would like them to be. E.g 0,0,0 in the above positions.

Also below are tests run with my even more modified example of the artoolkit_simple function which uses two cameras. The only thing added from the above tests is the addition of a second camera. Unlike the one camera examples these produce wrong orientations for the axes.

WorldViz Logo (two camera)

Matrix marker (two camera)

I should add that I haven't applied any transformation matrix to the camera in the second examples.

I guess from this it means that having two cameras is part of the problem. I understand the orientation of the axes being correct due to the positioning of the markers. Just trying to get my head around ensuring that the markers in this position display 0,0,0.


Jeff 06-09-2014 11:59 PM

I'll check with one of our developers for further assistance.

pwsnow 06-10-2014 03:07 AM

Many thanks Jeff. If there is anything I could do to help the process on my end please let me know. E.g raw data or more tests.

pwsnow 06-16-2014 01:39 AM

Jeff, has there been any updates from your developers?

Jeff 06-17-2014 09:09 PM

1 Attachment(s)
A value of [0,0,0] is difficult to achieve because the camera would be even with the marker. In the attached image you can see that there is a slight pitch and yaw/roll are close to 0. Each line of output in the image contains orientation and then position values. Based on this it appears most of your single camera data looks correct.

Jeff 06-17-2014 09:41 PM

In terms of the results using two cameras, can you post sample code that you used to get that? Are you using multiple cameras to increase the tracking range or for some other purpose?

pwsnow 06-18-2014 07:38 AM

Many thanks Jeff.

Below is the code I'm using for the two camera set up. I'm testing using different types of markers.


import viz
import vizshape

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

video = viz.add('VideoCamera.dle')

#Connect to next available generic video capture device
cam = video.addWebcam(1)
cam2 = video.addWebcam(0)

#Create camera using first available webcam
camera = ar.addCamera(cam)
camera2 = ar.addCamera(cam2)

#Create marker from pattern file
#marker = camera.addMarker('ar/patt.worldviz',width=1000)
#marker2 = camera.addMarker('ar/patt.kanji',width=1000)
#marker3 = camera2.addMarker('ar/patt.hiro',width=1000)
#marker4 = camera2.addMarker('ar/patt.sample1',width=1000)
#marker5 = camera.addMultiMarker('ar/patt.multi',width=1000)
marker1 = camera.addMatrixMarker(6,width=1000)
marker2 = camera2.addMarker('ar/patt.worldviz',width=1000)
#marker2 = camera2.addMatrixMarker(31,width=1000)
marker3 = camera.addMatrixMarker(41,width=1000)
marker4 = camera2.addMatrixMarker(54,width=1000)

m1Axes = vizshape.addAxes(.9 )
axesLink1 = marker1, m1Axes )
m2Axes = vizshape.addAxes(.9 )
axesLink2 = marker2, m2Axes )

X = viz.addText3D('X',pos=[1.1,0,0],color=viz.RED,scale=[0.3,0.3,0.3],parent=m2Axes)
Y = viz.addText3D('Y',pos=[0,1.1,0],color=viz.GREEN,scale=[0.3,0.3,0.3],align=viz.ALIGN_CENTER_BASE,parent=m2Axes)
Z = viz.addText3D('Z',pos=[0,0,1.1],color=viz.BLUE,scale=[0.3,0.3,0.3],align=viz.ALIGN_CENTER_BASE,parent=m2Axes)



def UpdateView():

        print marker1.getEuler()
        print marker2.getEuler()


I would like to use more than one camera so that I'm guaranteed to have the marker in view when the user moves the physical cube.

In your single camera example above you print two eulers out. Are they the marker and axes euler separately?

Many thanks,


Jeff 06-18-2014 09:11 AM

The second set of values on each line is the marker position. If the marker width is not specified accurately when adding the marker, the position values will be scaled.

pwsnow 06-26-2014 04:15 AM


Any updates on the situation with the two camera problem?

I could try the two cameras again once I have the one camera working 100%


Jeff 06-30-2014 04:48 PM

Each camera will display the model correctly according to it's own point of view. Viewing the models in 2 windows, each with a different camera view will look correct:


import viz
import vizshape

ar = viz.add('artoolkit.dle')

subWindow = viz.addWindow(size=[0.5,1],pos=[0.5,1])

camera = ar.addWebCamera()
camera2 = ar.addWebCamera(window=subWindow)

marker1 = camera.addMarker('ar/patt.hiro',width=1000)
marker2 = camera2.addMarker('ar/patt.hiro',width=1000)

m1Axes = vizshape.addAxes()
axesLink1 = marker1, m1Axes )
m2Axes = vizshape.addAxes()
axesLink2 = marker2, m2Axes )

To increase the tracking space and use a single display with the data from multiple cameras it's necessary to calculate the relative pose between cameras and define a single coordinate system using that information.

All times are GMT -7. The time now is 01:03 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2021, vBulletin Solutions, Inc.
Copyright 2002-2018 WorldViz LLC