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.