View Single Post
  #9  
Old 06-18-2014, 07: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