View Source Evision.DescriptorMatcher (Evision v0.1.8)

Link to this section Summary

cv

Adds descriptors to train a CPU(trainDescCollectionis) or GPU(utrainDescCollectionis) descriptor collection.

Clears the train descriptor collections.

Clones the matcher.

Variant 1:

Positional Arguments
  • matcherType: DescriptorMatcher_MatcherType

Python prototype (for reference):

Returns true if there are no train descriptors in the both collections.

Returns a constant link to the train descriptor collection trainDescCollection .

Returns true if the descriptor matcher supports masking permissible matches.

Positional Arguments

Variant 1:

Finds the k best matches for each descriptor from a query set.

Finds the k best matches for each descriptor from a query set.

Positional Arguments

Variant 1:

Finds the best match for each descriptor from a query set.

Finds the best match for each descriptor from a query set.

Positional Arguments

Variant 1:

For each query descriptor, finds the training descriptors not farther than the specified distance.

For each query descriptor, finds the training descriptors not farther than the specified distance.

Variant 1:

Positional Arguments
  • arg1: FileNode

Python prototype (for reference):

Trains a descriptor matcher

Variant 1:

Positional Arguments
  • fs: Ptr<FileStorage>
Keyword Arguments

Python prototype (for reference):

Positional Arguments
  • fs: Ptr<FileStorage>
Keyword Arguments

Python prototype (for reference):

Link to this section cv

Adds descriptors to train a CPU(trainDescCollectionis) or GPU(utrainDescCollectionis) descriptor collection.

Positional Arguments
  • descriptors: [Evision.Mat].

    Descriptors to add. Each descriptors[i] is a set of descriptors from the same train image.

If the collection is not empty, the new descriptors are added to existing train descriptors.

Python prototype (for reference):

add(descriptors) -> None

Clears the train descriptor collections.

Python prototype (for reference):

clear() -> None

Clones the matcher.

Keyword Arguments
  • emptyTrainData: bool.

    If emptyTrainData is false, the method creates a deep copy of the object, that is, copies both parameters and train data. If emptyTrainData is true, the method creates an object copy with the current parameters but with empty train data.

Python prototype (for reference):

clone([, emptyTrainData]) -> retval

Variant 1:

Positional Arguments
  • matcherType: DescriptorMatcher_MatcherType

Python prototype (for reference):

create(matcherType) -> retval

Variant 2:

Creates a descriptor matcher of a given type with the default parameters (using default constructor).

Positional Arguments
  • descriptorMatcherType: String.Descriptor matcher type. Now the following matcher types are supported:
    • BruteForce (it uses L2 )
    • BruteForce-L1
    • BruteForce-Hamming
    • BruteForce-Hamming(2)
    • FlannBased

Python prototype (for reference):

create(descriptorMatcherType) -> retval

Returns true if there are no train descriptors in the both collections.

Python prototype (for reference):

empty() -> retval
Link to this function

getTrainDescriptors(self)

View Source

Returns a constant link to the train descriptor collection trainDescCollection .

Python prototype (for reference):

getTrainDescriptors() -> retval

Returns true if the descriptor matcher supports masking permissible matches.

Python prototype (for reference):

isMaskSupported() -> retval
Link to this function

knnMatch(self, queryDescriptors, k)

View Source
Positional Arguments
  • queryDescriptors: Evision.Mat.

    Query set of descriptors.

  • k: int.

    Count of best matches found per each query descriptor or less if a query descriptor has less than k possible matches in total.

Keyword Arguments
  • masks: [Evision.Mat].

    Set of masks. Each masks[i] specifies permissible matches between the input query descriptors and stored train descriptors from the i-th image trainDescCollection[i].

  • compactResult: bool.

    Parameter used when the mask (or masks) is not empty. If compactResult is false, the matches vector has the same size as queryDescriptors rows. If compactResult is true, the matches vector does not contain matches for fully masked-out query descriptors.

Return
  • matches: [vector_DMatch].

    Matches. Each matches[i] is k or less matches for the same query descriptor.

Has overloading in C++

Python prototype (for reference):

knnMatch(queryDescriptors, k[, masks[, compactResult]]) -> matches
Link to this function

knnMatch(self, queryDescriptors, k, opts)

View Source

Variant 1:

Finds the k best matches for each descriptor from a query set.

Positional Arguments
  • queryDescriptors: Evision.Mat.

    Query set of descriptors.

  • trainDescriptors: Evision.Mat.

    Train set of descriptors. This set is not added to the train descriptors collection stored in the class object.

  • k: int.

    Count of best matches found per each query descriptor or less if a query descriptor has less than k possible matches in total.

