O'Reilly logo

OpenCL Programming by Example by Koushik Bhattacharyya, Ravishekhar Banger

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required