Chapter 15. Sobel Edge Detection Filter

In this chapter, we use an OpenCL kernel to implement the Sobel edge detection filter as a simple example of how kernels work with images in OpenCL.

What Is a Sobel Edge Detection Filter?

The Sobel edge filter is a directional edge detector filter because it computes the image gradients along the x- and y-axes. These image gradients along the x- and y-axes (described as Gx and Gy) are computed by convolving the source image with the following convolution kernels:

image

The gradient magnitude is computed as

image

Implementing ...

Get OpenCL Programming Guide 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.