Gradient Direction in Canny Edge Detection
I am trying to understand the concept of Non-maximum suppression(Canny Edge detection), So I started looking at the matlab code. The part of matlab code to determine the direction of the edge is shown below.
switch direction
case 1
idx = find((iy<=0 & ix>-iy) | (iy>=0 & ix<-iy));
case 2
idx = find((ix>0 & -iy>=ix) | (ix<0 & -iy<=ix));
case 3
idx = find((ix<=0 & ix>iy) | (ix>=0 & ix<iy));
case 4
idx = find((iy<0 & ix<=iy) | (iy>0 & ix>=iy));
end
Here,
How are the conditions inside the switch cases corresponds to the cases explained below the code. Could any one please explain this. ?
At first glance, find((iy<=0 & ix>-iy) | (iy>=0 & ix<-iy));
returns the indices of all pixels where
(iy<=0 & ix>-iy)
, so (iy>=0 & ix<-iy))
, so Assuming that the pixels are ordered from up to down and from left to right, and an exactly vertical edge (black on the left, white on the right) is defined as 0°
The other 3 terms of the switch case are analogous.
This is not directly related to non-maximum suppression. I assume this is part of a canny edge filter or something similar, in which case the next step would be to find the local maximum in the just determined direction of the edge. This is done by comparing each pixel with its local neighbours in the edge direction, and erasing all but the maximum.
链接地址: http://www.djcxy.com/p/64034.html上一篇: 寻找牌照的边缘
下一篇: Canny边缘检测中的梯度方向