java - Bruteforce and matching gives reverse/wrong results -


i've been making application 2 images can compared (2 pictures on smartphone). there use fast detector , freak descriptor on limited amount of keypoints (i filtered out 300 best ones according response). when try match bruteforce_hamming, gives 0 matches.

matching happens with

        matofdmatch matches = new matofdmatch();          matcher = descriptormatcher.create(descriptormatcher.bruteforce_hamming);         matcher.match(descriptors,descriptors1,matches);         matofdmatch goedematches = new matofdmatch();          double max_dist = 0;         double min_dist = 100;         //if (descriptors.cols() == descriptors1.cols())         //{         for( int = 0; < descriptors.rows(); i++ )         { double dist = matches.toarray()[i].distance;           if( dist < min_dist ) min_dist = dist;           if( dist > max_dist ) max_dist = dist;         }         // should draw matches        for( int = 0; < descriptors.rows(); i++ )         {  matofdmatch temp = new matofdmatch();            if( matches.toarray()[i].distance < 2*min_dist )            {   temp.fromarray(matches.toarray()[i]);                goedematches.push_back(temp);                 }                // }         }         log.d("log!", "number of matches= " + goedematches.size()); 

when compare image itself, following output. output 0x0 matches. enter image description here

05-02 15:52:30.325: d/log!(17866): number of descriptors image 1= 64x286 05-02 15:52:30.325: d/log!(17866): number of descriptors image 2= 64x286 05-02 15:52:30.325: d/log!(17866): description time elapsed 339 ms 05-02 15:52:30.555: d/log!(17866): minimum distance = 0.0 05-02 15:52:30.560: d/log!(17866): maximum distance= 0.0 05-02 15:52:30.560: d/log!(17866): number of matches= 0x0 

when use same picture , 1 has nothing it, 471 matches. there wrong inside code, can't seem see what's wrong (the code seems reserve, cause same isn't matched, , it's matched when it's different. code doing wrong?)

important: don't mind red dots on right picture, it's old picture took when drew keypoints on screen. not stand matching itself! other picture has nothing first image.

enter image description here

05-02 16:03:06.120: d/log!(19025): number of descriptors image 1= 64x259 05-02 16:03:06.120: d/log!(19025): number of descriptors image 2= 64x286 05-02 16:03:06.420: d/log!(19025): minimum distance= 93.0 05-02 16:03:06.420: d/log!(19025): maximum distance = 183.0 05-02 16:03:06.420: d/log!(19025): number of matches= 1x286 

   if( matches.toarray()[i].distance < 2*min_dist ) 

in first case compare same images, value of min_dist therefore 0 , if statement reject matches no distance smaller 0.


in second case min_dist 93*2=186 , since maximum_distance 183 lead accepting matches instead of rejecting them.

consider looking opencv computer vision cookbook in chapter 9 there approach keeping matches based on ratio , symmetry test.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -