Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Implementing BagOfWords in java?

I am new to Java and Opencv, i have spent 2 days trying to implement BOW in Java, i am using OpenCV 3.2.0 since it is the only version that i found contains BOW classes in Feature2d

int dictionarySize = 1500;
 TermCriteria criteria = new TermCriteria(TermCriteria.EPS + TermCriteria.MAX_ITER,100,0.1);

 FeatureDetector features = FeatureDetector.create(FeatureDetector.SIFT);
 DescriptorExtractor extractor = DescriptorExtractor.create(DescriptorExtractor.SIFT);
 DescriptorMatcher matcher = DescriptorMatcher.create(DescriptorMatcher.FLANNBASED);

 BOWKMeansTrainer bowTrainer = new BOWKMeansTrainer(dictionarySize, criteria, 1, Core.KMEANS_PP_CENTERS);



BOWImgDescriptorExtractor de = new BOWImgDescriptorExtractor(extractor, matcher);

In the last line of code i found out in Java BOWImgDescriptorExtractor class don't take theses input arguments like the C++ class.

I need to train SVM with BoW so please any help would be appreciated.