Ask Your Question

Revision history [back]

Sobel uses the following kernel to compute y-derivative:

-1 -2 -1
 0  0  0
 1  2  1

So if you have a 1-pixel wide horizontal line from Canny edges then it will be taken with zero weight in Sobel. That is why dy = 0 on this line.

Try to run the Sobel operator on the original image instead of Canny edges and you should get correct results.