Hi.
I’m trying to turn my opencv code into a WebcamVideo, but i can not make it works.
I’m using this code for testing :
from panda3d.core import loadPrcFileData
from panda3d.core import PNMImage
from panda3d.vision import WebcamVideo
from panda3d.vision import OpenCVTexture
from panda3d.core import Texture, CardMaker, Point2, MovieTexture, TextureStage
import sys
from time import sleep,time
loadPrcFileData("", "textures-power-2 none")
loadPrcFileData('', 'client-sleep 0.001')
from direct.showbase.ShowBase import ShowBase
ShowBase()
if len(sys.argv) > 1: TEST = sys.argv[1]
else: TEST = "WebcamVideo"
print "TRYING WITH " + TEST
if TEST == "WebcamVideo":
option = WebcamVideo.getOption( 14 )
videoTexture = MovieTexture(option)
videoTexture.setKeepRamImage(True)
print "->", videoTexture
else :
videoTexture = OpenCVTexture()
videoTexture.fromCamera()
print "->", videoTexture
cm = CardMaker("card")
cm.setUvRange(Point2(0, 0), Point2(1, 1))
cm.setFrame(-1, 1, -1, 1)
card = render.attachNewNode(cm.generate())
card.setTexture(videoTexture)
run()
opencv works perfectly and returns :
Known pipe types:
glxGraphicsPipe
(all display modules loaded.)
TRYING WITH opencv
Insufficient buffer memory on /dev/video0 – decreaseing buffers
Insufficient buffer memory on /dev/video0 – decreaseing buffers
-> 2d_texture
2-d, 640 x 480 pixels, each 3 bytes, rgb, compression off
repeat x repeat, min default, mag default, aniso 0, border 0 0 0 1
no ram image
and WebcamVideo is running but do not show any picture (black), and returns :
Known pipe types:
glxGraphicsPipe
(all display modules loaded.)
TRYING WITH WebcamVideo
:vision(error): Failed to open /dev/video0
-> 2d_texture Logitech QuickCam Pro 4000
2-d, 640 x 480 pixels, each 3 bytes, rgb
repeat x repeat, min default, mag default, aniso 0, border 0 0 0 1
no ram image
I used the option 14 for WebcamVideo because it looks opencv is opening this one, of course i’ve tried all other options.
More of this i can use my webcam with any programs using v4l2 ( xawtv, vlc, …).
I’ve also try to run this as root, just to see …
Well now, i don’t know what to do, any idea shall be interesting for me …
Thanks for your time