Feature detectors and descriptors
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
- valis.feature_detectors.filter_features(kp, desc, n_keep=20000)
Get keypoints with highest response
Keypoints and and corresponding descriptors that the the n_keep highest
Base feature detector
- class valis.feature_detectors.FeatureDD(kp_detector=None, kp_descriptor=None)
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
- __init__(kp_detector=None, kp_descriptor=None)
- detect_and_compute(image, mask=None)
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.
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.
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
Orb + Vgg
- class valis.feature_detectors.SuperPointFD(keypoint_threshold=0.005, nms_radius=4, force_cpu=False, kp_descriptor=None, kp_detector=None)
Use SuperPoint to detect and describe features (detect_and_compute) Adapted from https://github.com/magicleap/SuperGluePretrainedNetwork/blob/master/match_pairs.py
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