當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


Python skimage.feature.ORB用法及代碼示例

用法:

class skimage.feature.ORB(downscale=1.2, n_scales=8, n_keypoints=500, fast_n=9, fast_threshold=0.08, harris_k=0.04)

基礎:skimage.feature.util.FeatureDetectorskimage.feature.util.DescriptorExtractor

麵向 FAST 和旋轉的 Brief 特征檢測器和二進製說明符提取器。

參數

n_keypointsint 可選

要返回的關鍵點數。如果檢測到超過 n_keypoints,該函數將根據 Harris 角點響應返回最佳 n_keypoints。如果不是,則返回所有檢測到的關鍵點。

fast_nint 可選

n參數輸入skimage.feature.corner_fast.圓圈上 16 個像素中的最小連續像素數,這些像素都應該變亮或變暗 w.r.t test-pixel。圓上的點 c 較暗 w.r.t 測試像素 p 如果Ic < Ip - threshold如果Ic > Ip + threshold.也代表 n inFAST-n角檢測器。

fast_threshold浮點數,可選

feature.corner_fast 中的 threshold 參數。用於決定圓上的像素是更亮、更暗還是類似 w.r.t 的閾值。測試像素。當需要更多拐角時降低閾值,反之亦然。

harris_k浮點數,可選

k參數輸入skimage.feature.corner_harris.將角與邊分開的靈敏度因子,通常在範圍內[0, 0.2].的小值k導致檢測尖角。

downscale浮點數,可選

圖像金字塔的縮小因子。選擇默認值 1.2 以便有更密集的尺度,從而為後續的特征說明提供穩健的尺度不變性。

n_scalesint 可選

從圖像金字塔底部提取特征的最大尺度數。

參考

1

Ethan Rublee, Vincent Rabaud, Kurt Konolige and Gary Bradski “ORB: An efficient alternative to SIFT and SURF” http://www.vision.cs.chubu.ac.jp/CV-R/pdf/Rublee_iccv2011.pdf

例子

>>> from skimage.feature import ORB, match_descriptors
>>> img1 = np.zeros((100, 100))
>>> img2 = np.zeros_like(img1)
>>> rng = np.random.default_rng(19481137)  # do not copy this value
>>> square = rng.random((20, 20))
>>> img1[40:60, 40:60] = square
>>> img2[53:73, 53:73] = square
>>> detector_extractor1 = ORB(n_keypoints=5)
>>> detector_extractor2 = ORB(n_keypoints=5)
>>> detector_extractor1.detect_and_extract(img1)
>>> detector_extractor2.detect_and_extract(img2)
>>> matches = match_descriptors(detector_extractor1.descriptors,
...                             detector_extractor2.descriptors)
>>> matches
array([[0, 0],
       [1, 1],
       [2, 2],
       [3, 4],
       [4, 3]])
>>> detector_extractor1.keypoints[matches[:, 0]]
array([[59. , 59. ],
       [40. , 40. ],
       [57. , 40. ],
       [46. , 58. ],
       [58.8, 58.8]])
>>> detector_extractor2.keypoints[matches[:, 1]]
array([[72., 72.],
       [53., 53.],
       [70., 53.],
       [59., 71.],
       [72., 72.]])

屬性

keypoints(N, 2) 數組

關鍵點坐標為 (row, col)

scales(N, ) 數組

相應的尺度。

orientations(N, ) 數組

對應的弧度方向。

responses(N, ) 數組

相應的哈裏斯角響應。

descriptors(問,descriptor_size) dtype bool 數組

大小為二進製說明符的二維數組descriptor_size過濾掉具有索引值的邊界關鍵點後的 Q 關鍵點(i, j)或者是True或者False表示 j-th 決策 pixel-pair 上 i-th 關鍵點的強度比較結果。這是Q == np.sum(mask).

相關用法


注:本文由純淨天空篩選整理自scikit-image.org大神的英文原創作品 skimage.feature.ORB。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。