Can we rotate sobel operator and still get the same results for gradient image
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (1)
Anand
el 9 de Feb. de 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 comentarios
Ver también
Categorías
Más información sobre 3-D Volumetric Image Processing en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!