Image Processing video with OpenGL

Multipart question:

1)Frames captured from my video camera are in RGB565 format. Is there some way to translate this to RGB888 using OpenGL so that it is done in hardware on my graphics card rather than the CPU.

2)I want to perform edge detection on this image. This involves calculating the dot product of a 3x3 matrix surrounding each pixel with a fixed matrix of coefficients, and setting the value of a pixel in the resultant image depending on the dot product. Is there some way this can be done by the graphics hardware using OpenGL?

At the moment all my image processing is done in C++ code using the CPU and I am hoping to be able to transfer some of it to the graphics hardware.

[This message has been edited by mjc (edited 08-09-2001).]

Multipart answer:

Originally posted by mjc:
[b]

1)Frames captured from my video camera are in RGB565 format. Is there some way to translate this to RGB888 using OpenGL so that it is done in hardware on my graphics card rather than the CPU.

[/b]

Theoretically yes. You could load up the images into the frame buffer using glDrawPixels() and pull the images back out with glReadPixels. It probably isn’t worth the effort though. The advantages of using the hardware would be undermined by the time it takes to get the data back from the frame buffer.

Originally posted by mjc:
[b]
2)I want to perform edge detection on this image. This involves calculating the dot product of a 3x3 matrix surrounding each pixel with a fixed matrix of coefficients, and setting the value of a pixel in the resultant image depending on the dot product. Is there some way this can be done by the graphics hardware using OpenGL?
[b]

Not easily. There are various functions for manipulation of pixels to and from the frame buffer, but I doubt they’d do the job…

To be honest, I’d keep your base C++ code and switch to using directdraw to display the images. The display rate would be a lot faster than using openGL.

Thanks, but unfortunately I’m stuck to using Linux… C’est la vie, still I am getting a ~15fps rate, which is OK, but means I am using 100% 1GHz CPU and a 64MB GeForce3 card to analyse stereo images. Thanks again!

In that case i would suggest assembly optimation… and maybe you can make use of mmx instructions? There is a library for conversions… and its very optimized and it supports many platforms.
http://www.clanlib.org/hermes/