Keyword Arguments
  • mask: Evision.Mat.

    Mask specifying permissible matches between an input query and train matrices of descriptors.

  • compactResult: bool.

    Parameter used when the mask (or masks) is not empty. If compactResult is false, the matches vector has the same size as queryDescriptors rows. If compactResult is true, the matches vector does not contain matches for fully masked-out query descriptors.

Return
  • matches: [vector_DMatch].

    Matches. Each matches[i] is k or less matches for the same query descriptor.

These extended variants of DescriptorMatcher::match methods find several best matches for each query descriptor. The matches are returned in the distance increasing order. See DescriptorMatcher::match for the details about query and train descriptors.

Python prototype (for reference):

knnMatch(queryDescriptors, trainDescriptors, k[, mask[, compactResult]]) -> matches

Variant 2:

Positional Arguments
  • queryDescriptors: Evision.Mat.

    Query set of descriptors.

  • k: int.

    Count of best matches found per each query descriptor or less if a query descriptor has less than k possible matches in total.

Keyword Arguments
  • masks: [Evision.Mat].

    Set of masks. Each masks[i] specifies permissible matches between the input query descriptors and stored train descriptors from the i-th image trainDescCollection[i].

  • compactResult: bool.

    Parameter used when the mask (or masks) is not empty. If compactResult is false, the matches vector has the same size as queryDescriptors rows. If compactResult is true, the matches vector does not contain matches for fully masked-out query descriptors.

Return
  • matches: [vector_DMatch].

    Matches. Each matches[i] is k or less matches for the same query descriptor.

Has overloading in C++

Python prototype (for reference):

knnMatch(queryDescriptors, k[, masks[, compactResult]]) -> matches
Link to this function

knnMatch(self, queryDescriptors, trainDescriptors, k, opts)

View Source

Finds the k best matches for each descriptor from a query set.

Positional Arguments
  • queryDescriptors: Evision.Mat.

    Query set of descriptors.

  • trainDescriptors: Evision.Mat.

    Train set of descriptors. This set is not added to the train descriptors collection stored in the class object.

  • k: int.

    Count of best matches found per each query descriptor or less if a query descriptor has less than k possible matches in total.

Keyword Arguments
  • mask: Evision.Mat.

    Mask specifying permissible matches between an input query and train matrices of descriptors.

  • compactResult: bool.

    Parameter used when the mask (or masks) is not empty. If compactResult is false, the matches vector has the same size as queryDescriptors rows. If compactResult is true, the matches vector does not contain matches for fully masked-out query descriptors.

Return
  • matches: [vector_DMatch].

    Matches. Each matches[i] is k or less matches for the same query descriptor.

These extended variants of DescriptorMatcher::match methods find several best matches for each query descriptor. The matches are returned in the distance increasing order. See DescriptorMatcher::match for the details about query and train descriptors.

Python prototype (for reference):

knnMatch(queryDescriptors, trainDescriptors, k[, mask[, compactResult]]) -> matches
Link to this function

match(self, queryDescriptors)

View Source
Positional Arguments
  • queryDescriptors: Evision.Mat.

    Query set of descriptors.

Keyword Arguments
  • masks: [Evision.Mat].

    Set of masks. Each masks[i] specifies permissible matches between the input query descriptors and stored train descriptors from the i-th image trainDescCollection[i].

Return
  • matches: [DMatch].

    Matches. If a query descriptor is masked out in mask , no match is added for this descriptor. So, matches size may be smaller than the query descriptors count.

Has overloading in C++

Python prototype (for reference):

match(queryDescriptors[, masks]) -> matches
Link to this function

match(self, queryDescriptors, opts)

View Source

Variant 1:

Finds the best match for each descriptor from a query set.

Positional Arguments
  • queryDescriptors: Evision.Mat.

    Query set of descriptors.

  • trainDescriptors: Evision.Mat.

    Train set of descriptors. This set is not added to the train descriptors collection stored in the class object.

Keyword Arguments
  • mask: Evision.Mat.

    Mask specifying permissible matches between an input query and train matrices of descriptors.

Return
  • matches: [DMatch].

    Matches. If a query descriptor is masked out in mask , no match is added for this descriptor. So, matches size may be smaller than the query descriptors count.

