View Source Evision.DescriptorMatcher (Evision v0.2.9)
Summary
Functions
Adds descriptors to train a CPU(trainDescCollectionis) or GPU(utrainDescCollectionis) descriptor collection.
Clears the train descriptor collections.
Clones the matcher.
Clones the matcher.
Variant 1:
create
Returns true if there are no train descriptors in the both collections.
getDefaultName
Returns a constant link to the train descriptor collection trainDescCollection .
Returns true if the descriptor matcher supports masking permissible matches.
knnMatch
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.
Variant 1:
Finds the best match for each descriptor from a query set.
Finds the best match for each descriptor from a query set.
radiusMatch
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:
read
save
Trains a descriptor matcher
write
write
Types
@type t() :: %Evision.DescriptorMatcher{ref: reference()}
Type that represents an DescriptorMatcher
struct.
ref.
reference()
The underlying erlang resource variable.
Functions
@spec add(t(), [Evision.Mat.maybe_mat_in()]) :: t() | {:error, String.t()}
Adds descriptors to train a CPU(trainDescCollectionis) or GPU(utrainDescCollectionis) descriptor collection.
Positional Arguments
self:
Evision.DescriptorMatcher.t()
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 only):
add(descriptors) -> None
@spec clear(Keyword.t()) :: any() | {:error, String.t()}
@spec clear(t()) :: t() | {:error, String.t()}
Clears the train descriptor collections.
Positional Arguments
- self:
Evision.DescriptorMatcher.t()
Python prototype (for reference only):
clear() -> None
@spec clone(Keyword.t()) :: any() | {:error, String.t()}
@spec clone(t()) :: t() | {:error, String.t()}
Clones the matcher.
Positional Arguments
- self:
Evision.DescriptorMatcher.t()
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
- retval:
Evision.DescriptorMatcher.t()
Python prototype (for reference only):
clone([, emptyTrainData]) -> retval
Clones the matcher.
Positional Arguments
- self:
Evision.DescriptorMatcher.t()
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
- retval:
Evision.DescriptorMatcher.t()
Python prototype (for reference only):
clone([, emptyTrainData]) -> retval
@spec create(Keyword.t()) :: any() | {:error, String.t()}
@spec create(integer()) :: t() | {:error, String.t()}
@spec create(binary()) :: t() | {:error, String.t()}
Variant 1:
create
Positional Arguments
- matcherType:
DescriptorMatcher_MatcherType
Return
- retval:
Evision.DescriptorMatcher.t()
Python prototype (for reference only):
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
Return
- retval:
Evision.DescriptorMatcher.t()
Python prototype (for reference only):
create(descriptorMatcherType) -> retval
@spec empty(Keyword.t()) :: any() | {:error, String.t()}
@spec empty(t()) :: boolean() | {:error, String.t()}
Returns true if there are no train descriptors in the both collections.
Positional Arguments
- self:
Evision.DescriptorMatcher.t()
Return
- retval:
bool
Python prototype (for reference only):
empty() -> retval
@spec getDefaultName(Keyword.t()) :: any() | {:error, String.t()}
@spec getDefaultName(t()) :: binary() | {:error, String.t()}
getDefaultName
Positional Arguments
- self:
Evision.DescriptorMatcher.t()
Return
- retval:
String
Returns the algorithm string identifier. This string is used as top level xml/yml node tag when the object is saved to a file or string.
Python prototype (for reference only):
getDefaultName() -> retval
@spec getTrainDescriptors(Keyword.t()) :: any() | {:error, String.t()}
@spec getTrainDescriptors(t()) :: [Evision.Mat.t()] | {:error, String.t()}
Returns a constant link to the train descriptor collection trainDescCollection .
Positional Arguments
- self:
Evision.DescriptorMatcher.t()
Return
- retval:
[Evision.Mat]
Python prototype (for reference only):
getTrainDescriptors() -> retval
@spec isMaskSupported(Keyword.t()) :: any() | {:error, String.t()}
@spec isMaskSupported(t()) :: boolean() | {:error, String.t()}
Returns true if the descriptor matcher supports masking permissible matches.
Positional Arguments
- self:
Evision.DescriptorMatcher.t()
Return
- retval:
bool
Python prototype (for reference only):
isMaskSupported() -> retval
@spec knnMatch(t(), Evision.Mat.maybe_mat_in(), integer()) :: [[Evision.DMatch.t()]] | {:error, String.t()}
knnMatch
Positional Arguments
self:
Evision.DescriptorMatcher.t()
queryDescriptors:
Evision.Mat
.Query set of descriptors.
k:
integer()
.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 only):
knnMatch(queryDescriptors, k[, masks[, compactResult]]) -> matches
@spec knnMatch( t(), Evision.Mat.maybe_mat_in(), integer(), [compactResult: term(), masks: 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
self:
Evision.DescriptorMatcher.t()
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:
integer()
.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 only):
knnMatch(queryDescriptors, trainDescriptors, k[, mask[, compactResult]]) -> matches
Variant 2:
knnMatch
Positional Arguments
self:
Evision.DescriptorMatcher.t()
queryDescriptors:
Evision.Mat
.Query set of descriptors.
k:
integer()
.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 only):
knnMatch(queryDescriptors, k[, masks[, compactResult]]) -> matches
@spec knnMatch( t(), Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in(), integer(), [compactResult: term(), mask: term()] | nil ) :: [[Evision.DMatch.t()]] | {:error, String.t()}
Finds the k best matches for each descriptor from a query set.
Positional Arguments
self:
Evision.DescriptorMatcher.t()
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:
integer()
.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 only):
knnMatch(queryDescriptors, trainDescriptors, k[, mask[, compactResult]]) -> matches
@spec match(t(), Evision.Mat.maybe_mat_in()) :: [Evision.DMatch.t()] | {:error, String.t()}
match
Positional Arguments
self:
Evision.DescriptorMatcher.t()
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 only):
match(queryDescriptors[, masks]) -> matches
@spec match(t(), Evision.Mat.maybe_mat_in(), [{:masks, 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
self:
Evision.DescriptorMatcher.t()
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 only):
match(queryDescriptors, trainDescriptors[, mask]) -> matches
Variant 2:
match
Positional Arguments
self:
Evision.DescriptorMatcher.t()
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 only):
match(queryDescriptors[, masks]) -> matches
@spec match( t(), Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in(), [{:mask, term()}] | nil ) :: [Evision.DMatch.t()] | {:error, String.t()}
Finds the best match for each descriptor from a query set.
Positional Arguments
self:
Evision.DescriptorMatcher.t()
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 only):
match(queryDescriptors, trainDescriptors[, mask]) -> matches
@spec radiusMatch(t(), Evision.Mat.maybe_mat_in(), number()) :: [[Evision.DMatch.t()]] | {:error, String.t()}
radiusMatch
Positional Arguments
self:
Evision.DescriptorMatcher.t()
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 only):
radiusMatch(queryDescriptors, maxDistance[, masks[, compactResult]]) -> matches
@spec radiusMatch( t(), Evision.Mat.maybe_mat_in(), number(), [compactResult: term(), masks: 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
self:
Evision.DescriptorMatcher.t()
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 only):
radiusMatch(queryDescriptors, trainDescriptors, maxDistance[, mask[, compactResult]]) -> matches
Variant 2:
radiusMatch
Positional Arguments
self:
Evision.DescriptorMatcher.t()
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 only):
radiusMatch(queryDescriptors, maxDistance[, masks[, compactResult]]) -> matches
radiusMatch(self, queryDescriptors, trainDescriptors, maxDistance, opts)
View Source@spec radiusMatch( t(), Evision.Mat.maybe_mat_in(), Evision.Mat.maybe_mat_in(), number(), [compactResult: term(), mask: term()] | nil ) :: [[Evision.DMatch.t()]] | {:error, String.t()}
For each query descriptor, finds the training descriptors not farther than the specified distance.
Positional Arguments
self:
Evision.DescriptorMatcher.t()
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 only):
radiusMatch(queryDescriptors, trainDescriptors, maxDistance[, mask[, compactResult]]) -> matches
@spec read(t(), Evision.FileNode.t()) :: t() | {:error, String.t()}
@spec read(t(), binary()) :: t() | {:error, String.t()}
Variant 1:
read
Positional Arguments
- self:
Evision.DescriptorMatcher.t()
- arg1:
Evision.FileNode
Python prototype (for reference only):
read(arg1) -> None
Variant 2:
read
Positional Arguments
- self:
Evision.DescriptorMatcher.t()
- fileName:
String
Python prototype (for reference only):
read(fileName) -> None
save
Positional Arguments
- self:
Evision.DescriptorMatcher.t()
- filename:
String
Saves the algorithm to a file. In order to make this method work, the derived class must implement Algorithm::write(FileStorage& fs).
Python prototype (for reference only):
save(filename) -> None
@spec train(Keyword.t()) :: any() | {:error, String.t()}
@spec train(t()) :: t() | {:error, String.t()}
Trains a descriptor matcher
Positional Arguments
- self:
Evision.DescriptorMatcher.t()
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 only):
train() -> None
write
Positional Arguments
- self:
Evision.DescriptorMatcher.t()
- fileName:
String
Python prototype (for reference only):
write(fileName) -> None
@spec write(t(), Evision.FileStorage.t(), binary()) :: t() | {:error, String.t()}
write
Positional Arguments
- self:
Evision.DescriptorMatcher.t()
- fs:
Evision.FileStorage
- name:
String
Python prototype (for reference only):
write(fs, name) -> None