WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Thread Tools Rate Thread Display Modes
Old 09-23-2009, 07:17 AM
sircedric4 sircedric4 is offline
Join Date: Aug 2009
Posts: 22
3d multimarker setup

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
Reply With Quote
Old 09-24-2009, 12:42 PM
farshizzo farshizzo is offline
WorldViz Team Member
Join Date: Mar 2003
Posts: 2,849
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 that describes the format of the ARToolkit multi-marker pattern file. Hope this helps.
Reply With Quote
Old 09-29-2009, 07:32 AM
sircedric4 sircedric4 is offline
Join Date: Aug 2009
Posts: 22
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


#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 =,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=MarkerWidth)
cube1pos =,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
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.

Reply With Quote
Old 01-26-2010, 10:30 AM
sircedric4 sircedric4 is offline
Join Date: Aug 2009
Posts: 22
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:

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.
Reply With Quote
Old 01-26-2010, 11:55 AM
sircedric4 sircedric4 is offline
Join Date: Aug 2009
Posts: 22
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.
Reply With Quote
Old 02-09-2010, 08:21 AM
sircedric4 sircedric4 is offline
Join Date: Aug 2009
Posts: 22
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.
Reply With Quote

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
right-hand to left-hand coordinate System for a cave setup Andy Vizard 1 09-16-2009 10:17 AM
tkinter setup for 3.0 jrodman Vizard 2 11-16-2006 02:50 PM
PPT 1.1 common setup problems mspusch Precision Position Tracker (PPT) 0 07-03-2003 01:15 AM

All times are GMT -7. The time now is 06:33 AM.

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