skimage2.feature.ORB#

class skimage2.feature.ORB(downscale=1.2, n_scales=8, n_keypoints=500, fast_n=9, fast_threshold=0.08, harris_k=0.04)[source]#

Bases: FeatureDetector, DescriptorExtractor

Oriented FAST and rotated BRIEF feature detector and binary descriptor extractor.

Parameters:
n_keypointsint, optional

Number of keypoints to be returned. The function will return the best n_keypoints according to the Harris corner response if more than n_keypoints are detected. If not, then all the detected keypoints are returned.

fast_nint, optional

The n parameter in skimage.feature.corner_fast. Minimum number of consecutive pixels out of 16 pixels on the circle that should all be either brighter or darker w.r.t test-pixel. A point c on the circle is darker w.r.t test pixel p if Ic < Ip - threshold and brighter if Ic > Ip + threshold. Also stands for the n in FAST-n corner detector.

fast_thresholdfloat, optional

The threshold parameter in feature.corner_fast. Threshold used to decide whether the pixels on the circle are brighter, darker or similar w.r.t. the test pixel. Decrease the threshold when more corners are desired and vice-versa.

harris_kfloat, optional

The k parameter in skimage.feature.corner_harris. Sensitivity factor to separate corners from edges, typically in range [0, 0.2]. Small values of k result in detection of sharp corners.

downscalefloat, optional

Downscale factor for the image pyramid. Default value 1.2 is chosen so that there are more dense scales which enable robust scale invariance for a subsequent feature description.

n_scalesint, optional

Maximum number of scales from the bottom of the image pyramid to extract the features from.

Attributes:
keypointsndarray of shape (N, 2)

Keypoint coordinates as (row, col).

scalesndarray of shape (N,)

Corresponding scales.

orientationsndarray of shape (N,)

Corresponding orientations in radians.

responsesndarray of shape (N,)

Corresponding Harris corner responses.

descriptorsndarray of shape (Q, descriptor_size) and dtype bool

2D array of binary descriptors of size descriptor_size for Q keypoints after filtering out border keypoints with value at an index (i, j) either being True or False representing the outcome of the intensity comparison for i-th keypoint on j-th decision pixel-pair. It is Q == np.sum(mask).

References

[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

Examples

>>> from _skimage2.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.]])
__init__(downscale=1.2, n_scales=8, n_keypoints=500, fast_n=9, fast_threshold=0.08, harris_k=0.04)[source]#
detect(image)[source]#

Detect oriented FAST keypoints along with the corresponding scale.

Parameters:
image2D array

Input image.

detect_and_extract(image)[source]#

Detect oriented FAST keypoints and extract rBRIEF descriptors.

Note that this is faster than first calling detect and then extract.

Parameters:
image2D array

Input image.

extract(image, keypoints, scales, orientations)[source]#

Extract rBRIEF binary descriptors for given keypoints in image.

Note that the keypoints must be extracted using the same downscale and n_scales parameters. Additionally, if you want to extract both keypoints and descriptors you should use the faster detect_and_extract.

Parameters:
imagendarray of shape (K, L)

Input image.

keypointsndarray of shape (N, 2)

Keypoint coordinates as (row, col).

scalesndarray of shape (N,)

Corresponding scales.

orientationsndarray of shape (N,)

Corresponding orientations in radians.