darsia.FeatureDetection#

class FeatureDetection[source]#

Bases: object

Class 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:
imgnumpy.ndarray

Image array.

roituple of two slices, optional

Region of interest; by default the whole image.

masknumpy.ndarray, optional

Region in which features are considered; None means all features.

max_featuresint, optional

Maximum number of features to extract. Default 200.

Returns:
keypointslist

Feature keypoints, given as (col, row) (reversed matrix indexing).

descriptorsnumpy.ndarray

Feature descriptors.

successbool

Whether any features were found.

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_srctuple

Source features given as tuple of keypoints and descriptors.

features_dsttuple

Destination features given as tuple of keypoints and descriptors.

keep_percentfloat

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.

Returns:
np.ndarray

Homography matrix matching the features.

bool

Flag indicating whether procedure has been successful. Matches (optional): matches between features # TODO type.