沒什麼自己的東西,大致翻譯了opencv cook第 五章Detecting edges and corners using morphological filters部分的一些段落,並且做一個簡略的概括。
首先創建四個5x5的不同形狀的kernel;
1)kernel a(十字):
0,0,1,0,0,
0,0,1,0,0,
1,1,1,1,1,
0,0,1,0,0,
0,0,1,0,0
2)kernel b(菱形);
0,0,1,0,0,
0,1,1,1,0,
1,1,1,1,1,
0,1,1,1,0,
0,0,1,0,0
3)kernel c(X形);
1,0,0,0,1,
0,1,0,1,0,
0,0,1,0,0,
0,1,0,1,0,
1,0,0,0,1
4)kernel d(方形);
1,1,1,1,1,
1,1,1,1,1,
1,1,1,1,1,
1,1,1,1,1,
1,1,1,1,1,
便於理解用下圖式例:
步驟爲:1)對源圖用kernel a進行膨脹,
2)對1)步後的圖用kernel b進行腐蝕得到result1:
3)對源圖用kernel c進行膨脹
4)對3)步後的圖用kernel d進行腐蝕得到result2
5)abs(result1-result2)就是corners了
其中,3)、4)步原理同1)、2)步驟,只是其的一個旋轉版本,用於檢測45度的corners
下圖是實際檢測corner的結果圖:
@相關論文:The article A modified regulated morphological corner detector by F.Y. Shih, C.-F. Chuang, V.
Gaddipati, Pattern Recognition Letters, volume 26, issue 7, May 2005, for more information
on morphological corner detection.