View Single Post
Old 05-22-2012, 11:38 AM
goro goro is offline
Join Date: May 2012
Posts: 33
Red face Solved the Flip Image Issue

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:

import viz
import vizact
import Image

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 )
#Create a blank Vizard texture
tex = viz.addBlankTexture([1,1])

cam = viz.addVideo('mona.mpg')

width,height,type = cam.getSize()

#---------------------------- Texture Comparison -----------------------------#
quad1 = viz.addTexQuad()
quad1.setPosition([-.75, 2, 3])


quad2 = viz.addTexQuad()
quad2.setPosition([.75, 2, 3])


Reply With Quote