I have the below image and I am inspection the gradient directions around the circle edge. When I print out the gradient direction values they are only ever 2 values 44.99
and 224.99
(degrees).
I thought the gradient directions around a circles edge would always point perpendicular to the edge. So my gradient directions would range from 0-360 degrees.
Is my calculation of the gradient direction wrong or my understanding of image gradient directions?
src = cv2.imread('../images/circle.png', cv2.IMREAD_GRAYSCALE)
dX = cv2.Sobel(src, cv2.CV_32F, 1, 0)
dY = cv2.Sobel(src, cv2.CV_32F, 1, 0)
# mag, direction = cv2.cartToPolar(dX, dY, angleInDegrees=True)
mag = cv2.magnitude(dX, dY)
direction = cv2.phase(dX, dY, angleInDegrees=True)
print(direction)