001// 002// This file is auto-generated. Please don't modify it! 003// 004package org.opencv.features2d; 005 006import java.util.ArrayList; 007import java.util.List; 008import org.opencv.core.Mat; 009import org.opencv.core.MatOfKeyPoint; 010import org.opencv.utils.Converters; 011 012// C++: class BOWImgDescriptorExtractor 013/** 014 * Class to compute an image descriptor using the *bag of visual words*. 015 * 016 * Such a computation consists of the following steps: 017 * 018 * 1. Compute descriptors for a given image and its keypoints set. 019 * 2. Find the nearest visual words from the vocabulary for each keypoint descriptor. 020 * 3. Compute the bag-of-words image descriptor as is a normalized histogram of vocabulary words 021 * encountered in the image. The i-th bin of the histogram is a frequency of i-th word of the 022 * vocabulary in the given image. 023 */ 024public class BOWImgDescriptorExtractor { 025 026 protected final long nativeObj; 027 protected BOWImgDescriptorExtractor(long addr) { nativeObj = addr; } 028 029 public long getNativeObjAddr() { return nativeObj; } 030 031 // internal usage only 032 public static BOWImgDescriptorExtractor __fromPtr__(long addr) { return new BOWImgDescriptorExtractor(addr); } 033 034 // 035 // C++: cv::BOWImgDescriptorExtractor::BOWImgDescriptorExtractor(Ptr_DescriptorExtractor dextractor, Ptr_DescriptorMatcher dmatcher) 036 // 037 038 // Unknown type 'Ptr_DescriptorExtractor' (I), skipping the function 039 040 041 // 042 // C++: void cv::BOWImgDescriptorExtractor::setVocabulary(Mat vocabulary) 043 // 044 045 /** 046 * Sets a visual vocabulary. 047 * 048 * @param vocabulary Vocabulary (can be trained using the inheritor of BOWTrainer ). Each row of the 049 * vocabulary is a visual word (cluster center). 050 */ 051 public void setVocabulary(Mat vocabulary) { 052 setVocabulary_0(nativeObj, vocabulary.nativeObj); 053 } 054 055 056 // 057 // C++: Mat cv::BOWImgDescriptorExtractor::getVocabulary() 058 // 059 060 /** 061 * Returns the set vocabulary. 062 * @return automatically generated 063 */ 064 public Mat getVocabulary() { 065 return new Mat(getVocabulary_0(nativeObj)); 066 } 067 068 069 // 070 // C++: void cv::BOWImgDescriptorExtractor::compute2(Mat image, vector_KeyPoint keypoints, Mat& imgDescriptor) 071 // 072 073 /** 074 * 075 * @param imgDescriptor Computed output image descriptor. 076 * pointIdxsOfClusters[i] are keypoint indices that belong to the i -th cluster (word of vocabulary) 077 * returned if it is non-zero. 078 * @param image automatically generated 079 * @param keypoints automatically generated 080 */ 081 public void compute(Mat image, MatOfKeyPoint keypoints, Mat imgDescriptor) { 082 Mat keypoints_mat = keypoints; 083 compute_0(nativeObj, image.nativeObj, keypoints_mat.nativeObj, imgDescriptor.nativeObj); 084 } 085 086 087 // 088 // C++: int cv::BOWImgDescriptorExtractor::descriptorSize() 089 // 090 091 /** 092 * Returns an image descriptor size if the vocabulary is set. Otherwise, it returns 0. 093 * @return automatically generated 094 */ 095 public int descriptorSize() { 096 return descriptorSize_0(nativeObj); 097 } 098 099 100 // 101 // C++: int cv::BOWImgDescriptorExtractor::descriptorType() 102 // 103 104 /** 105 * Returns an image descriptor type. 106 * @return automatically generated 107 */ 108 public int descriptorType() { 109 return descriptorType_0(nativeObj); 110 } 111 112 113 @Override 114 protected void finalize() throws Throwable { 115 delete(nativeObj); 116 } 117 118 119 120 // C++: void cv::BOWImgDescriptorExtractor::setVocabulary(Mat vocabulary) 121 private static native void setVocabulary_0(long nativeObj, long vocabulary_nativeObj); 122 123 // C++: Mat cv::BOWImgDescriptorExtractor::getVocabulary() 124 private static native long getVocabulary_0(long nativeObj); 125 126 // C++: void cv::BOWImgDescriptorExtractor::compute2(Mat image, vector_KeyPoint keypoints, Mat& imgDescriptor) 127 private static native void compute_0(long nativeObj, long image_nativeObj, long keypoints_mat_nativeObj, long imgDescriptor_nativeObj); 128 129 // C++: int cv::BOWImgDescriptorExtractor::descriptorSize() 130 private static native int descriptorSize_0(long nativeObj); 131 132 // C++: int cv::BOWImgDescriptorExtractor::descriptorType() 133 private static native int descriptorType_0(long nativeObj); 134 135 // native support for java finalize() 136 private static native void delete(long nativeObj); 137 138}