pub struct BinaryDescriptorMatcher { /* private fields */ }
Expand description

furnishes all functionalities for querying a dataset provided by user or internal to class (that user must, anyway, populate) on the model of [features2d_match]

Once descriptors have been extracted from an image (both they represent lines and points), it becomes interesting to be able to match a descriptor with another one extracted from a different image and representing the same line or point, seen from a differente perspective or on a different scale. In reaching such goal, the main headache is designing an efficient search algorithm to associate a query descriptor to one extracted from a dataset. In the following, a matching modality based on Multi-Index Hashing (MiHashing) will be described.

Multi-Index Hashing

The theory described in this section is based on MIH . Given a dataset populated with binary codes, each code is indexed m times into m different hash tables, according to m substrings it has been divided into. Thus, given a query code, all the entries close to it at least in one substring are returned by search as neighbor candidates. Returned entries are then checked for validity by verifying that their full codes are not distant (in Hamming space) more than r bits from query code. In details, each binary code h composed of b bits is divided into m disjoint substrings inline formula, each with length inline formula or inline formula bits. Formally, when two codes h and g differ by at the most r bits, in at the least one of their m substrings they differ by at the most inline formula bits. In particular, when inline formula (where inline formula is the Hamming norm), there must exist a substring k (with inline formula) such that

block formula

That means that if Hamming distance between each of the m substring is strictly greater than inline formula, then inline formula must be larger that r and that is a contradiction. If the codes in dataset are divided into m substrings, then m tables will be built. Given a query q with substrings inline formula, i-th hash table is searched for entries distant at the most inline formula from inline formula and a set of candidates inline formula is obtained. The union of sets inline formula is a superset of the r-neighbors of q. Then, last step of algorithm is computing the Hamming distance between q and each element in inline formula, deleting the codes that are distant more that r from q.

Implementations§

source§

impl BinaryDescriptorMatcher

source

pub fn create_binary_descriptor_matcher( ) -> Result<Ptr<BinaryDescriptorMatcher>>

Create a BinaryDescriptorMatcher object and return a smart pointer to it.

source

pub fn default() -> Result<BinaryDescriptorMatcher>

Constructor.

The BinaryDescriptorMatcher constructed is able to store and manage 256-bits long entries.

Trait Implementations§

source§

impl AlgorithmTrait for BinaryDescriptorMatcher

source§

fn as_raw_mut_Algorithm(&mut self) -> *mut c_void

source§

fn clear(&mut self) -> Result<()>

Clears the algorithm state
source§

fn read(&mut self, fn_: &FileNode) -> Result<()>

Reads algorithm parameters from a file storage
source§

impl AlgorithmTraitConst for BinaryDescriptorMatcher

source§

fn as_raw_Algorithm(&self) -> *const c_void

source§

fn write(&self, fs: &mut FileStorage) -> Result<()>

Stores algorithm parameters in a file storage
source§

fn write_1(&self, fs: &mut FileStorage, name: &str) -> Result<()>

Stores algorithm parameters in a file storage Read more
source§

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

@deprecated Read more
source§

fn write_with_name_def(&self, fs: &Ptr<FileStorage>) -> Result<()>

👎Deprecated:

Note

Deprecated: ## Note This alternative version of AlgorithmTraitConst::write_with_name function uses the following default values for its arguments: Read more
source§

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

