Trait DescriptorMatcherTraitConst

Source
pub trait DescriptorMatcherTraitConst: AlgorithmTraitConst {
Show 16 methods // Required method fn as_raw_DescriptorMatcher(&self) -> *const c_void; // Provided methods fn get_train_descriptors(&self) -> Result<Vector<Mat>> { ... } fn empty(&self) -> Result<bool> { ... } fn is_mask_supported(&self) -> Result<bool> { ... } fn train_match( &self, query_descriptors: &impl ToInputArray, train_descriptors: &impl ToInputArray, matches: &mut Vector<DMatch>, mask: &impl ToInputArray, ) -> Result<()> { ... } fn train_match_def( &self, query_descriptors: &impl ToInputArray, train_descriptors: &impl ToInputArray, matches: &mut Vector<DMatch>, ) -> Result<()> { ... } fn knn_train_match( &self, query_descriptors: &impl ToInputArray, train_descriptors: &impl ToInputArray, matches: &mut Vector<Vector<DMatch>>, k: i32, mask: &impl ToInputArray, compact_result: bool, ) -> Result<()> { ... } fn knn_train_match_def( &self, query_descriptors: &impl ToInputArray, train_descriptors: &impl ToInputArray, matches: &mut Vector<Vector<DMatch>>, k: i32, ) -> Result<()> { ... } fn radius_train_match( &self, query_descriptors: &impl ToInputArray, train_descriptors: &impl ToInputArray, matches: &mut Vector<Vector<DMatch>>, max_distance: f32, mask: &impl ToInputArray, compact_result: bool, ) -> Result<()> { ... } fn radius_train_match_def( &self, query_descriptors: &impl ToInputArray, train_descriptors: &impl ToInputArray, matches: &mut Vector<Vector<DMatch>>, max_distance: f32, ) -> Result<()> { ... } fn write(&self, file_name: &str) -> Result<()> { ... } fn write_to_storage( &self, unnamed: &mut impl FileStorageTrait, ) -> Result<()> { ... } fn clone(&self, empty_train_data: bool) -> Result<Ptr<DescriptorMatcher>> { ... } fn clone_def(&self) -> Result<Ptr<DescriptorMatcher>> { ... } fn write_to_storage_with_name( &self, fs: &mut impl FileStorageTrait, name: &str, ) -> Result<()> { ... } fn write_to_storage_ptr_with_name( &self, fs: &Ptr<FileStorage>, name: &str, ) -> Result<()> { ... }
}
Expand description

Required Methods§

Provided Methods§

Source

fn get_train_descriptors(&self) -> Result<Vector<Mat>>

Returns a constant link to the train descriptor collection trainDescCollection .

Source

fn empty(&self) -> Result<bool>

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

Source

fn is_mask_supported(&self) -> Result<bool>

Returns true if the descriptor matcher supports masking permissible matches.

Source

fn train_match( &self, query_descriptors: &impl ToInputArray, train_descriptors: &impl ToInputArray, matches: &mut Vector<DMatch>, mask: &impl ToInputArray, ) -> Result<()>

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()
Source

fn train_match_def( &self, query_descriptors: &impl ToInputArray, train_descriptors: &impl ToInputArray, matches: &mut Vector<DMatch>, ) -> Result<()>

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.

§Note

This alternative version of DescriptorMatcherTraitConst::train_match function uses the following default values for its arguments:

  • mask: noArray()
Source

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

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
Source

fn knn_train_match_def( &self, query_descriptors: &impl ToInputArray, train_descriptors: &impl ToInputArray, matches: &mut Vector<Vector<DMatch>>, k: i32, ) -> Result<()>

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.

§Note

This alternative version of DescriptorMatcherTraitConst::knn_train_match function uses the following default values for its arguments:

  • mask: noArray()
  • compact_result: false
Source

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

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
Source

fn radius_train_match_def( &self, query_descriptors: &impl ToInputArray, train_descriptors: &impl ToInputArray, matches: &mut Vector<Vector<DMatch>>, max_distance: f32, ) -> Result<()>

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.

§Note

This alternative version of DescriptorMatcherTraitConst::radius_train_match function uses the following default values for its arguments:

  • mask: noArray()
  • compact_result: false
Source

fn write(&self, file_name: &str) -> Result<()>

Source

fn write_to_storage(&self, unnamed: &mut impl FileStorageTrait) -> Result<()>

Source

fn clone(&self, empty_train_data: bool) -> Result<Ptr<DescriptorMatcher>>

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
Source

fn clone_def(&self) -> Result<Ptr<DescriptorMatcher>>

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.
§Note

This alternative version of DescriptorMatcherTraitConst::clone function uses the following default values for its arguments:

  • empty_train_data: false
Source

fn write_to_storage_with_name( &self, fs: &mut impl FileStorageTrait, name: &str, ) -> Result<()>

Source

fn write_to_storage_ptr_with_name( &self, fs: &Ptr<FileStorage>, name: &str, ) -> Result<()>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§