![]() |
|
|
|
#1
|
|||
|
|||
|
Some that know why i can pass the image from the camera to a plane in vizard?
|
|
#2
|
|||
|
|||
|
I resolve the problem, now i have opencv and vizard working together, just i have to use the viztask.schedule() command on the method that i use for opencv
|
|
#3
|
|||
|
|||
|
Hi Darkmax,
Thats fantastic news, I'm still struggling to get openov to play nicely with Vizard, am even thinking of trying with pyopencv when I get a chance (writing writing writing at the moment ).However, would it be possible for you to give me some advise as to how you have managed to get them working with each other, just a few pointers to get me started - I can use opencv with the highgui window, but am getting stuck trying to pass the video frames to the vizard render window .Any advise would be really welcome, best regards |
|
#4
|
|||
|
|||
|
try this code:
Code:
import Image
import cv
import viz
import viztask
#Quad to display the image on vizard
tex = viz.addBlankTexture([1,1])
quad = viz.addTexQuad(pos=(0,1.8,2),texture = tex)
def PIL_TO_VIZARD(image,texture):
"""Copy the PIL image to the Vizard texture"""
im = image.transpose(Image.FLIP_TOP_BOTTOM)
texture.setImageData(im.convert('RGB').tostring(),im.size)
def opencvMain():
capture = cv.CaptureFromCAM(-1)#conect to a camera
while True:
src = cv.QueryFrame(capture) #Image from camera in BGR format
dst = cv.CreateImage(cv.GetSize(src),cv.IPL_DEPTH_8U,3)
cv.CvtColor( src, dst, cv.CV_BGR2RGB) #Converting BGR to RGB
#Converting opencv image to PIL image
pil = Image.fromstring("RGB", cv.GetSize(dst), dst.tostring())
#Aply image to texture
PIL_TO_VIZARD(pil,tex)
cv.WaitKey(10)
yield viztask.waitTime(0)
viztask.schedule(opencvMain())
viz.go()
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Realistic Light and Shadows Using Vizard and 3DS Max | jde | Vizard | 4 | 07-13-2012 11:58 AM |
| Vizard 4 Beta Testing | farshizzo | Announcements | 0 | 02-01-2011 11:46 AM |
| Vizard 4 Beta Testing | farshizzo | Vizard | 0 | 02-01-2011 11:46 AM |
| .3DS importing in Vizard and 3D Studio | jde | Vizard | 1 | 08-28-2009 04:14 PM |
| Vizard tech tip: Using the Python Imaging Library (PIL) | Jeff | Vizard | 0 | 03-23-2009 12:13 PM |