Feature detectors and descriptors
Functions
Functions and classes to detect and describe image features
Bundles OpenCV feature detectors and descriptors into the FeatureDD class
Also makes it easier to mix and match feature detectors and descriptors from different pacakges (e.g. skimage and OpenCV). See CensureVggFD for an example
Classes
Base feature detector
- class valis.feature_detectors.FeatureDD(kp_detector=None, kp_descriptor=None)[source]
Abstract class for feature detection and description.
User can create other feature detectors as subclasses, but each must return keypoint positions in xy coordinates along with the descriptors for each keypoint.
Note that in some cases, such as KAZE, kp_detector can also detect features. However, in other cases, there may need to be a separate feature detector (like BRISK or ORB) and feature descriptor (like VGG).
- detectAndCompute(image, mask=None)
Detects and describes keypoints in image
- detect_and_compute(image, mask=None)[source]
Detect the features in the image
Detect the features in the image using the defined kp_detector, then describe the features using the kp_descriptor. The user can override this method so they don’t have to use OpenCV’s Keypoint class.
- Parameters:
image (ndarray) – Image in which the features will be detected. Should be a 2D uint8 image if using OpenCV
mask (ndarray, optional) – Binary image with same shape as image, where foreground > 0, and background = 0. If provided, feature detection will only be performed on the foreground.
- Returns:
kp (ndarry) – (N, 2) array positions of keypoints in xy corrdinates for N keypoints
desc (ndarry) – (N, M) array containing M features for each of the N keypoints
BRISK
KAZE
AKAZE
DAISY
LATCH
BOOST
VGG
Orb + Vgg
SuperPoint
- class valis.feature_detectors.SuperPointFD(keypoint_threshold=0.005, nms_radius=4, force_cpu=False, kp_descriptor=None, kp_detector=None)[source]
Bases:
FeatureDD
SuperPoint FeatureDD
Use SuperPoint to detect and describe features (detect_and_compute) Adapted from https://github.com/magicleap/SuperGluePretrainedNetwork/blob/master/match_pairs.py
References
Paul-Edouard Sarlin, Daniel DeTone, Tomasz Malisiewicz, and Andrew Rabinovich. SuperGlue: Learning Feature Matching with Graph Neural Networks. In CVPR, 2020. https://arxiv.org/abs/1911.11763