# Sobel Filter / Edge Detector in Image Processing

To filter an image it is filtered using both operators the results of which are added together. In this post, we learn about the** Sobel Filter in Image Processing** which is also called the **Edge Detector Filter in Image Processing**.

The Sobel edge detector is a gradient-based method. Sobel filters are typically used for edge detection.

**Also Read: High Pass Filter in Image Processing**

## Sobel Filter / Edge Detector in Image Processing

- It works with first-order derivatives.
- It calculates the first derivatives of the image separately for the X and Y axes.
- The derivatives are only approximations (because the images are not continuous).
- To approximate them, the following kernels are used for convolution:

The kernel on the left approximates the derivative along the** X-axis**.

The one on the right is for the** Y-axis**. Using this information, you can calculate the following:

- Magnitude or “strength” of the edge:
- Approximate strength:
- The orientation of the edge:

Above, I’ve detected horizontal peaks. You can clearly see the horizontal edges highlighted.

You can then threshold this result to get rid of the grey areas and get solid edges.