Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
12 Views

Help with Image processing in OpenCL

Hi,
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 ?
0 Kudos
2 Replies
Highlighted
12 Views

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,
Raghu
0 Kudos
Highlighted
Beginner
12 Views

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?
0 Kudos