PDA

View Full Version : 3d multimarker setup


sircedric4
09-23-2009, 07:17 AM
I would like to setup a 3 dimensional multimarker system using the ARToolkit plugin marker system. I have an example of how to do this with a 3 dimension cube and had no problems setting up the pattern file to make it work. I used it to show a rubik's cube augmented on top of that 3d cube with no issues.

Now I would like to make up a pattern file that is not so straightforward as a cube and I would like to not have to measure the absolute positions of the markers in the real world. It occurs to me that I have a camera pointed at my 3d multimarker and I am using the standard matrix markers to make my multimarker, so there should be someway to make my multimarker pattern file just using the output from the camera. (The camera should be able to tell me the marker location and orientation)

Has anyone used WorldViz and a webcamera to detect the locations of their individual markers and then turn that information into a standard multimarker pattern file. I've been able to get the raw marker positions in relation to the camera but I can't figure out how to turn the positions from the camera into a multimarker pattern file that the WorldViz can use. Could someone please walk me through the steps necessary to do this?

Thank you

farshizzo
09-24-2009, 12:42 PM
I don't know if there is a way to automatically generate multi-marker pattern files. The patt.multi pattern file that comes with Vizard was generated manually. You can open it in any text editor and view it. Here is a page (http://www.hitl.washington.edu/artoolkit/documentation/tutorialmulti.htm) that describes the format of the ARToolkit multi-marker pattern file. Hope this helps.

sircedric4
09-29-2009, 07:32 AM
I think I am started down a good path towards making a marker file. I just don't know how to finish it up, whether I need to adjust the file back to a zero point between the markers or whether I need to preoffset the 3D model that I attach to the file. Here is the code I used in order to grab the matrixes from my 3 raw markers with my webcam.

#Add the other IMPORTS
import viz
import math
import vizinfo
import vizconfig
import random
import vizact
import vizinfo

viz.go()

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

#Create camera using first available webcam
camera = ar.addWebCamera()

#Setup origin marker
origincube = viz.add('cube_asm.wrl')
marker = camera.addMatrixMarker(0,width=100000)
#markerpos = camera.setGlobalMarker(marker)
originpos = viz.link(marker,origincube)

#Setup Marker
MarkerNumber = 4 #Change for marker you are looking for
MarkerWidth = 100000 #Change for marker you are looking for

#Calculations and Find marker
cube1 = viz.add('cube_asm.wrl')
marker1 = camera.addMatrixMarker(MarkerNumber,width=MarkerWi dth)
cube1pos = viz.link(marker1,cube1)

#Print out marker location relative to origin
def UpdateLargestMarker():
global MarkerWidth
## Trying to get multimarker data based on current origin marker

originmatrix = origincube.getMatrix(viz.ABS_GLOBAL)
matrix1 = cube1.getMatrix(viz.ABS_GLOBAL)

raw = camera.getRawMarkers()
if raw:
print 'Origin Matrix' + str(originmatrix)
print 'Cube Matrix: ' + str(matrix1)

#Update raw pattern every frame
vizact.onupdate(viz.PRIORITY_INPUT-1,UpdateLargestMarker)

I take the print outs and convert them to the format that was outlined in the tutorial you mentioned. I take the first 3 numbers from the first 3 matrix lines for the angular/orientation data, and the first 3 numbers from the last matrix line for the position data for my configuration file. An easier method to describe this is:

-----orientation--------------- pos
line1num1 line1num2 line1num3 line4num1
line2num1 line2num2 line2num3 line4num2
line3num1 line3num2 line3num3 line4num3

I do this several times for the different markers that I am looking at to finally make the configuration file. It could be better coded but I was just using it as a testbed. The matrix answers I get from the printout look like they are accurate numbers in relation to each other. Also each cube is placed right on top of the corresponding matrix like it should be.

It seems that this matrix should be able to go into the configuration file, but when I go to use the matrix marker, the image I am augmenting on top of it acts extremely flakey and doesn't track well at all. I had assumed someone else had conquered this problem, since it would make creating your own multimarker files much easier, if you can just put the markers on what you want and shoot them with the camera.

If someone sees anything obviously wrong with my mentality I will take any help offered. I imagine part of the problem is that I am still having a hard time getting my head around all this 6DOF math with all the different matrixes.

Thanks.

sircedric4
01-26-2010, 10:30 AM
I've started back on this project now, has anyone else given it any thought in the last few months? If so, how did you approach doing 3d multimarker setup automatically. I know it's somehow possible because I read a paper of a group doing exactly this for an Airbus cabin. The paper is at:
http://delivery.acm.org/10.1145/860000/854954/17810107.pdf?key1=854954&key2=0533354621&coll=GUIDE&dl=GUIDE&CFID=74970990&CFTOKEN=90147894

I'm just trying to figure out if I can do it in WorldViz with the ARtoolkit plug-in or if I have to go use that intimidating and less user-friendly C++ stuff.

sircedric4
01-26-2010, 11:55 AM
Its a shame I can't edit a previous post instead of double posting but I think I know what I want to do but need to know how to do a fairly simple transform. Does vizmat or some other function have a means to make one object the new coordinate system origin, and then when I call getPosition for the other objects they will be in relation to that new origin?

Does anyone know how to do that? I think if I can set one of my markers to be the origin of the system and then just poll my other markers positions based off that new origin then I will have most of my problem licked.

sircedric4
02-09-2010, 08:21 AM
All right, I am two weeks later than my last post and I finally have a multimarker writing program. My current problem I believe is down to camera resolution.

I am able to record the positions of each marker in relation to an origin marker, and I take several averages of these positions. I then output that matrix into the format that an ARToolKit multimarker requires and go run that newly made multimarker file in another WorldViz application to test it out. The problem is that the model locations are being recorded between 5 and 25 mm difference from where they should be. When I put them in my other application (Which is basically the artoolkit_multi example with my newly made multimarker), the cubes do not line up exactly on the markers. Looking at the pattern file, I can see how much error there is.

I think this may be camera resolution, or possibly camera calibration issues but has anyone else run into problems with the ARToolKit plugin in regards to the error in the locations recorded?

I was gonna share my code in this post so that you can help me to figure out my final little problem, but I think I want to keep minimal control over it since I've labored at it so hard. If you PM me and are willing to help me fix my issue, I'll share the code so you can critique it.