WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #3  
Old 09-29-2009, 07:32 AM
sircedric4 sircedric4 is offline
Member
 
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.

Code:
#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=MarkerWidth)
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.
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 07:31 AM.


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