Thanks farshizzo for the reply. I actually need the Image data to be flipped. I am working on Augmented Reality Project & I want to create a Mirror. If I flipped the quad containing the Image then the marker wont get flipped, so the co-ordination between image & logo gets lost and mismatch happens. To overcome this issue I need help. I have solved the colour issue in flipping video image by modifying the code as shown below & got the output as shown in below image:
Code:
import viz
import vizact
import Image
viz.go()
def PIL_TO_VIZARD(texture):
image = Image.fromstring('RGB',[width,height],cam.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])
cam = viz.addVideo('mona.mpg')
cam.play()
cam.loop()
width,height,type = cam.getSize()
#---------------------------- Texture Comparison -----------------------------#
quad1 = viz.addTexQuad()
quad1.setPosition([-.75, 2, 3])
quad1.texture(cam)
quad2 = viz.addTexQuad()
quad2.setPosition([.75, 2, 3])
quad2.texture(tex)
#-----------------------------------------------------------------------------#
vizact.ontimer(0,PIL_TO_VIZARD,tex)