Sobel Filter Design Example

Recommended for:

  • Device: Unknown

  • Quartus®: v17.1



This example implements a simple Sobel filter in Open Computing Language (OpenCL™). 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


  • Visual and interactive host
  • Efficient 2D sliding-window line buffers
  • Single work-item kernel


The design example provides source code for the OpenCL device (.cl) as well as the host application. For compiling the host application, the Linux* package includes a Makefile and the Windows package includes a Microsoft Visual Studio 2010 project.

The following downloads are provided for this example:

The use of this design is governed by, and subject to, the terms and conditions of the hardware reference design license agreement.

Software and Hardware Requirements

This design example requires the following tools:

  • Intel® FPGA Software v17.1 or later
  • Intel FPGA SDK for OpenCL v17.1 or later
  • On Linux: GNU Make and gcc
  • On Windows: Microsoft Visual Studio 2010
  • Host application requires Open Graphics Library (OpenGL) for display

To download the Intel design tools, visit the OpenCL download page. The requirements for the underlying operating system are the same as those of the Intel FPGA SDK for OpenCL.

Sobel filter display.

OpenCL and the OpenCL logo are trademarks of Apple Inc. used by permission by Khronos.

* Product is based on a published Khronos Specification, and has passed the Khronos Conformance Testing Process. Current conformance status can be found at