天天看點

Canny算子的非極大值抑制Non-maximum Suppression

Non-maximum Suppression

After getting gradient magnitude and direction, a full scan of image is done to remove any unwanted pixels which may not constitute the edge. For this, at every pixel, pixel is checked if it is a local maximum in its neighborhood in the direction of gradient. Check the image below:

在得到梯度大小和方向後,對圖像進行全掃描,去除可能不構成邊緣的任何不想要的像素。為此,在每個像素處,像素在梯度方向上是否為其鄰域内的局部最大值。檢查下面的圖像:

Canny算子的非極大值抑制Non-maximum Suppression

Point A is on the edge ( in vertical direction). Gradient direction is normal to the edge. Point B and C are in gradient directions. So point A is checked with point B and C to see if it forms a local maximum. If so, it is considered for next stage, otherwise, it is suppressed ( put to zero).

In short, the result you get is a binary image with "thin edges".

Canny算子的非極大值抑制Non-maximum Suppression

上圖中左邊的為邊緣,右邊的因為A和C之間的極大值約等于A和B的極大值,是以右圖中垂直A的線就不是,會被抑制。