Using OpenCL for Image Processing

Discussion created by rafidka on Apr 30, 2011
Latest reply on May 6, 2011 by rafidka
I want to use OpenCL to implement certain image processing functionalities like getting element boundaries, etc.

I have never used OpenCL before, so forgive me if my question looks funny :-) I am limited with time so I want to see if OpenCL is going to help me before digging into it.

I am making a camera controller using optimisation and simple image processing. I allow the user of my controller to express a set of screen properties. For example, the user might see: I want this object to occupy 20% of screen width. What I do is to randomly distribute 36 camera configurations in the space, then move those configurations in space like particles  (the optimisation method is actually called Particle Swarm Optimisation) and with each movement I render the scene from all configurations and process the resulting images to evaluate the satisfaction of the certain configuration. If it satisfies the user requirement, I return it.

To evaluate the satisfaction, I do simple image processing techniques. For example, if the user wants the element to occupy 20% of screen width, I find the horizontal coordinates of the minimum and maximum pixels occupied by the object, then subtract them to find the width.

Obviously, in addition to transferring the rendered image back to the CPU for processing, this process is heavy on the CPU itself and make it impossible to run the camera solver in real-time. My question is, is it possible to run those processes on the GPU using OpenCL to make it faster? Not necessarily real-time, but as faster as possible. Currently, it is normal to take around 8 seconds until a good solution is found, so if I can reduce that to 1 second, it would be great.