In the first variant of this method, the train descriptors are passed as an input argument. In the second variant of the method, train descriptors collection that was set by DescriptorMatcher::add is used. Optional mask (or masks) can be passed to specify which query and training descriptors can be matched. Namely, queryDescriptors[i] can be matched with trainDescriptors[j] only if mask.at\<uchar>(i,j) is non-zero.

Python prototype (for reference):

match(queryDescriptors, trainDescriptors[, mask]) -> matches

Variant 2:

Positional Arguments
  • queryDescriptors: Evision.Mat.

    Query set of descriptors.

Keyword Arguments
  • masks: [Evision.Mat].

    Set of masks. Each masks[i] specifies permissible matches between the input query descriptors and stored train descriptors from the i-th image trainDescCollection[i].

Return
  • matches: [DMatch].

    Matches. If a query descriptor is masked out in mask , no match is added for this descriptor. So, matches size may be smaller than the query descriptors count.

Has overloading in C++

Python prototype (for reference):

match(queryDescriptors[, masks]) -> matches
Link to this function

match(self, queryDescriptors, trainDescriptors, opts)

View Source

Finds the best match for each descriptor from a query set.

Positional Arguments
  • queryDescriptors: Evision.Mat.

    Query set of descriptors.

  • trainDescriptors: Evision.Mat.

    Train set of descriptors. This set is not added to the train descriptors collection stored in the class object.

Keyword Arguments
  • mask: Evision.Mat.

    Mask specifying permissible matches between an input query and train matrices of descriptors.

Return
  • matches: [DMatch].

    Matches. If a query descriptor is masked out in mask , no match is added for this descriptor. So, matches size may be smaller than the query descriptors count.

In the first variant of this method, the train descriptors are passed as an input argument. In the second variant of the method, train descriptors collection that was set by DescriptorMatcher::add is used. Optional mask (or masks) can be passed to specify which query and training descriptors can be matched. Namely, queryDescriptors[i] can be matched with trainDescriptors[j] only if mask.at\<uchar>(i,j) is non-zero.

Python prototype (for reference):

match(queryDescriptors, trainDescriptors[, mask]) -> matches
Link to this function

radiusMatch(self, queryDescriptors, maxDistance)

View Source
Positional Arguments
  • queryDescriptors: Evision.Mat.

    Query set of descriptors.

  • maxDistance: float.

    Threshold for the distance between matched descriptors. Distance means here metric distance (e.g. Hamming distance), not the distance between coordinates (which is measured in Pixels)!

Keyword Arguments
  • masks: [Evision.Mat].

    Set of masks. Each masks[i] specifies permissible matches between the input query descriptors and stored train descriptors from the i-th image trainDescCollection[i].

  • compactResult: bool.

    Parameter used when the mask (or masks) is not empty. If compactResult is false, the matches vector has the same size as queryDescriptors rows. If compactResult is true, the matches vector does not contain matches for fully masked-out query descriptors.

Return
  • matches: [vector_DMatch].

    Found matches.

Has overloading in C++

Python prototype (for reference):

radiusMatch(queryDescriptors, maxDistance[, masks[, compactResult]]) -> matches
Link to this function

radiusMatch(self, queryDescriptors, maxDistance, opts)

View Source

Variant 1:

For each query descriptor, finds the training descriptors not farther than the specified distance.

Positional Arguments
  • queryDescriptors: Evision.Mat.

    Query set of descriptors.

  • trainDescriptors: Evision.Mat.

    Train set of descriptors. This set is not added to the train descriptors collection stored in the class object.

  • maxDistance: float.

    Threshold for the distance between matched descriptors. Distance means here metric distance (e.g. Hamming distance), not the distance between coordinates (which is measured in Pixels)!

Keyword Arguments
  • mask: Evision.Mat.

    Mask specifying permissible matches between an input query and train matrices of descriptors.

  • compactResult: bool.

    Parameter used when the mask (or masks) is not empty. If compactResult is false, the matches vector has the same size as queryDescriptors rows. If compactResult is true, the matches vector does not contain matches for fully masked-out query descriptors.

Return
  • matches: [vector_DMatch].

    Found matches.

For each query descriptor, the methods find such training descriptors that the distance between the query descriptor and the training descriptor is equal or smaller than maxDistance. Found matches are returned in the distance increasing order.

Python prototype (for reference):

radiusMatch(queryDescriptors, trainDescriptors, maxDistance[, mask[, compactResult]]) -> matches

Variant 2:

Positional Arguments
  • queryDescriptors: Evision.Mat.

    Query set of descriptors.

  • maxDistance: float.

    Threshold for the distance between matched descriptors. Distance means here metric distance (e.g. Hamming distance), not the distance between coordinates (which is measured in Pixels)!

