WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rating: Thread Rating: 2 votes, 5.00 average. Display Modes
  #1  
Old 06-05-2014, 07:25 AM
pwsnow pwsnow is offline
Member
 
Join Date: Apr 2012
Posts: 23
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 <camera>.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,

Peter
Reply With Quote
  #2  
Old 06-05-2014, 11:02 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
Are you testing with one of simple examples included with Vizard and a single marker in view? If not, try running artoolkit_simple.py or artoolkit_matrix.py and see if the results are the same. Does the model linked to the marker appear to be oriented correctly?
Reply With Quote
  #3  
Old 06-06-2014, 08:05 AM
pwsnow pwsnow is offline
Member
 
Join Date: Apr 2012
Posts: 23
Jeff,

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.

Peter
Reply With Quote
  #4  
Old 06-10-2014, 12:59 AM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
I'll check with one of our developers for further assistance.
Reply With Quote
  #5  
Old 06-10-2014, 04:07 AM
pwsnow pwsnow is offline
Member
 
Join Date: Apr 2012
Posts: 23
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.
Reply With Quote
  #6  
Old 06-16-2014, 02:39 AM
pwsnow pwsnow is offline
Member
 
Join Date: Apr 2012
Posts: 23
Jeff, has there been any updates from your developers?
Reply With Quote
  #7  
Old 06-17-2014, 10:09 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
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.
Attached Thumbnails
Click image for larger version

Name:	artoolkit_eulers.jpg
Views:	2585
Size:	364.5 KB
ID:	653  
Reply With Quote
  #8  
Old 06-17-2014, 10:41 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
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?
Reply With Quote
  #9  
Old 06-18-2014, 08:38 AM
pwsnow pwsnow is offline
Member
 
Join Date: Apr 2012
Posts: 23
Many thanks Jeff.

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

Code:
import viz
import vizshape
viz.go()

#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 = viz.link( marker1, m1Axes )
m2Axes = vizshape.addAxes(.9 )
axesLink2 = viz.link( 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)


video.getWebcamNames(available=False)
camera.setThresh(99)
camera.setGlobalScale(0.93)

camera2.setThresh(99)
camera2.setGlobalScale(0.93)


def UpdateView():

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

vizact.ontimer(0,UpdateView)
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,

Peter
Reply With Quote
  #10  
Old 06-18-2014, 10:11 AM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
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.
Reply With Quote
  #11  
Old 06-26-2014, 05:15 AM
pwsnow pwsnow is offline
Member
 
Join Date: Apr 2012
Posts: 23
Jeff,

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%

Peter
Reply With Quote
  #12  
Old 06-30-2014, 05:48 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
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:

Code:
import viz
import vizshape
viz.go()

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

viz.MainWindow.setSize(0.5,1)
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 = viz.link( marker1, m1Axes )
m2Axes = vizshape.addAxes()
axesLink2 = viz.link( 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.
Reply With Quote
Reply

Tags
artoolkit

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
the difference between transform matrix and setEuler,setPosition,setScale arscarsc Vizard 1 08-24-2010 10:17 AM
Camera distance problem CRI Vizard 0 07-28-2010 11:58 AM
Be a Marker for Camera Tracking CRI Vizard 2 05-31-2010 02:09 PM
Matrix Transform and Bumpmap GiudiceLab Vizard 0 11-27-2009 01:42 PM
transform deprecation problem cade_mccall Vizard 7 11-16-2007 03:59 PM


All times are GMT -7. The time now is 08:38 AM.


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