[][src]Trait opencv::prelude::DescriptorMatcher

pub trait DescriptorMatcher: AlgorithmTrait {
    pub fn as_raw_DescriptorMatcher(&self) -> *const c_void;
pub fn as_raw_mut_DescriptorMatcher(&mut self) -> *mut c_void; pub fn add(&mut self, descriptors: &dyn ToInputArray) -> Result<()> { ... }
pub fn get_train_descriptors(&self) -> Result<Vector<Mat>> { ... }
pub fn clear(&mut self) -> Result<()> { ... }
pub fn empty(&self) -> Result<bool> { ... }
pub fn is_mask_supported(&self) -> Result<bool> { ... }
pub fn train(&mut self) -> Result<()> { ... }
pub fn train_match(
        &self,
        query_descriptors: &dyn ToInputArray,
        train_descriptors: &dyn ToInputArray,
        matches: &mut Vector<DMatch>,
        mask: &dyn ToInputArray
    ) -> Result<()> { ... }
pub fn knn_train_match(
        &self,
        query_descriptors: &dyn ToInputArray,
        train_descriptors: &dyn ToInputArray,
        matches: &mut Vector<Vector<DMatch>>,
        k: i32,
        mask: &dyn ToInputArray,
        compact_result: bool
    ) -> Result<()> { ... }
pub fn radius_train_match(
        &self,
        query_descriptors: &dyn ToInputArray,
        train_descriptors: &dyn ToInputArray,
        matches: &mut Vector<Vector<DMatch>>,
        max_distance: f32,
        mask: &dyn ToInputArray,
        compact_result: bool
    ) -> Result<()> { ... }
pub fn match_(
        &mut self,
        query_descriptors: &dyn ToInputArray,
        matches: &mut Vector<DMatch>,
        masks: &dyn ToInputArray
    ) -> Result<()> { ... }
pub fn knn_match(
        &mut self,
        query_descriptors: &dyn ToInputArray,
        matches: &mut Vector<Vector<DMatch>>,
        k: i32,
        masks: &dyn ToInputArray,
        compact_result: bool
    ) -> Result<()> { ... }
pub fn radius_match(
        &mut self,
        query_descriptors: &dyn ToInputArray,
        matches: &mut Vector<Vector<DMatch>>,
        max_distance: f32,
        masks: &dyn ToInputArray,
        compact_result: bool
    ) -> Result<()> { ... }
pub fn write(&self, file_name: &str) -> Result<()> { ... }
pub fn read(&mut self, file_name: &str) -> Result<()> { ... }
pub fn read_1(&mut self, unnamed: &FileNode) -> Result<()> { ... }
pub fn write_1(&self, unnamed: &mut FileStorage) -> Result<()> { ... }
pub fn clone(
        &self,
        empty_train_data: bool
    ) -> Result<Ptr<dyn DescriptorMatcher>> { ... }
pub fn write_2(&self, fs: &Ptr<FileStorage>, name: &str) -> Result<()> { ... } }

Abstract base class for matching keypoint descriptors.

It has two groups of match methods: for matching descriptors of an image with another image or with an image set.

Required methods

Loading content...

Provided methods

pub fn add(&mut self, descriptors: &dyn ToInputArray) -> Result<()>[src]

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

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

Parameters

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

pub fn get_train_descriptors(&self) -> Result<Vector<Mat>>[src]

Returns a constant link to the train descriptor collection trainDescCollection .

pub fn clear(&mut self) -> Result<()>[src]

Clears the train descriptor collections.

pub fn empty(&self) -> Result<bool>[src]

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

pub fn is_mask_supported(&self) -> Result<bool>[src]

Returns true if the descriptor matcher supports masking permissible matches.

pub fn train(&mut self) -> Result<()>[src]

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 ).

pub fn train_match(
    &self,
    query_descriptors: &dyn ToInputArray,
    train_descriptors: &dyn ToInputArray,
    matches: &mut Vector<DMatch>,
    mask: &dyn ToInputArray
) -> Result<()>
[src]

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

Parameters

  • queryDescriptors: Query set of descriptors.
  • trainDescriptors: Train set of descriptors. This set is not added to the train descriptors collection stored in the class object.
  • matches: 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.
  • mask: Mask specifying permissible matches between an input query and train matrices of descriptors.

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.

C++ default parameters

  • mask: noArray()

pub fn knn_train_match(
    &self,
    query_descriptors: &dyn ToInputArray,
    train_descriptors: &dyn ToInputArray,
    matches: &mut Vector<Vector<DMatch>>,
    k: i32,
    mask: &dyn ToInputArray,
    compact_result: bool
) -> Result<()>
[src]

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