Keyword Arguments
  • masks: [Evision.Mat].

    Set of masks. Each masks[i] specifies permissible matches between the input query descriptors and stored train descriptors from the i-th image trainDescCollection[i].

  • compactResult: bool.

    Parameter used when the mask (or masks) is not empty. If compactResult is false, the matches vector has the same size as queryDescriptors rows. If compactResult is true, the matches vector does not contain matches for fully masked-out query descriptors.

Return
  • matches: [vector_DMatch].

    Found matches.

Has overloading in C++

Python prototype (for reference):

radiusMatch(queryDescriptors, maxDistance[, masks[, compactResult]]) -> matches
Link to this function

radiusMatch(self, queryDescriptors, trainDescriptors, maxDistance, opts)

View Source

For each query descriptor, finds the training descriptors not farther than the specified distance.

Positional Arguments
  • queryDescriptors: Evision.Mat.

    Query set of descriptors.

  • trainDescriptors: Evision.Mat.

    Train set of descriptors. This set is not added to the train descriptors collection stored in the class object.

  • maxDistance: float.

    Threshold for the distance between matched descriptors. Distance means here metric distance (e.g. Hamming distance), not the distance between coordinates (which is measured in Pixels)!

Keyword Arguments
  • mask: Evision.Mat.

    Mask specifying permissible matches between an input query and train matrices of descriptors.

  • compactResult: bool.

    Parameter used when the mask (or masks) is not empty. If compactResult is false, the matches vector has the same size as queryDescriptors rows. If compactResult is true, the matches vector does not contain matches for fully masked-out query descriptors.

Return
  • matches: [vector_DMatch].

    Found matches.

For each query descriptor, the methods find such training descriptors that the distance between the query descriptor and the training descriptor is equal or smaller than maxDistance. Found matches are returned in the distance increasing order.

Python prototype (for reference):

radiusMatch(queryDescriptors, trainDescriptors, maxDistance[, mask[, compactResult]]) -> matches

Variant 1:

Positional Arguments
  • arg1: FileNode

Python prototype (for reference):

read(arg1) -> None

Variant 2:

Positional Arguments

Python prototype (for reference):

read(fileName) -> None

Trains a descriptor matcher

Trains a descriptor matcher (for example, the flann index). In all methods to match, the method train() is run every time before matching. Some descriptor matchers (for example, BruteForceMatcher) have an empty implementation of this method. Other matchers really train their inner structures (for example, FlannBasedMatcher trains flann::Index ).

Python prototype (for reference):

train() -> None

Variant 1:

Positional Arguments
  • fs: Ptr<FileStorage>
Keyword Arguments

Python prototype (for reference):

write(fs[, name]) -> None

Variant 2:

Positional Arguments

Python prototype (for reference):

write(fileName) -> None
Positional Arguments
  • fs: Ptr<FileStorage>
Keyword Arguments

Python prototype (for reference):

write(fs[, name]) -> None

Link to this section Functions

Raising version of add/2.

Raising version of clear/1.

Raising version of clone/1.

Raising version of create/1.

Raising version of empty/1.

Link to this function

getTrainDescriptors!(self)

View Source

Raising version of getTrainDescriptors/1.

Raising version of isMaskSupported/1.

Link to this function

knnMatch!(self, queryDescriptors, k)

View Source

Raising version of knnMatch/3.

Link to this function

knnMatch!(self, queryDescriptors, trainDescriptors, k)

View Source

Raising version of knnMatch/4.

Link to this function

knnMatch!(self, queryDescriptors, trainDescriptors, k, opts)

View Source

Raising version of knnMatch/5.

Link to this function

match!(self, queryDescriptors)

View Source

Raising version of match/2.

Link to this function

match!(self, queryDescriptors, trainDescriptors)

View Source

Raising version of match/3.

Link to this function

match!(self, queryDescriptors, trainDescriptors, opts)

View Source

Raising version of match/4.

Link to this function

radiusMatch!(self, queryDescriptors, maxDistance)

View Source

Raising version of radiusMatch/3.

Link to this function

radiusMatch!(self, queryDescriptors, trainDescriptors, maxDistance)

View Source

Raising version of radiusMatch/4.

Link to this function

radiusMatch!(self, queryDescriptors, trainDescriptors, maxDistance, opts)

View Source

Raising version of radiusMatch/5.

Raising version of read/2.

Raising version of train/1.

Raising version of write/2.

Raising version of write/3.