This example implements a simple Sobel filter in Open Computing Language (OpenCLTM). The example contains a single work-item kernel that implements a Sobel operator to detect edges in an input RGB image (8 bits per component) and outputs a monochrome image. The kernel code is instructive, showing how to efficiently describe a sliding-window line buffer. This is a technique that can be used in many other image filtering applications.
This example also has an interactive host application. The host application allows you to choose between displaying the input or filtered image. The edge detection threshold can also be dynamically adjusted and the selected threshold value is passed to the OpenCL kernel as a parameter.
Sobel Filter Performance