O'Reilly logo

Computer Vision with Python 3 by Saurabh Kapur

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

Sobel edge detector

The idea behind the Sobel edge detector is to find the pixels with a large magnitude of gradient values. We are now not only interested in the change, but also the magnitude of change (which is also the gradient). The magnitude of the gradient is calculated by finding the square root of the sum of squares of the image derivative in the x-direction and the derivative in the y-direction. The equation for the gradient is as follows:

To determine how large values should be considered, we set a threshold. So after finding the gradient, we take all the gradient values, which exceed that particular threshold.

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