PDA

View Full Version : Image Manipulations using OpenGL



manojmka
9th April 2008, 06:35
Hi folks,

I need some image manipulation in my qt application. Some of the features required are: Translate, Rotate, Scale, Blur, Sharpen, Contrast, Red Eye Removal, Add Noise, Charcoal, Shadow, Sketch, Enhance, Edge, Gamma, Implode, Negate, Flip, Flop, OilPaint etc to Image.

I tried with Image Magick but it seems to be very expensive in terms of converting an image to Pixmap and vice versa. It is too heavy and also not very easy to deploy.

I am now also looking towards OpenGL. Is it possible to manipulate image using OpenGL and where do I find the proper api reference for that?

Quick help is required.

Regards,
Manoj

wysota
9th April 2008, 09:39
Pure OpenGL won't help you here. You'd have to implement fragment programs for each operation and run them on your GPU.

manojmka
9th April 2008, 11:15
Thanks wysota. I am not much famaliar with using GPU and reading about it. All I could understood till now is that GPU is a special type of processor using a portion of memory to process graphics operations. I don't know how to use it with some graphics library. Please be kind enough to give me some useful pointers about the same.

wysota
9th April 2008, 13:52
I don't know how to use it with some graphics library.
You can't. You have to implement your own routines in a special language understood by the GPU.

firas
9th May 2008, 21:49
ahoy,
I think there might be a way, briefly:
1. Sub-class or inherit your painting Widget from QGLWidget
2. Override the inherited member function QGLWidget::paintGL(), where u would typically do either pixmap rendering (glDrawPixels) or texture mapping
3. Also in QGLWidget::paintGL() or ::resizeGL(), do GPU based pixel manipulation using various ARB_imaging functions such as glConvolutionFilter1D, glConvolutionFilter2D, glPixelTransferf... Doign so, will greatly improving your processing performance up to 20 folds (given you have a new fast GPU !). Practically you can do most of image processing algorithms using the ARB_imaging calls with lightning fast processing.
4. Create a custom function that reads the GPU processed color bit buffer from the GPU memory to a buffer residing in system memory using glReadPixels.

For more info there is google and many good people willing to spread the disease :)
hope it is somewhat en-lighting
cheers