Open nikkisingh111333 opened 3 years ago
There's some sample code on the mailing list: https://groups.google.com/g/javacv/search?q=BOWImgDescriptorExtractor Let me know if you're having problems with any of that.
hey i m having problem in understanding it seems confusing ..
first just check my code its simple one:
var files= new File("C:\\Users\\Nikki singh\\Downloads\\2 img"); File[] imageFiles = files.listFiles(imgFilter); TermCriteria criteria = new TermCriteria(TermCriteria.EPS + TermCriteria.MAX_ITER,100,0.001); int dictionarySize = 60; BOWKMeansTrainer bow = new BOWKMeansTrainer(dictionarySize, criteria, 1, Core.KMEANS_PP_CENTERS); SIFT sift=SIFT.create(); FastFeatureDetector fd=FastFeatureDetector.create(); KeyPointVector keypoint=new KeyPointVector(); opencv_features2d.drawKeypoints(y, keypoint, y); for (int i=0;i<12;i++) { Mat im=imread(imageFiles[i].getAbsolutePath(),IMREAD_GRAYSCALE); ims.add(im); KeyPointVector mk=new KeyPointVector(); fd.detect(im , mk); sift.detectAndCompute(im,mask, mk, dis); dis.convertTo(dis, opencv_core.CV_32FC1); bow.add(dis); } System.out.println(bow.descriptorsCount()); DescriptorMatcher matcher = DescriptorMatcher.create(DescriptorMatcher.FLANNBASED); BOWImgDescriptorExtractor de = new BOWImgDescriptorExtractor(sift,matcher); var dictionary_vocabs=bow.cluster(); System.out.println(dictionary_vocabs.toString()); de.setVocabulary(dictionary_vocabs); // i m right TILL here System.out.println(de.getVocabulary().toString());
till here i m doing good but after vocabulary i dont know what to do..i ve read many sources about BOWV some says you have to train vocabs in svm or any other you want to use BUT some says you have to train each image descriptors(i m using SHIFT here)
on svm .....than my question is whats the point of creating vocabulary ... i mean how can i train SVM or Anyother classifier with BOW and start predicting ..my folder has 26 sample image just for trying purpose i m using 14 for training...what the correct setup for bow ..please help me out.
hey i m struggling with Bag Of Visual Words in java bytedeco ..i cant find any good example of using bag of visual words in java .i know how it works theoritically but dont know how to implement it currently using this but confused:
how to implement it properly ..steps by step. some provide me some guidance ?