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

OpenCL implementation of filters

Here we discuss how each of the filters is implemented. Similar filters are discussed together. Mean and Gaussian filters are imposed by convoluting with a fixed 3 x 3 matrix.

Mean and Gaussian filter

In our OpenCL implementation of the Mean and Gaussian filters, we write a kernel called filter_kernel that can be used for the two filters. We do this by configuring the third argument filter so that it can create effects of the corresponding filter. For the Mean filter we send a nine element array, where each element's value is 1/9 and when this is convoluted with the corresponding window, it produces the effect of mean of that window. When the filter_kernel kernel is to be called for the Gaussian filter, we pass corresponding ...

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