Skip to content

xfeatures2d_BOWImgDescriptorExtractor

xfeatures2dclassOpenCV 5.0.0
import { xfeatures2d_BOWImgDescriptorExtractor } from '@banou/opencv-wasm'

Use after await initOpenCV(). See the initialization and named imports guide.

ARGUMENTSConstructor or factory
CLASSxfeatures2d_BOWImgDescriptorExtractor
RETURN TYPEOwned native handle
Call structure. A void return can still write to destination arguments. The parameter descriptions define inputs, outputs and ownership.

Native object: release it with using or delete(). Factories can return null; check before calling methods.

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.

Constructors and members

static new

The constructor.

new(dextractor: Feature2D | null, dmatcher: DescriptorMatcher | null): xfeatures2d_BOWImgDescriptorExtractor;
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.

Returns

The xfeatures2d_BOWImgDescriptorExtractor result.

clone

Create another handle to the same native object. This retains the object without copying its pixels or algorithm state; dispose both handles separately.

clone(): this;
Returns

The this result.

setVocabulary

Sets a visual vocabulary.

setVocabulary(vocabulary: Mat): void;
vocabulary

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

getVocabulary

Returns the set vocabulary.

getVocabulary(): Mat;
Returns

The Mat result. Release returned native handles with using or delete(), including handles nested in results.

compute

compute() is not constant because DescriptorMatcher::match is not constant

compute(image: Mat, keypoints: KeyPointVector, imgDescriptor: Mat): void;
image

image argument (Mat).

keypoints

keypoints argument (KeyPointVector).

imgDescriptor

Output destination, filled by the native operation. img descriptor argument (Mat).

descriptorSize

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

descriptorSize(): number;
Returns

The number result.

descriptorType

Returns an image descriptor type.

descriptorType(): number;
Returns

The number result.

These signatures describe this package. Upstream documentation can mention optional backends that are absent from this build. Check runtime compatibility before choosing a backend or file format.