OpenCVTexture getVideoWidth() return 0

Hi all,
I’m trying tu use my webcam under ubuntu acording to this topcic :
discourse.panda3d.org/viewtopic … ebcamvideo
So i used

videoTexture = OpenCVTexture()

But videoTexture.getVideoWidth() returns 0 .

OpenCVTexture() returns 2d_texture
2-d, 0 x 1 pixels, each 3 bytes, rgb, compression off
repeat x repeat, min default, mag default, aniso 1, border 0 0 0 1
no ram image
,
and videoTexture.fromCamera() returns 1

Do someone understand this ?
Do you know if there a way to select the device ?

Regards

Correct, getVideoWidth() returns 0 initially.

You first have to either specify a file to load or tell it to use a camera. Like:

videoTexture = OpenCVTexture()
videoTexture.fromCamera(0)
print videoTexture.getVideoWidth()
# That printed 640 for me

Replace the 0 in fromCamera with a different number if you have multiple cameras.

Sorry, my post was not so clear.
I shall have said that the code was:

from pandac.PandaModules import *

videoTexture = OpenCVTexture()

print "videoTexture.fromCamera()  returns", videoTexture.fromCamera()
print "videoTexture.getVideoWidth() returns", videoTexture.getVideoWidth()

Here is the output:

videoTexture.fromCamera() returns 1
videoTexture.getVideoWidth() returns 0

When the script is starting, i saw the cam’s led is on,
I can see the video with xawtv and gqcam, so i think it’s corectly driven .

Any idea ?

Hmm, it works for me.
What happens if you explicitly choose a certain camera in the fromCamera call? E.g. try fromCamera(0) and fromCamera(1), etc.

videoTexture.fromCamera(0) gives me the result described before.

All other values, except negative one (i’ve tried from -1 to 10), gives me HIGHGUI ERROR: V4L: index 1 is not correct! and return 0 , so i think it’s opening the good device.