Returns true if the Algorithm is empty (e.g. in the very beginning or after unsuccessful read
source§

fn save(&self, filename: &str) -> Result<()>

Saves the algorithm to a file. In order to make this method work, the derived class must implement Algorithm::write(FileStorage& fs).
source§

fn get_default_name(&self) -> Result<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.
source§

impl BinaryDescriptorMatcherTrait for BinaryDescriptorMatcher

source§

fn as_raw_mut_BinaryDescriptorMatcher(&mut self) -> *mut c_void

source§

fn match_query( &mut self, query_descriptors: &Mat, matches: &mut Vector<DMatch>, masks: &Vector<Mat> ) -> Result<()>

For every input query descriptor, retrieve the best matching one from a dataset provided from user or from the one internal to class Read more
source§

fn match_query_def( &mut self, query_descriptors: &Mat, matches: &mut Vector<DMatch> ) -> Result<()>

@overload Read more
source§

fn knn_match_query( &mut self, query_descriptors: &Mat, matches: &mut Vector<Vector<DMatch>>, k: i32, masks: &Vector<Mat>, compact_result: bool ) -> Result<()>

For every input query descriptor, retrieve the best k matching ones from a dataset provided from user or from the one internal to class Read more
source§

fn knn_match_query_def( &mut self, query_descriptors: &Mat, matches: &mut Vector<Vector<DMatch>>, k: i32 ) -> Result<()>

@overload Read more
source§

fn radius_match_1( &mut self, query_descriptors: &Mat, matches: &mut Vector<Vector<DMatch>>, max_distance: f32, masks: &Vector<Mat>, compact_result: bool ) -> Result<()>

For every input query descriptor, retrieve, from a dataset provided from user or from the one internal to class, all the descriptors that are not further than maxDist from input query Read more
source§

fn radius_match_def_1( &mut self, query_descriptors: &Mat, matches: &mut Vector<Vector<DMatch>>, max_distance: f32 ) -> Result<()>

@overload Read more
source§

fn add(&mut self, descriptors: &Vector<Mat>) -> Result<()>

Store locally new descriptors to be inserted in dataset, without updating dataset. Read more
source§

fn train(&mut self) -> Result<()>

Update dataset by inserting into it all descriptors that were stored locally by add function. Read more
source§

fn clear(&mut self) -> Result<()>

Clear dataset and internal data
source§

impl BinaryDescriptorMatcherTraitConst for BinaryDescriptorMatcher

source§

fn as_raw_BinaryDescriptorMatcher(&self) -> *const c_void

source§

fn match_( &self, query_descriptors: &Mat, train_descriptors: &Mat, matches: &mut Vector<DMatch>, mask: &Mat ) -> Result<()>

For every input query descriptor, retrieve the best matching one from a dataset provided from user or from the one internal to class Read more
source§

fn match__def( &self, query_descriptors: &Mat, train_descriptors: &Mat, matches: &mut Vector<DMatch> ) -> Result<()>

For every input query descriptor, retrieve the best matching one from a dataset provided from user or from the one internal to class Read more
source§

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

For every input query descriptor, retrieve the best k matching ones from a dataset provided from user or from the one internal to class Read more
source§

fn knn_match_def( &self, query_descriptors: &Mat, train_descriptors: &Mat, matches: &mut Vector<Vector<DMatch>>, k: i32 ) -> Result<()>

For every input query descriptor, retrieve the best k matching ones from a dataset provided from user or from the one internal to class Read more
source§

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

For every input query descriptor, retrieve, from a dataset provided from user or from the one internal to class, all the descriptors that are not further than maxDist from input query Read more
source§

fn radius_match_def( &self, query_descriptors: &Mat, train_descriptors: &Mat, matches: &mut Vector<Vector<DMatch>>, max_distance: f32 ) -> Result<()>

For every input query descriptor, retrieve, from a dataset provided from user or from the one internal to class, all the descriptors that are not further than maxDist from input query Read more
source§

impl Boxed for BinaryDescriptorMatcher

source§

unsafe fn from_raw(ptr: *mut c_void) -> Self

Wrap the specified raw pointer Read more
source§

fn into_raw(self) -> *mut c_void

Return an the underlying raw pointer while consuming this wrapper. Read more
source§

fn as_raw(&self) -> *const c_void

Return the underlying raw pointer. Read more
source§

fn as_raw_mut(&mut self) -> *mut c_void

Return the underlying mutable raw pointer Read more
source§

impl Debug for BinaryDescriptorMatcher

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Drop for BinaryDescriptorMatcher

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl From<BinaryDescriptorMatcher> for Algorithm

source§

fn from(s: BinaryDescriptorMatcher) -> Self

Converts to this type from the input type.
source§

impl Send for BinaryDescriptorMatcher

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.