Package org.opencv.xfeatures2d
Class BOWImgDescriptorExtractor
- java.lang.Object
-
- org.opencv.xfeatures2d.BOWImgDescriptorExtractor
-
public class BOWImgDescriptorExtractor extends java.lang.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 long
nativeObj
-
Constructor Summary
Constructors Modifier Constructor Description protected
BOWImgDescriptorExtractor(long addr)
BOWImgDescriptorExtractor(Feature2D dextractor, DescriptorMatcher dmatcher)
The constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static BOWImgDescriptorExtractor
__fromPtr__(long addr)
void
compute(Mat image, MatOfKeyPoint keypoints, Mat imgDescriptor)
int
descriptorSize()
Returns an image descriptor size if the vocabulary is set.int
descriptorType()
Returns an image descriptor type.protected void
finalize()
long
getNativeObjAddr()
Mat
getVocabulary()
Returns the set vocabulary.void
setVocabulary(Mat vocabulary)
Sets a visual vocabulary.
-
-
-
Constructor Detail
-
BOWImgDescriptorExtractor
protected BOWImgDescriptorExtractor(long addr)
-
BOWImgDescriptorExtractor
public BOWImgDescriptorExtractor(Feature2D dextractor, DescriptorMatcher dmatcher)
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.
-
-
Method Detail
-
getNativeObjAddr
public long getNativeObjAddr()
-
__fromPtr__
public static BOWImgDescriptorExtractor __fromPtr__(long addr)
-
setVocabulary
public void setVocabulary(Mat vocabulary)
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
public Mat getVocabulary()
Returns the set vocabulary.- Returns:
- automatically generated
-
compute
public void compute(Mat image, MatOfKeyPoint keypoints, Mat imgDescriptor)
- 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
public int descriptorSize()
Returns an image descriptor size if the vocabulary is set. Otherwise, it returns 0.- Returns:
- automatically generated
-
descriptorType
public int descriptorType()
Returns an image descriptor type.- Returns:
- automatically generated
-
finalize
protected void finalize() throws java.lang.Throwable
- Overrides:
finalize
in classjava.lang.Object
- Throws:
java.lang.Throwable
-
-