darsia.FeatureDetection#
- class FeatureDetection[source]#
Bases:
objectClass containing two class methods, once detecting features, and matching features.
Methods
extract_features(img[, roi, mask, max_features])Extract features from an image.
match_features(features_src, features_dst[, ...])Match two sets of features via a homography.
- classmethod extract_features(img, roi=None, mask=None, max_features=200)[source]#
Extract features from an image.
- Parameters:
- img
numpy.ndarray Image array.
- roi
tupleoftwoslices,optional Region of interest; by default the whole image.
- mask
numpy.ndarray,optional Region in which features are considered; None means all features.
- max_features
int,optional Maximum number of features to extract. Default 200.
- img
- Returns:
- keypoints
list Feature keypoints, given as
(col, row)(reversed matrix indexing).- descriptors
numpy.ndarray Feature descriptors.
- successbool
Whether any features were found.
- keypoints
- classmethod match_features(features_src, features_dst, keep_percent=0.1, return_matches=False)[source]#
Match two sets of features via a homography.
- Parameters:
- features_src
tuple Source features given as tuple of keypoints and descriptors.
- features_dst
tuple Destination features given as tuple of keypoints and descriptors.
- keep_percent
float Number between 0 and 1 indicating how many features should be considered for finding a match; 0 denotes none, while 1 denotes all.
- return_matchesbool
Flag controlling whether also the matches are returned, which could e.g. be used for plotting.
- features_src
- Returns:
np.ndarrayHomography matrix matching the features.
- bool
Flag indicating whether procedure has been successful. Matches (optional): matches between features # TODO type.