[−][src]Struct opencv::line_descriptor::BinaryDescriptorMatcher
furnishes all functionalities for querying a dataset provided by user or internal to class (that user must, anyway, populate) on the model of @ref 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 , each with length or 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 bits. In particular, when (where is the Hamming norm), there must exist a substring k (with ) such that
That means that if Hamming distance between each of the m substring is strictly greater than , then 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 , i-th hash table is searched for entries distant at the most from and a set of candidates is obtained. The union of sets 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 , deleting the codes that are distant more that r from q.
Methods
impl BinaryDescriptorMatcher
[src]
pub fn as_raw_BinaryDescriptorMatcher(&self) -> *mut c_void
[src]
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self
[src]
impl BinaryDescriptorMatcher
[src]
pub fn _match(
&self,
query_descriptors: &Mat,
train_descriptors: &Mat,
matches: &mut VectorOfDMatch,
mask: &Mat
) -> Result<()>
[src]
&self,
query_descriptors: &Mat,
train_descriptors: &Mat,
matches: &mut VectorOfDMatch,
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
Parameters
- queryDescriptors: query descriptors
- trainDescriptors: dataset of descriptors furnished by user
- matches: vector to host retrieved matches
- mask: mask to select which input descriptors must be matched to one in dataset
C++ default parameters
- mask: Mat()
pub fn _match_1(
&mut self,
query_descriptors: &Mat,
matches: &mut VectorOfDMatch,
masks: &VectorOfMat
) -> Result<()>
[src]
&mut self,
query_descriptors: &Mat,
matches: &mut VectorOfDMatch,
masks: &VectorOfMat
) -> Result<()>
Parameters
- queryDescriptors: query descriptors
- matches: vector to host retrieved matches
- masks: vector of masks to select which input descriptors must be matched to one in dataset (the i-th mask in vector indicates whether each input query can be matched with descriptors in dataset relative to i-th image)
C++ default parameters
- masks: std::vector
()
pub fn knn_match(
&self,
query_descriptors: &Mat,
train_descriptors: &Mat,
matches: &mut VectorOfVectorOfDMatch,
k: i32,
mask: &Mat,
compact_result: bool
) -> Result<()>
[src]
&self,
query_descriptors: &Mat,
train_descriptors: &Mat,
matches: &mut VectorOfVectorOfDMatch,
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
Parameters
- queryDescriptors: query descriptors
- trainDescriptors: dataset of descriptors furnished by user
- matches: vector to host retrieved matches
- k: number of the closest descriptors to be returned for every input query
- mask: mask to select which input descriptors must be matched to ones in dataset
- compactResult: flag to obtain a compact result (if true, a vector that doesn't contain any matches for a given query is not inserted in final result)
C++ default parameters
- mask: Mat()
- compact_result: false
pub fn knn_match_1(
&mut self,
query_descriptors: &Mat,
matches: &mut VectorOfVectorOfDMatch,
k: i32,
masks: &VectorOfMat,
compact_result: bool
) -> Result<()>
[src]
&mut self,
query_descriptors: &Mat,
matches: &mut VectorOfVectorOfDMatch,
k: i32,
masks: &VectorOfMat,
compact_result: bool
) -> Result<()>
Parameters
- queryDescriptors: query descriptors
- matches: vector to host retrieved matches
- k: number of the closest descriptors to be returned for every input query
- masks: vector of masks to select which input descriptors must be matched to ones in dataset (the i-th mask in vector indicates whether each input query can be matched with descriptors in dataset relative to i-th image)
- compactResult: flag to obtain a compact result (if true, a vector that doesn't contain any matches for a given query is not inserted in final result)
C++ default parameters
- masks: std::vector
() - compact_result: false
pub fn radius_match(
&self,
query_descriptors: &Mat,
train_descriptors: &Mat,
matches: &mut VectorOfVectorOfDMatch,
max_distance: f32,
mask: &Mat,
compact_result: bool
) -> Result<()>
[src]
&self,
query_descriptors: &Mat,
train_descriptors: &Mat,
matches: &mut VectorOfVectorOfDMatch,
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
Parameters
- queryDescriptors: query descriptors
- trainDescriptors: dataset of descriptors furnished by user
- matches: vector to host retrieved matches
- maxDistance: search radius
- mask: mask to select which input descriptors must be matched to ones in dataset
- compactResult: flag to obtain a compact result (if true, a vector that doesn't contain any matches for a given query is not inserted in final result)
C++ default parameters
- mask: Mat()
- compact_result: false
pub fn radius_match_1(
&mut self,
query_descriptors: &Mat,
matches: &mut VectorOfVectorOfDMatch,
max_distance: f32,
masks: &VectorOfMat,
compact_result: bool
) -> Result<()>
[src]
&mut self,
query_descriptors: &Mat,
matches: &mut VectorOfVectorOfDMatch,
max_distance: f32,
masks: &VectorOfMat,
compact_result: bool
) -> Result<()>
Parameters
- queryDescriptors: query descriptors
- matches: vector to host retrieved matches
- maxDistance: search radius
- masks: vector of masks to select which input descriptors must be matched to ones in dataset (the i-th mask in vector indicates whether each input query can be matched with descriptors in dataset relative to i-th image)
- compactResult: flag to obtain a compact result (if true, a vector that doesn't contain any matches for a given query is not inserted in final result)
C++ default parameters
- masks: std::vector
() - compact_result: false
pub fn add(&mut self, descriptors: &VectorOfMat) -> Result<()>
[src]
Store locally new descriptors to be inserted in dataset, without updating dataset.
Parameters
- descriptors: matrices containing descriptors to be inserted into dataset
Note: Each matrix i in descriptors should contain descriptors relative to lines extracted from i-th image.
pub fn train(&mut self) -> Result<()>
[src]
Update dataset by inserting into it all descriptors that were stored locally by add function.
Note: Every time this function is invoked, current dataset is deleted and locally stored descriptors are inserted into dataset. The locally stored copy of just inserted descriptors is then removed.
pub fn create_binary_descriptor_matcher(
) -> Result<PtrOfBinaryDescriptorMatcher>
[src]
) -> Result<PtrOfBinaryDescriptorMatcher>
Create a BinaryDescriptorMatcher object and return a smart pointer to it.
pub fn clear(&mut self) -> Result<()>
[src]
Clear dataset and internal data
pub fn default() -> Result<BinaryDescriptorMatcher>
[src]
Constructor.
The BinaryDescriptorMatcher constructed is able to store and manage 256-bits long entries.
Trait Implementations
impl AlgorithmTrait for BinaryDescriptorMatcher
[src]
fn as_raw_Algorithm(&self) -> *mut c_void
[src]
fn clear(&mut self) -> Result<()>
[src]
fn write(&self, fs: &mut FileStorage) -> Result<()>
[src]
fn write_1(&self, fs: &PtrOfFileStorage, name: &str) -> Result<()>
[src]
fn read(&mut self, _fn: &FileNode) -> Result<()>
[src]
fn empty(&self) -> Result<bool>
[src]
fn save(&self, filename: &str) -> Result<()>
[src]
fn get_default_name(&self) -> Result<String>
[src]
impl Drop for BinaryDescriptorMatcher
[src]
impl Send for BinaryDescriptorMatcher
[src]
Auto Trait Implementations
impl RefUnwindSafe for BinaryDescriptorMatcher
impl !Sync for BinaryDescriptorMatcher
impl Unpin for BinaryDescriptorMatcher
impl UnwindSafe for BinaryDescriptorMatcher
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,