WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rating: Thread Rating: 4 votes, 5.00 average. Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 05-22-2012, 01:28 AM
goro goro is offline
Member
 
Join Date: May 2012
Posts: 33
I have found the optimised way to flip the Image, Video and Web cam Input. Flipping is now not an issue but the issue is while flipping video & web cam images the colour changes.

This Image will illustrate what happens when I flip video:


Code for the above mentioned flipping video 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)
	texture.setImageData(im.convert('RGB').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)
Thanks!
Reply With Quote
 

Tags
artoolkit, camera, flip, flip horizontally, webcam


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
User keyboard input without halting the program Zhi Vizard 2 06-23-2011 12:53 PM
Controlling User Input ohad Vizard 1 03-15-2010 05:16 PM
How to input several model files and then save one output file mspusch Vizard 1 07-15-2008 10:30 PM
problems with webcam plug-in v-clizzin Plug-in development 2 01-25-2008 03:06 PM
problem with input boxes shai Vizard 6 08-15-2005 10:51 AM


All times are GMT -7. The time now is 09:59 AM.


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