View Source Evision.FlannBasedMatcher (Evision v0.1.13)

Link to this section Summary

Types

t()

Type that represents an Evision.FlannBasedMatcher struct.

Functions

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

Clears the train descriptor collections.

Clones the matcher.

Return

Python prototype (for reference):

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

Keyword Arguments
  • indexParams: Ptr<flann::IndexParams>.
  • searchParams: Ptr<flann::SearchParams>.
Return

Python prototype (for reference):

Keyword Arguments
  • indexParams: Ptr<flann::IndexParams>.
  • searchParams: Ptr<flann::SearchParams>.
Return

Python prototype (for reference):

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

Python prototype (for reference):

Trains a descriptor matcher

Variant 1:

Positional Arguments
Keyword Arguments

Python prototype (for reference):

Positional Arguments
Keyword Arguments

Python prototype (for reference):

Link to this section Types

@type t() :: %Evision.FlannBasedMatcher{ref: reference()}

Type that represents an Evision.FlannBasedMatcher struct.

  • ref. reference()

    The underlying erlang resource variable.

Link to this section Functions

@spec add(t(), [Evision.Mat.maybe_mat_in()]) :: :ok | {:error, String.t()}

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
@spec clear(t()) :: :ok | {:error, String.t()}

Clears the train descriptor collections.

Python prototype (for reference):

clear() -> None
@spec clone(t()) :: Evision.DescriptorMatcher.t() | {:error, String.t()}

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.

Return

Python prototype (for reference):

clone([, emptyTrainData]) -> retval
@spec create() :: t() | {:error, String.t()}
Return

Python prototype (for reference):

create() -> retval
@spec empty(t()) :: boolean() | {:error, String.t()}

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

Return
  • retval: bool

Python prototype (for reference):

empty() -> retval
@spec flannBasedMatcher() :: t() | {:error, String.t()}
Keyword Arguments
  • indexParams: Ptr<flann::IndexParams>.
  • searchParams: Ptr<flann::SearchParams>.
Return

Python prototype (for reference):

FlannBasedMatcher([, indexParams[, searchParams]]) -> <FlannBasedMatcher object>
@spec flannBasedMatcher([{atom(), term()}, ...] | nil) :: t() | {:error, String.t()}
Keyword Arguments
  • indexParams: Ptr<flann::IndexParams>.
  • searchParams: Ptr<flann::SearchParams>.
Return

Python prototype (for reference):

FlannBasedMatcher([, indexParams[, searchParams]]) -> <FlannBasedMatcher object>
Link to this function

getTrainDescriptors(self)

View Source
@spec getTrainDescriptors(t()) :: [Evision.Mat.t()] | {:error, String.t()}

Returns a constant link to the train descriptor collection trainDescCollection .

Return
  • retval: std::vector<Mat>

Python prototype (for reference):

getTrainDescriptors() -> retval
@spec isMaskSupported(t()) :: boolean() | {:error, String.t()}

Returns true if the descriptor matcher supports masking permissible matches.

Return
  • retval: bool

Python prototype (for reference):

isMaskSupported() -> retval
Link to this function

knnMatch(self, queryDescriptors, k)

View Source
@spec knnMatch(t(), Evision.Mat.maybe_mat_in(), integer()) ::
  [[Evision.DMatch.t()]] | {:error, String.t()}
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: [[Evision.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
@spec knnMatch(
  t(),
  Evision.Mat.maybe_mat_in(),
  integer(),
  [{atom(), term()}, ...] | nil
) ::
  [[Evision.DMatch.t()]] | {:error, String.t()}
@spec knnMatch(t(), Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in(), integer()) ::
  [[Evision.DMatch.t()]] | {:error, String.t()}

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: [[Evision.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: [[Evision.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
@spec knnMatch(
  t(),
  Evision.Mat.maybe_mat_in(),
  Evision.Mat.maybe_mat_in(),
  integer(),
  [{atom(), term()}, ...] | nil
) :: [[Evision.DMatch.t()]] | {:error, String.t()}

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: [[Evision.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
@spec match(t(), Evision.Mat.maybe_mat_in()) ::
  [Evision.DMatch.t()] | {:error, String.t()}
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: [Evision.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
@spec match(t(), Evision.Mat.maybe_mat_in(), [{atom(), term()}, ...] | nil) ::
  [Evision.DMatch.t()] | {:error, String.t()}
@spec match(t(), Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in()) ::
  [Evision.DMatch.t()] | {:error, String.t()}

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: [Evision.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: [Evision.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
@spec match(
  t(),
  Evision.Mat.maybe_mat_in(),
  Evision.Mat.maybe_mat_in(),
  [{atom(), term()}, ...] | nil
) ::
  [Evision.DMatch.t()] | {:error, String.t()}

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: [Evision.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
@spec radiusMatch(t(), Evision.Mat.maybe_mat_in(), number()) ::
  [[Evision.DMatch.t()]] | {:error, String.t()}
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: [[Evision.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
@spec radiusMatch(
  t(),
  Evision.Mat.maybe_mat_in(),
  number(),
  [{atom(), term()}, ...] | nil
) ::
  [[Evision.DMatch.t()]] | {:error, String.t()}
@spec radiusMatch(
  t(),
  Evision.Mat.maybe_mat_in(),
  Evision.Mat.maybe_mat_in(),
  number()
) ::
  [[Evision.DMatch.t()]] | {:error, String.t()}

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: [[Evision.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: [[Evision.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
@spec radiusMatch(
  t(),
  Evision.Mat.maybe_mat_in(),
  Evision.Mat.maybe_mat_in(),
  number(),
  [{atom(), term()}, ...] | nil
) :: [[Evision.DMatch.t()]] | {:error, String.t()}

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: [[Evision.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
@spec read(t(), Evision.FileNode.t()) :: :ok | {:error, String.t()}
@spec read(t(), binary()) :: :ok | {:error, String.t()}

Variant 1:

Positional Arguments

Python prototype (for reference):

read(arg1) -> None

Variant 2:

Positional Arguments

Python prototype (for reference):

read(fileName) -> None
@spec train(t()) :: :ok | {:error, String.t()}

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
@spec write(t(), Evision.FileStorage.t()) :: :ok | {:error, String.t()}
@spec write(t(), binary()) :: :ok | {:error, String.t()}

Variant 1:

Positional Arguments
Keyword Arguments

Python prototype (for reference):

write(fs[, name]) -> None

Variant 2:

Positional Arguments

Python prototype (for reference):

write(fileName) -> None
@spec write(t(), Evision.FileStorage.t(), [{atom(), term()}, ...] | nil) ::
  :ok | {:error, String.t()}
Positional Arguments
Keyword Arguments

Python prototype (for reference):

write(fs[, name]) -> None