#1
|
|||
|
|||
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 |
#2
|
|||
|
|||
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?
|
#3
|
|||
|
|||
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 |
#4
|
|||
|
|||
I'll check with one of our developers for further assistance.
|
#5
|
|||
|
|||
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.
|
#6
|
|||
|
|||
Jeff, has there been any updates from your developers?
|
#7
|
|||
|
|||
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.
|
#8
|
|||
|
|||
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?
|
#9
|
|||
|
|||
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) In your single camera example above you print two eulers out. Are they the marker and axes euler separately? Many thanks, Peter |
#10
|
|||
|
|||
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.
|
#11
|
|||
|
|||
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 |
#12
|
|||
|
|||
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 ) |
Tags |
artoolkit |
Thread Tools | |
Display Modes | Rate This Thread |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
the difference between transform matrix and setEuler,setPosition,setScale | arscarsc | Vizard | 1 | 08-24-2010 09:17 AM |
Camera distance problem | CRI | Vizard | 0 | 07-28-2010 10:58 AM |
Be a Marker for Camera Tracking | CRI | Vizard | 2 | 05-31-2010 01:09 PM |
Matrix Transform and Bumpmap | GiudiceLab | Vizard | 0 | 11-27-2009 12:42 PM |
transform deprecation problem | cade_mccall | Vizard | 7 | 11-16-2007 02:59 PM |