Table of Contents

Class DescriptorMatcher

Namespace
OpenCvSharp
Assembly
OpenCvSharp.dll
public class DescriptorMatcher : Algorithm, IDisposable, ICvPtrHolder
Inheritance
DescriptorMatcher
Implements
Derived
Inherited Members

Constructors

DescriptorMatcher()

protected DescriptorMatcher()

Methods

Add(IEnumerable<Mat>)

Add descriptors to train descriptor collection.

public virtual void Add(IEnumerable<Mat> descriptors)

Parameters

descriptors IEnumerable<Mat>

Descriptors to add. Each descriptors[i] is a descriptors set from one image.

Clear()

Clear train descriptors collection.

public virtual void Clear()

Create(string)

Create descriptor matcher by type name.

public static DescriptorMatcher Create(string descriptorMatcherType)

Parameters

descriptorMatcherType string

Returns

DescriptorMatcher

DisposeManaged()

Releases managed resources

protected override void DisposeManaged()

Empty()

Return true if there are not train descriptors in collection.

public virtual bool Empty()

Returns

bool

GetTrainDescriptors()

Get train descriptors collection.

public Mat[] GetTrainDescriptors()

Returns

Mat[]

IsMaskSupported()

Return true if the matcher supports mask in match methods.

public virtual bool IsMaskSupported()

Returns

bool

KnnMatch(Mat, Mat, int, Mat?, bool)

Find k best matches for each query descriptor (in increasing order of distances). compactResult is used when mask is not empty. If compactResult is false matches vector will have the same size as queryDescriptors rows. If compactResult is true matches vector will not contain matches for fully masked out query descriptors.

public DMatch[][] KnnMatch(Mat queryDescriptors, Mat trainDescriptors, int k, Mat? mask = null, bool compactResult = false)

Parameters

queryDescriptors Mat
trainDescriptors Mat
k int
mask Mat
compactResult bool

Returns

DMatch[][]

KnnMatch(Mat, int, Mat[]?, bool)

Find k best matches for each query descriptor (in increasing order of distances). compactResult is used when mask is not empty. If compactResult is false matches vector will have the same size as queryDescriptors rows. If compactResult is true matches vector will not contain matches for fully masked out query descriptors.

public DMatch[][] KnnMatch(Mat queryDescriptors, int k, Mat[]? masks = null, bool compactResult = false)

Parameters

queryDescriptors Mat
k int
masks Mat[]
compactResult bool

Returns

DMatch[][]

Match(Mat, Mat, Mat?)

Find one best match for each query descriptor (if mask is empty).

public DMatch[] Match(Mat queryDescriptors, Mat trainDescriptors, Mat? mask = null)

Parameters

queryDescriptors Mat
trainDescriptors Mat
mask Mat

Returns

DMatch[]

Match(Mat, Mat[]?)

Find one best match for each query descriptor (if mask is empty).

public DMatch[] Match(Mat queryDescriptors, Mat[]? masks = null)

Parameters

queryDescriptors Mat
masks Mat[]

Returns

DMatch[]

RadiusMatch(Mat, Mat, float, Mat?, bool)

Find best matches for each query descriptor which have distance less than maxDistance (in increasing order of distances).

public DMatch[][] RadiusMatch(Mat queryDescriptors, Mat trainDescriptors, float maxDistance, Mat? mask = null, bool compactResult = false)

Parameters

queryDescriptors Mat
trainDescriptors Mat
maxDistance float
mask Mat
compactResult bool

Returns

DMatch[][]

RadiusMatch(Mat, float, Mat[]?, bool)

Find best matches for each query descriptor which have distance less than maxDistance (in increasing order of distances).

public DMatch[][] RadiusMatch(Mat queryDescriptors, float maxDistance, Mat[]? masks = null, bool compactResult = false)

Parameters

queryDescriptors Mat
maxDistance float
masks Mat[]
compactResult bool

Returns

DMatch[][]

Train()

Train matcher (e.g. train flann index). In all methods to match the method train() is run every time before matching. Some descriptor matchers (e.g. BruteForceMatcher) have empty implementation of this method, other matchers really train their inner structures (e.g. FlannBasedMatcher trains flann::Index). So nonempty implementation of train() should check the class object state and do traing/retraining only if the state requires that (e.g. FlannBasedMatcher trains flann::Index if it has not trained yet or if new descriptors have been added to the train collection).

public virtual void Train()