webcam to texture sample?

Hello all,

Does anyone have a working sample of streaming video from a webcam onto a 3d surface – e.g., a full-screen quad? Python code is preferred at this point, though I will certainly take what I can get.

I’m a complete panda n00b, though I’ve been making real-time video effects for a while. I’m working on an ARToolkit-style, er, toolkit, since I used to do such things for a living in a previous incarnation as a computer vision programmer, and since I would prefer to stay away from GPL code for the project I’m currently working on.

But I need a nice 3d engine, and panda seems to fit the bill. The last piece of the puzzle is making panda and live video work together. It appears that someone has gotten this working, though I haven’t been able to figure it out yet.

Any help is greatly appreciated!



P.S. Here’s the kind of stuff I do now:

I don’t know much about live feed application development or how it works, but it sounds like you just need to write a wrapper that places input from the cam into a buffer, then you just need to use render-to-texture to place that onto an object. The problem is getting Panda to accept the cam input…and that I’m not much help with as I can’t even get a joystick to work right. This sounds like a fairly high level project, but from my understanding of Panda’s ability so far, once you can correctly accept feed from your input device the rest should all be downhill.
Sorry that I’m not much help on this one.

Thanks for the reply, silver. The approach I was hoping would work would be to assign image data to a texture via python by providing a pointer to the image data.

So for instance, if I had a python-wrapped instance of an IplImage (OpenCV’s image type, which I use a lot), I’d like to be able to do something like

tex = Texture()
tex.setFormat(fRgba32) # I forget the name of this call

or some such. I have no idea if this is the Panda way, since I’ve only been looking at the code for a couple hours. But that’s the basic approach I’m hoping is possible.

I’d actually prefer not to use the WebcamVideo object, since I’m not sure if it would give me the access to the image in the way that I need to do image analysis, find the fiducial, etc.


What you have for the texture code should cover most of what you want then…if you just want to do work with a specific preprocessed image. I have no idea of how/what analysis you want to do with the image nor would I be of any help there. You should definitely look at this manual page if you are looking to do any advanced image analysis-

Have you seen this thread?