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