Can we rotate sobel operator and still get the same results for gradient image
6 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have a 5*5 image and I applied imgradient() on it and got the directions(just focussing on directions). I also tried to calculate the directions for the same image on paper using the following sobel operators.
gx=[-1 0 1; -2 0 2; -1 0 1] gy=[-1 -2 -1; 0 0 0; 1 2 1]
I found theta using
Gdir = atan2(-gy,gx)*180/pi %Note: gy is negative as y moves from top to bottom
and got same answers as were obtained using imgradient().
But when I used
gx=[1 0 -1; 2 0 -2; 1 0 -1] gy=[1 2 1; 0 0 0; -1 -2 -1]
I got different answers. Why?
Can't we rotate sobel operator and still get the same results. Does MATLAB uses a fixed set of sobel operators to find gradient and never uses the rotated version? What is the problem. Please explain.
0 commentaires
Réponses (1)
Anand
le 9 Fév 2016
The imgradient function uses the following kernels for the 'sobel':
hx = -fspecial('sobel')'
hx =
-1 0 1
-2 0 2
-1 0 1
hy = -fspecial('sobel')
hy =
-1 -2 -1
0 0 0
1 2 1
You get different results with the rotated kernels because the Sobel kernel is not symmetric.
0 commentaires
Voir également
Catégories
En savoir plus sur 3-D Volumetric Image Processing dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!