I’m working on an image-analysis algorithm and I would love to use my webcamera as a continues source for a texture, using opengl.
If anyone know how to accomplish this, please help me… I’ve had no luck finding an answer yet!
DsVideoLib might help you.
If not… you have to do following:
0. Dowload and install DXSDK.
- Learn DirectShow (not all, just couple necessarty things)
- Make your own renderer DS object (example is Texture3D in DX-SDK). Make sure that your renderer object copy data to some intermal memory buffer. Add syncing objects to synchronize acces to this shared memory. This sync objects will be needed later… you’ll see…
- Construct Capture Filter Graph, add you webcam as source, add your renderer DS object. Adding web cam source means inerating trought DS Viceo Capture devices and finding camera by name. Adding your render is trivial (just call AddFilter on filter graph object)
- Call Render method of Filter Graph object with parameter out-pin of you web cam source
- Query couple interfaces (MediaControl, IMediaEvent) to access to playback control API.
- Write you main app that create GL context and check in every frame is there something new in DS renderer shared memory buffer and if it is, upload as texture.
Note that each filter from filter graph run in it’s own thread. Your renderer filter will also run in own thread. Keep in mind that accessing to OpenGL context from different threads will not work.
This several steps might look complex, but in bit it is quite straight forward. When you understand DirectShow concept it will be easy for you to use it in you application.
This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.