Direction gradient value of edge pixel
3 次查看(过去 30 天)
显示 更早的评论
I applied imgradient on a grayscale image to get its edge direction but i got direction value in the form of negative value , zero and positive value. What is the reason negative values come of edge direction. I am using MATLAB 2019a.Thank you.
0 个评论
回答(1 个)
Image Analyst
2019-6-25
As you know, the gradient is a vector. So you can get magnitude and direction from imgradient(), or get the direction as x and y components using the imgradientxy() function. The help for imgradient() says
Gradient direction, returned as a numeric matrix the same size as image I. Gdir contains angles in degrees within the range [-180 180] measured counterclockwise from the positive x-axis.
So the vector could be pointing in a negative direction, for example if you had an edge where it's dark for upper pixels (top part of the step in intensity) and bright for lower pixels. For example if the image had the top half be all 120 and the bottom half pixels all had the value 150. The gradient right at the edge would be 30 and it would be pointing downward (-90 degrees).
Does that explain it?
1 个评论
KALYAN ACHARJYA
2019-6-25
Yes sir, I misundestood the question (the question is negative value of gradient direction). You clearly explained the reason of negative direction of gradient.
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!