Histogram calculation

Histogram is a graphical representation of tonal distribution of a digital image. It plots the number of pixels for each tonal value. In this example we find the histogram of each of the RGB color components in the color image.

In this section, we will discuss the histogram sample. The sample code has two parts the host code and the device code which is defined as a const char *histogram_kernel. For understanding purpose, we will discuss the OpenCL kernel code that follows. For an OpenCL application programmer most of the effort goes in writing the OpenCL kernel. The majority of the host code is that of setting up the OpenCL platform to run that kernel. We now start with the discussion of the kernel code.

Algorithm

The input ...

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

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.