Package org.opencv.features2d
Class BOWImgDescriptorExtractor
java.lang.Object
org.opencv.features2d.BOWImgDescriptorExtractor
public class BOWImgDescriptorExtractor extends Object
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.
-
Field Summary
Fields Modifier and Type Field Description protected longnativeObj -
Constructor Summary
Constructors Modifier Constructor Description protectedBOWImgDescriptorExtractor(long addr) -
Method Summary
Modifier and Type Method Description static BOWImgDescriptorExtractor__fromPtr__(long addr)voidcompute(Mat image, MatOfKeyPoint keypoints, Mat imgDescriptor)intdescriptorSize()Returns an image descriptor size if the vocabulary is set.intdescriptorType()Returns an image descriptor type.protected voidfinalize()longgetNativeObjAddr()MatgetVocabulary()Returns the set vocabulary.voidsetVocabulary(Mat vocabulary)Sets a visual vocabulary.
-
Field Details
-
Constructor Details
-
Method Details
-
getNativeObjAddr
-
__fromPtr__
-
setVocabulary
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).
-
getVocabulary
Returns the set vocabulary.- Returns:
- automatically generated
-
compute
- 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.image- automatically generatedkeypoints- automatically generated
-
descriptorSize
Returns an image descriptor size if the vocabulary is set. Otherwise, it returns 0.- Returns:
- automatically generated
-
descriptorType
Returns an image descriptor type.- Returns:
- automatically generated
-
finalize
-