Help with Image processing in OpenCL

Help with Image processing in OpenCL

I am pretty much new to OpenCL.
I wantto read a jpeg image file into the kernel, do some processing, get the results back to the host and output the image file into some other location. I am facing somedifficulties doing this.

When using the clCreateImage2D,I need to specify the size of the image manually. Is there a way that I can get the size of the image from some routines and pass them tothis function.?

AlsoI need to understandwhatthe "host ptr" arguement(last but second arguement) exactly meansthat theclCreateImage2D routinetakes. Isit like we can specify thelocation of the image directly ?

3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

The first part of your question is not really OpenCL related. There are many libraries available that let you read/write jpeg files that give you a way to get the image dimensions.

The host_ptr argument that clCreateImage2D() requires is the address in the host memory that points tothe image data.

Also, note that on CPU images are very slow. It is recommended to use buffers. You are fine on GPU.


Thanks Raghupati.I found that I can directly use the C++ library routines to get the image dimensions and not depend on opencl for that. So now can I do this..I will convert the jpeg image into some array and convert that to a float array. Can I create a buffer and put this float array into the buffer. Then do some processing on the GPU kernel.I hope this should be fine. can the clEnqueueWriteBuffer() be used for this purpose?

Leave a Comment

Please sign in to add a comment. Not a member? Join today