I have a camera with a live video that I want to display as background in my OpenGL application. The image format is either on array-form, or on National Instrument’s IMAQ Image format.
How can I draw the frames from the camera in the most effective way? I want as many frames per second as possible.
(I also want to be able to draw OpenGL graphics on top of the video image).
I appreciate any suggestions and/or sourcecode/examples
Hmmm… That sounds interesting. As you can guess there is plenty of ways to do that (as always ). I suppose that using pixel-transfer commands (like glDrawPixels) won’t be sufficent for a live, real-time camera recording (unless you want to have a film in a size 100x100 pixles).
Meaby there are some “trickier” solutions but using some texture mapping could be usefull in this case. It would be much easier to add some effects to the background (some filters, blur, disortion, color blending etc…). Also you woludn’t have to bother about depth testing since you can always draw your background as a texured quad behind all the objects. The question is whether creating textures reapeatedly will be too much for a GPU or not.
If you are going to be going 3D object in the fore ground then you will need to do the video on as a texture on a quad in the background. I think copy pixels would slow down the operation too, vs. rendering the video to a texture which would be handle more in hardware. also would allow some nice video effects if done as a texture.
We run in to this problem frequently with our embedded graphics clients. There is, unfortunately, no really fast application-level solution. We wound up adding a custom API to OpenGL for this, similar to the DirectX mechanism.
I guess I will give textures a try, then, and follow Nehe’s tutorial 29.
This next question must be “swearing” in an OpenGL forum, but: would it be easier to code the same thing in Direct3D? Is Direct3D more high-level, or is it just about the same (in this specific example)?
I can’t tell you if DirectX is better choice for this particular application because I just don’t know it.
I believe that checking out OpenML can be usefull.