the problem of Bow algorithm [closed]

asked 2017-05-09 04:07:40 -0600

martin_zx gravatar image

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

berak gravatar image
 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

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by berak
close date 2017-05-09 05:53:00.200482

Comments

1

i guess, you should blame the matcher. can you try, if you get consistent results with the BFMatcher ?

berak gravatar imageberak ( 2017-05-09 04:34:14 -0600 )edit
1

I have tried it,you are right. I am extremely grateful to you for your help,than you!!!!

martin_zx gravatar imagemartin_zx ( 2017-05-09 05:38:49 -0600 )edit

uff, reminds me to change some of my code, too ;(

berak gravatar imageberak ( 2017-05-09 05:48:59 -0600 )edit

thanks a lot. it troubled me the whole afternoon.

martin_zx gravatar imagemartin_zx ( 2017-05-09 06:10:17 -0600 )edit