Image histogram computation

In the previous chapter, we computed the RGB histogram of an input image on an OpenCL buffer object. In this chapter, we will discuss the same with input as an OpenCL image object. The input image is read into a contiguous buffer and an image object is created using the clCreateImage function. At the kernel side the pixel values can be sampled using read_image OpenCL built-in. The next diagram illustrates how an image is read and processed in the example code. The input image from the file system is read into a contiguous buffer, row wise as shown by step 1 in the diagram. The input image can be of any format BMP, PNG, or JPEG. The raw image pixel buffer is then used to create an OpenCL image object using the clCreateImage ...

Get OpenCL Programming by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.