Parameters

  • queryDescriptors: Query set of descriptors.
  • trainDescriptors: Train set of descriptors. This set is not added to the train descriptors collection stored in the class object.
  • mask: Mask specifying permissible matches between an input query and train matrices of descriptors.
  • matches: Matches. Each matches[i] is k or less matches for the same query descriptor.
  • k: Count of best matches found per each query descriptor or less if a query descriptor has less than k possible matches in total.
  • compactResult: 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.

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.

C++ default parameters

  • mask: noArray()
  • compact_result: false

pub fn radius_train_match(
    &self,
    query_descriptors: &dyn ToInputArray,
    train_descriptors: &dyn ToInputArray,
    matches: &mut Vector<Vector<DMatch>>,
    max_distance: f32,
    mask: &dyn ToInputArray,
    compact_result: bool
) -> Result<()>
[src]

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

Parameters

  • queryDescriptors: Query set of descriptors.
  • trainDescriptors: Train set of descriptors. This set is not added to the train descriptors collection stored in the class object.
  • matches: Found matches.
  • compactResult: 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.
  • maxDistance: 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)!
  • mask: Mask specifying permissible matches between an input query and train matrices of descriptors.

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.

C++ default parameters

  • mask: noArray()
  • compact_result: false

pub fn match_(
    &mut self,
    query_descriptors: &dyn ToInputArray,
    matches: &mut Vector<DMatch>,
    masks: &dyn ToInputArray
) -> Result<()>
[src]

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

Parameters

  • queryDescriptors: Query set of descriptors.
  • trainDescriptors: Train set of descriptors. This set is not added to the train descriptors collection stored in the class object.
  • matches: 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.
  • mask: Mask specifying permissible matches between an input query and train matrices of descriptors.

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.

Overloaded parameters

  • queryDescriptors: Query set of descriptors.
  • matches: 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.
  • masks: 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].

C++ default parameters

  • masks: noArray()

pub fn knn_match(
    &mut self,
    query_descriptors: &dyn ToInputArray,
    matches: &mut Vector<Vector<DMatch>>,
    k: i32,
    masks: &dyn ToInputArray,
    compact_result: bool
) -> Result<()>
[src]

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

Parameters

  • queryDescriptors: Query set of descriptors.
  • trainDescriptors: Train set of descriptors. This set is not added to the train descriptors collection stored in the class object.
  • mask: Mask specifying permissible matches between an input query and train matrices of descriptors.
  • matches: Matches. Each matches[i] is k or less matches for the same query descriptor.
  • k: Count of best matches found per each query descriptor or less if a query descriptor has less than k possible matches in total.
  • compactResult: 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.

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.

Overloaded parameters

  • queryDescriptors: Query set of descriptors.
  • matches: Matches. Each matches[i] is k or less matches for the same query descriptor.
  • k: Count of best matches found per each query descriptor or less if a query descriptor has less than k possible matches in total.
  • masks: 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: 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.

C++ default parameters

  • masks: noArray()
  • compact_result: false

pub fn radius_match(
    &mut self,
    query_descriptors: &dyn ToInputArray,
    matches: &mut Vector<Vector<DMatch>>,
    max_distance: f32,
    masks: &dyn ToInputArray,
    compact_result: bool
) -> Result<()>
[src]

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

Parameters

  • queryDescriptors: Query set of descriptors.
  • trainDescriptors: Train set of descriptors. This set is not added to the train descriptors collection stored in the class object.
  • matches: Found matches.
  • compactResult: 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.
  • maxDistance: 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)!
  • mask: Mask specifying permissible matches between an input query and train matrices of descriptors.

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.

Overloaded parameters

  • queryDescriptors: Query set of descriptors.
  • matches: Found matches.
  • maxDistance: 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)!
  • masks: 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: 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.

C++ default parameters

  • masks: noArray()
  • compact_result: false

pub fn write(&self, file_name: &str) -> Result<()>[src]

pub fn read(&mut self, file_name: &str) -> Result<()>[src]

pub fn read_1(&mut self, unnamed: &FileNode) -> Result<()>[src]

pub fn write_1(&self, unnamed: &mut FileStorage) -> Result<()>[src]

pub fn clone(
    &self,
    empty_train_data: bool
) -> Result<Ptr<dyn DescriptorMatcher>>
[src]

Clones the matcher.

Parameters

  • emptyTrainData: 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.

C++ default parameters

  • empty_train_data: false

pub fn write_2(&self, fs: &Ptr<FileStorage>, name: &str) -> Result<()>[src]

C++ default parameters

  • name: String()
Loading content...

Implementations

impl<'_> dyn DescriptorMatcher + '_[src]

pub fn create(
    descriptor_matcher_type: &str
) -> Result<Ptr<dyn DescriptorMatcher>>
[src]

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

Parameters

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

pub fn create_with_matcher_type(
    matcher_type: DescriptorMatcher_MatcherType
) -> Result<Ptr<dyn DescriptorMatcher>>
[src]

Implementors

Loading content...