生活随笔
收集整理的這篇文章主要介紹了
fast 算法原理
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
代碼在git
p10p_{10}p10?p9p_9p9?p8p_8p8?
| p11p_{11}p11? | | | | p7p_7p7? | |
| p12p_{12}p12? | | | | | | p6p_6p6? |
| p13p_{13}p13? | | | P | | | p5p_5p5? |
| p14p_{14}p14? | | | | | | p4p_4p4? |
| p15p_{15}p15? | | | | p3p_3p3? | |
| | p16p_{16}p16? | p1p_1p1? | p2p_2p2? | | |
fast 算法的源碼實現只是比較
- ppp和p1p_1p1?,p9p_9p9?的灰度差
- ppp和p5p_5p5?,p13p_{13}p13?的灰度差
在計算fast 前需要進行中止濾波
在計算后要進行非極大抑制
- 第1步:在圖像中選擇某個像素,它的灰度值記為。
- 第2步:設定一個閾值,用于判斷兩個像素灰度值差異大小,為了能夠自適應不同的圖像,一般采用相對百分比例,比如設置為的20%。
- 第3步:以像素為中心,選取半徑為3的圓上的16個像素點。選取方式見下圖右所示。
- 第4步:如果16個像素點中有連續的個點的灰度大于或者小于,那么可以將像素確定為關鍵點。在ORB的論文中,作者說時效果較好,稱之為FAST-9。實際操作中為了加速,我們可以把第1,5,9,13個像素點當做錨點,在FAST-9算法中,只有當這4個錨點中有3個及以上灰度值同時大于或者小于,當前像素才可能是一個關鍵點進入到下一個階段的判斷,否則就可以排除掉,這大大加速了關鍵點檢測的速度。
- 第5步:遍歷圖像中每個像素點,循環執行以上四個步驟。
# 校驗rows
, cols
= image
.shape
[:2]if row
< 3 or col
< 3:return False
if row
>= rows
-3 or col
>= cols
-3:return Falseintensity
= int(image
[row
][col
])ROI
= circle(row
, col
)# 獲取位置
1,9,5,13的像素值row1
, col1
= ROI
[0]row9
, col9
= ROI
[8]row5
, col5
= ROI
[4]row13
, col13
= ROI
[12]intensity1
= int(image
[row1
][col1
])intensity9
= int(image
[row9
][col9
])intensity5
= int(image
[row5
][col5
])intensity13
= int(image
[row13
][col13
])# 統計上面
4個位置中滿足 像素值
> intensity
+ threshold點的個數countMore
= 0# 統計上面
4個位置中滿足 像素值
< intensity
- threshold點的個數countLess
= 0if intensity1
- intensity
> threshold
:countMore
+= 1elif intensity1
+ threshold
< intensity
:countLess
+= 1if intensity9
- intensity
> threshold
:countMore
+= 1elif intensity9
+ threshold
< intensity
:countLess
+= 1if intensity5
- intensity
> threshold
:countMore
+= 1elif intensity5
+ threshold
< intensity
:countLess
+= 1if intensity13
- intensity
> threshold
:countMore
+= 1elif intensity13
+ threshold
< intensity
:countLess
+= 1
總結
以上是生活随笔為你收集整理的fast 算法原理的全部內容,希望文章能夠幫你解決所遇到的問題。
如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。