Direction gradient value of edge pixel
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (1)
Image Analyst
le 25 Juin 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 commentaire
KALYAN ACHARJYA
le 25 Juin 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.
Voir également
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!