Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

the problem of Bow algorithm

for(i=0;i<3;i++) for(j=0;j<3;j++)
{ Mat dictionary; Mat cfile=("lema.jpg", CV_LOAD_IMAGE_GRAYSCALE) float f=0; float ID=0; float * value = new float[2]; FileStorage fs("dictionary_k2000.yml", FileStorage::READ); fs["vocabulary"] >> dictionary; fs.release(); Ptr<descriptormatcher> matcher(new FlannBasedMatcher); Ptr<featuredetector> detector(new SiftFeatureDetector()); Ptr<descriptorextractor> extractor(new SiftDescriptorExtractor); BOWImgDescriptorExtractor bowDE(extractor,matcher); bowDE.setVocabulary(dictionary); vector<keypoint> keyPoints; detector->detect(cfile, keyPoints ); Mat imageDescriptor; bowDE.compute( cfile, keyPoints, imageDescriptor );
}

the imageDescriptor gotten in each loop is different, two parameters of bowDE.compute "cfile" and "keyPoints" are the same , why ? how to solve this problem

click to hide/show revision 2
No.2 Revision

updated 2017-05-09 04:27:06 -0600

berak gravatar image

the problem of Bow algorithm

 for(i=0;i<3;i++)
for(j=0;j<3;j++) 
{ Mat dictionary; Mat cfile=("lema.jpg", CV_LOAD_IMAGE_GRAYSCALE) float f=0; float ID=0; float * value = new float[2]; FileStorage fs("dictionary_k2000.yml", FileStorage::READ); fs["vocabulary"] >> dictionary; fs.release(); Ptr<descriptormatcher> Ptr<DescriptorMatcher> matcher(new FlannBasedMatcher); Ptr<featuredetector> Ptr<FeatureDetector> detector(new SiftFeatureDetector()); Ptr<descriptorextractor> Ptr<DescriptorExtractor> extractor(new SiftDescriptorExtractor); BOWImgDescriptorExtractor bowDE(extractor,matcher); bowDE.setVocabulary(dictionary); vector<keypoint> vector<KeyPoint> keyPoints; detector->detect(cfile, keyPoints ); Mat imageDescriptor; bowDE.compute( cfile, keyPoints, imageDescriptor );
}

}

the imageDescriptor gotten in each loop is different, two parameters of bowDE.compute "cfile" and "keyPoints" are the same , why ? how to solve this problem