I working on ARToolKit & Successfully flipped the Webcam Image. But now the issue is Marker is not getting detected in flipped texture.
Here is the code:
Code:
import viz
import vizact
import Image
viz.go()
#------------------------ Flip Horizontal ------------------------------#
def FlipHorizontal(cam_tex,texture):
image = Image.fromstring('RGB',[width,height],cam_tex.getImageData())
"""Copy the PIL image to the Vizard texture"""
im = image.transpose(Image.FLIP_LEFT_RIGHT)
RGB2BGR = (
0.0, 0.0, 1.0, 0.0,
0.0, 1.0, 0.0, 0.0,
1.0, 0.0, 0.0, 0.0 )
texture.setImageData(im.convert('RGB',RGB2BGR).tostring(),im.size)
#Create a blank Vizard texture
tex = viz.addBlankTexture([1,1],format=viz.TEX_BGR)
#Load Video Camera
video = viz.add('VideoCamera.dle')
# Load Web Camera & set cam as Video Texture
cam = video.addWebcam()
#Load ARToolKit
ar = viz.add('ARToolKit.dle')
width,height,type = cam.getSize()
# Flip Video Texture Horizontally
vizact.ontimer(0,FlipHorizontal,cam,tex)
# Set ARToolKit Camera with cam as texture
camera = ar.addCamera(tex) #---- This Dosn't work
#camera = ar.addCamera(cam) #---- This works
camera.setDebug(True)
# Add AR Marker
marker = camera.addMarker('ar/patt.hiro',width = 1000.00) #patt.hiro or patt.hiro_fh
#Add logo model
logo = viz.add('logo.ive')
#Link logo model to marker sensor
link = viz.link(marker,logo)