mirror of
https://github.com/wassname/scikit-image.git
synced 2026-08-09 12:30:07 +08:00
Implementing keypoints_orb without using Harris response
This commit is contained in:
committed by
Johannes Schönberger
parent
f9b6e1ba8f
commit
7d8c59135f
@@ -12,6 +12,7 @@ from .template import match_template
|
||||
from ._brief import brief, match_keypoints_brief
|
||||
from .util import pairwise_hamming_distance
|
||||
from .censure import keypoints_censure
|
||||
from .orb import keypoints_orb, descriptor_orb
|
||||
|
||||
__all__ = ['daisy',
|
||||
'hog',
|
||||
@@ -36,4 +37,6 @@ __all__ = ['daisy',
|
||||
'structure_tensor',
|
||||
'structure_tensor_eigvals',
|
||||
'hessian_matrix',
|
||||
'hessian_matrix_eigvals']
|
||||
'hessian_matrix_eigvals',
|
||||
'keypoints_orb',
|
||||
'descriptor_orb']
|
||||
|
||||
@@ -3,6 +3,39 @@ import numpy as np
|
||||
from ..util import img_as_float
|
||||
from .util import _mask_border_keypoints
|
||||
|
||||
from skimage.feature import corner_fast, corner_orientations, corner_peaks
|
||||
from skimage.transform import pyramid_gaussian
|
||||
|
||||
|
||||
def keypoints_orb(image, n=9, threshold=0.20, downscale_factor=1.414,
|
||||
n_scales=5):
|
||||
|
||||
image = np.squeeze(image)
|
||||
if image.ndim != 2:
|
||||
raise ValueError("Only 2-D gray-scale images supported.")
|
||||
|
||||
pyramid = list(pyramid_gaussian(image, n_scales - 1, downscale_factor))
|
||||
|
||||
ofast_mask = np.array([[0, 0, 1, 1, 1, 0, 0],
|
||||
[0, 1, 1, 1, 1, 1, 0],
|
||||
[1, 1, 1, 1, 1, 1, 1],
|
||||
[1, 1, 1, 1, 1, 1, 1],
|
||||
[1, 1, 1, 1, 1, 1, 1],
|
||||
[0, 1, 1, 1, 1, 1, 0],
|
||||
[0, 0, 1, 1, 1, 0, 0]], dtype=np.uint8)
|
||||
|
||||
keypoints = np.empty((0, 2), dtype=np.intp)
|
||||
orientations = np.empty((0), dtype=np.double)
|
||||
scales = np.empty((0), dtype=np.intp)
|
||||
|
||||
for i in range(n_scales):
|
||||
corners = corner_peaks(corner_fast(pyramid[i], n, threshold), min_distance=1)
|
||||
keypoints = np.vstack((keypoints, corners))
|
||||
orientations = np.hstack((orientations, corner_orientations(pyramid[i], corners, ofast_mask)))
|
||||
scales = np.hstack((scales, i * np.ones((corners.shape[0]), dtype=np.intp)))
|
||||
|
||||
return keypoints, orientations, scales
|
||||
|
||||
|
||||
def descriptor_orb(image, keypoints, keypoints_angle):
|
||||
|
||||
|
||||
Reference in New Issue
Block a user