[][src]Struct opencv::features2d::BOWImgDescriptorExtractor

pub struct BOWImgDescriptorExtractor { /* fields omitted */ }

Class to compute an image descriptor using the bag of visual words.

Such a computation consists of the following steps:

  1. Compute descriptors for a given image and its keypoints set.
  2. Find the nearest visual words from the vocabulary for each keypoint descriptor.
  3. Compute the bag-of-words image descriptor as is a normalized histogram of vocabulary words encountered in the image. The i-th bin of the histogram is a frequency of i-th word of the vocabulary in the given image.

Methods

impl BOWImgDescriptorExtractor[src]

impl BOWImgDescriptorExtractor[src]

pub fn new_with_dextractor(
    dextractor: &PtrOfFeature2D,
    dmatcher: &PtrOfDescriptorMatcher
) -> Result<BOWImgDescriptorExtractor>
[src]

The constructor.

Parameters

  • dextractor: Descriptor extractor that is used to compute descriptors for an input image and its keypoints.
  • dmatcher: Descriptor matcher that is used to find the nearest word of the trained vocabulary for each keypoint descriptor of the image.

pub fn new(
    dmatcher: &PtrOfDescriptorMatcher
) -> Result<BOWImgDescriptorExtractor>
[src]

pub fn set_vocabulary(&mut self, vocabulary: &Mat) -> Result<()>[src]

Sets a visual vocabulary.

Parameters

  • vocabulary: Vocabulary (can be trained using the inheritor of BOWTrainer ). Each row of the vocabulary is a visual word (cluster center).

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

Returns the set vocabulary.

pub fn compute_desc(
    &mut self,
    image: &dyn ToInputArray,
    keypoints: &mut VectorOfKeyPoint,
    img_descriptor: &mut dyn ToOutputArray,
    point_idxs_of_clusters: &mut VectorOfVectorOfint,
    descriptors: &mut Mat
) -> Result<()>
[src]

Computes an image descriptor using the set visual vocabulary.

Parameters

  • image: Image, for which the descriptor is computed.
  • keypoints: Keypoints detected in the input image.
  • imgDescriptor: Computed output image descriptor.
  • pointIdxsOfClusters: Indices of keypoints that belong to the cluster. This means that pointIdxsOfClusters[i] are keypoint indices that belong to the i -th cluster (word of vocabulary) returned if it is non-zero.
  • descriptors: Descriptors of the image keypoints that are returned if they are non-zero.

C++ default parameters

  • point_idxs_of_clusters: 0
  • descriptors: 0

pub fn compute(
    &mut self,
    keypoint_descriptors: &dyn ToInputArray,
    img_descriptor: &mut dyn ToOutputArray,
    point_idxs_of_clusters: &mut VectorOfVectorOfint
) -> Result<()>
[src]

Parameters

  • keypointDescriptors: Computed descriptors to match with vocabulary.
  • imgDescriptor: Computed output image descriptor.
  • pointIdxsOfClusters: Indices of keypoints that belong to the cluster. This means that pointIdxsOfClusters[i] are keypoint indices that belong to the i -th cluster (word of vocabulary) returned if it is non-zero.

C++ default parameters

  • point_idxs_of_clusters: 0

pub fn compute2(
    &mut self,
    image: &Mat,
    keypoints: &mut VectorOfKeyPoint,
    img_descriptor: &mut Mat
) -> Result<()>
[src]

pub fn descriptor_size(&self) -> Result<i32>[src]

Returns an image descriptor size if the vocabulary is set. Otherwise, it returns 0.

pub fn descriptor_type(&self) -> Result<i32>[src]

Returns an image descriptor type.

Trait Implementations

impl Send for BOWImgDescriptorExtractor[src]

impl Drop for BOWImgDescriptorExtractor[src]

Auto Trait Implementations

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]