Can we rotate sobel operator and still get the same results for gradient image

5 ビュー (過去 30 日間)
Navdeep Sony
Navdeep Sony 2016 年 2 月 6 日
回答済み: Anand 2016 年 2 月 9 日
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.

回答 (1 件)

Anand
Anand 2016 年 2 月 9 日
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.

カテゴリ

Help Center および File Exchange3-D Volumetric Image Processing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by