Direction gradient value of edge pixel

2 Ansichten (letzte 30 Tage)
Balkar Singh
Balkar Singh am 25 Jun. 2019
Kommentiert: KALYAN ACHARJYA am 25 Jun. 2019
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.

Antworten (1)

Image Analyst
Image Analyst am 25 Jun. 2019
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 Kommentar
KALYAN ACHARJYA
KALYAN ACHARJYA am 25 Jun. 2019
Yes sir, I misundestood the question (the question is negative value of gradient direction). You clearly explained the reason of negative direction of gradient.

Melden Sie sich an, um zu kommentieren.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by