最初的理解
- “邊緣”像素點和臨近像素的差異較大
- 受噪聲影響大
- 所以需要降噪(高斯模糊算法)
- 可以利用導數和梯度的方式計算。在矩陣中可以利用卷積的方式近似。超過一定閾值判斷為邊緣。
Gradient operators(梯度算子)
參考資料:邊緣檢測的各種微分算子比較(Sobel,Robert,Prewit...)
Prewitt Edge Detector
Sobel Edge Detector
Marr Hildreth Edge Detector
- 使用高斯模糊并使用拉普拉斯算子,即梯度的散度(更加復雜的模糊算法)
- 找到zero-crossing點
參考資料可以認為zero-crossing點屆時二階導數為0的點
Canny Edge Detector
以下是該邊緣檢測器致力于達到的目標:
- Good Detection: The optimal detector must
minimize the probability of false positives as well as false
negatives.(大概是盡可能減少噪音的影響) - Criterion 2: Good Localization: The edges detected must
be as close as possible to the true edges.(更為準確的定位) - Single Response Constraint: The detector must return
one point only for each edge point.(對一條邊上的點僅響應一個點)
step:
- Smooth image with Gaussian filter
使用高斯模糊(高斯濾波器) - Compute derivative of filtered image
- Find magnitude and orientation of gradient
(計算梯度,方向&大小,即模)
- Apply “Non-maximum Suppression”
圖片數學公式中的delta全部換成梯度符號
取疑似邊緣的點中梯度最大的那個(normal direction:法線方向)
- Apply “Hysteresis Threshold”(滯后閾值)
判斷邊緣的時候使用了兩個閾值,高于HIGH閾值時直接判斷為edge pixel(邊緣點),低于Low閾值時則直接排除,在兩者之間的像素點,如果和edge pixel直接相連,或者和另一個也是在LOW與HIGH之間的點相連。
算法的實現思想: