Webcamera-source as texture

Hi!

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!

Best regards,
Roquqkie

DsVideoLib might help you.
http://www.ims.tuwien.ac.at/~thomas/dsvideolib.php

If not… you have to do following:
0. Dowload and install DXSDK.

  1. Learn DirectShow (not all, just couple necessarty things)
  2. 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…
  3. 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)
  4. Call Render method of Filter Graph object with parameter out-pin of you web cam source
  5. Query couple interfaces (MediaControl, IMediaEvent) to access to playback control API.
  6. 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.

yooyo

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.