BOWImgDescriptorExtractor

Objective-C

@interface BOWImgDescriptorExtractor : NSObject

Swift

class BOWImgDescriptorExtractor : NSObject

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.

Member of Features2d

Methods

  • Returns the set vocabulary.

    Declaration

    Objective-C

    - (nonnull Mat *)getVocabulary;

    Swift

    func getVocabulary() -> Mat
  • Returns an image descriptor size if the vocabulary is set. Otherwise, it returns 0.

    Declaration

    Objective-C

    - (int)descriptorSize;

    Swift

    func descriptorSize() -> Int32
  • Returns an image descriptor type.

    Declaration

    Objective-C

    - (int)descriptorType;

    Swift

    func descriptorType() -> Int32
  • Declaration

    Objective-C

    - (void)compute:(nonnull Mat *)image
            keypoints:(nonnull NSArray<KeyPoint *> *)keypoints
        imgDescriptor:(nonnull Mat *)imgDescriptor;

    Swift

    func compute2(image: Mat, keypoints: [KeyPoint], imgDescriptor: Mat)

    Parameters

    imgDescriptor

    Computed output image descriptor. pointIdxsOfClusters[i] are keypoint indices that belong to the i -th cluster (word of vocabulary) returned if it is non-zero.

  • Sets a visual vocabulary.

    Declaration

    Objective-C

    - (void)setVocabulary:(nonnull Mat *)vocabulary;

    Swift

    func setVocabulary(vocabulary: Mat)

    Parameters

    vocabulary

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