![]() |
|
#3
|
|||
|
|||
Ok, i'm experiment with opencv and this what i got:
1) I installed OpenCV-2.2.0-win32-vs2010.exe from the opecv site and i choose to install the system variables for all users. 2) I installed numpy-1.5.1-win32-superpack-python2.7.exe (because it seems that opecv need it) 3) I copy the files of C:\OpenCV2.2\Python2.7\Lib\site-packages to C:\Program Files (x86)\WorldViz\Vizard4\bin\lib\site-packages 4) i tried this code in vizard and it WORKS!!!: Code:
import cv cv.NamedWindow("camera", 1) capture = cv.CaptureFromCAM(0) while True: img = cv.QueryFrame(capture) cv.ShowImage("camera", img) if cv.WaitKey(10) == 27: break cv.DestroyWindow("camera") Code:
import Image import cv import viz viz.go() 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) capture = cv.CaptureFromCAM(-1)#conectate a camara tex = viz.addBlankTexture([1,1]) quad = viz.addTexQuad(pos=(0,1.8,2),texture = tex) while True: src = cv.QueryFrame(capture) dst = cv.CreateImage(cv.GetSize(src),cv.IPL_DEPTH_8U,1) cv.CvtColor( src, dst, cv.CV_RGB2GRAY) #Convierto opencv to PIL image pil = Image.fromstring("L", cv.GetSize(dst), dst.tostring()) #Aply image to texture PIL_TO_VIZARD(pil,tex) if cv.WaitKey(10) == 27: break If anyone has a clue of what maybe is happening |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Realistic Light and Shadows Using Vizard and 3DS Max | jde | Vizard | 4 | 07-13-2012 10:58 AM |
Vizard 4 Beta Testing | farshizzo | Announcements | 0 | 02-01-2011 10:46 AM |
Vizard 4 Beta Testing | farshizzo | Vizard | 0 | 02-01-2011 10:46 AM |
.3DS importing in Vizard and 3D Studio | jde | Vizard | 1 | 08-28-2009 03:14 PM |
Vizard tech tip: Using the Python Imaging Library (PIL) | Jeff | Vizard | 0 | 03-23-2009 11:13 AM |