O'Reilly logo

OpenCL Parallel Programming Development Cookbook by Raymond Tay

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 the Sobel edge filter

Now that you've been armed with how convolution actually works, you should be able to imagine how our algorithm might look like. Briefly, we will read an input image assuming that it's going to be in the Windows BMP format.

Getting ready

Next we'll construct the necessary data structures for transporting this image file in the OpenCL device for convolution, and once that's done we'll read and write the data out to another image file, so that we can compare the two.

Note

Optionally, you can choose to implement this using the clCreateImage(...) APIs provided by OpenCL, and we'll leave it as an exercise for the reader to make the attempt.

In the following sections, you will be shown with an implementation ...

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