Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Does Bruteforce matching work with FREAK descriptors?

I've been making an application where 2 images can be compared (one on the SD card, one from the camera). There I use a FREAK descriptor on a limited amount of keypoints (i filtered out the 500 best ones according to the response). When I try to match it with BRUTEFORCE_SL2, it gives back 0 matches.

Is this because FREAK and Bruteforce don't work well together? Or did I do something wrong in the code?

Matching happens with

            MatOfDMatch matches = new MatOfDMatch();

            matcher = DescriptorMatcher.create(DescriptorMatcher.BRUTEFORCE_SL2);
            matcher.match(descriptors,descriptors1,matches);
            MatOfDMatch goedematches = new MatOfDMatch();

            double max_dist = 0;
            double min_dist = 100;
            //if (descriptors.cols() == descriptors1.cols())
            //{
            for( int i = 0; i < descriptors.rows(); i++ )
            { double dist = matches.toArray()[i].distance;
              if( dist < min_dist ) min_dist = dist;
              if( dist > max_dist ) max_dist = dist;
            }
            // should only draw good matches
           for( int i = 0; i < descriptors.rows(); i++ )
            {  MatOfDMatch temp = new MatOfDMatch();
               if( matches.toArray()[i].distance < 3*min_dist )
               {   temp.fromArray(matches.toArray()[i]);
                   goedematches.push_back(temp); 
                   }        
           // }
            }

           Log.d("LOG!", "Number of good matches= " + goedematches.size());

When I just do the matcher.match(descriptors,descriptors1,matches); and read out the matches with Log.d("LOG!", "Number of good matches= " + matches.size()); I get about 450 even if I take a picture of something that doesn't even look like my image.

Does Bruteforce matching work with FREAK descriptors?

I've been making an application where 2 images can be compared (one on the SD card, one from the camera). There I use a FREAK descriptor on a limited amount of keypoints (i filtered out the 500 best ones according to the response). When I try to match it with BRUTEFORCE_SL2, it gives back 0 matches.

Is this because FREAK and Bruteforce don't work well together? Or did I do something wrong in the code?

Matching happens with

            MatOfDMatch matches = new MatOfDMatch();

            matcher = DescriptorMatcher.create(DescriptorMatcher.BRUTEFORCE_SL2);
            matcher.match(descriptors,descriptors1,matches);
            MatOfDMatch goedematches = new MatOfDMatch();

            double max_dist = 0;
            double min_dist = 100;
            //if (descriptors.cols() == descriptors1.cols())
            //{
            for( int i = 0; i < descriptors.rows(); i++ )
            { double dist = matches.toArray()[i].distance;
              if( dist < min_dist ) min_dist = dist;
              if( dist > max_dist ) max_dist = dist;
            }
            // should only draw good matches
           for( int i = 0; i < descriptors.rows(); i++ )
            {  MatOfDMatch temp = new MatOfDMatch();
               if( matches.toArray()[i].distance < 3*min_dist )
               {   temp.fromArray(matches.toArray()[i]);
                   goedematches.push_back(temp); 
                   }        
           // }
            }

           Log.d("LOG!", "Number of good matches= " + goedematches.size());

When I just do the matcher.match(descriptors,descriptors1,matches); and read out the matches with Log.d("LOG!", "Number of good matches= " + matches.size()); I get about 450 even if I take a picture of something that doesn't even look like my image.

EDIT:

This is when I compare the same image. The output are 0x0 good matches. When I use the same picture and one that has nothing to do with it, I get about 471 matches. There is something wrong inside the code, but I can't seem to see what's wrong

Matching the same image

Does Bruteforce and matching work with FREAK descriptors?giving reverse results. Why?

I've been making an application where 2 images can be compared (one on the SD card, one from the camera). There I use a FREAK descriptor on a limited amount of keypoints (i filtered out the 500 best ones according to the response). When I try to match it with BRUTEFORCE_SL2, BRUTEFORCE_HAMMING, it gives back 0 matches.

Is this because FREAK and Bruteforce don't work well together? Or did I do something wrong in the code?

Matching happens with

            MatOfDMatch matches = new MatOfDMatch();

            matcher = DescriptorMatcher.create(DescriptorMatcher.BRUTEFORCE_SL2);
            matcher.match(descriptors,descriptors1,matches);
            MatOfDMatch goedematches = new MatOfDMatch();

            double max_dist = 0;
            double min_dist = 100;
            //if (descriptors.cols() == descriptors1.cols())
            //{
            for( int i = 0; i < descriptors.rows(); i++ )
            { double dist = matches.toArray()[i].distance;
              if( dist < min_dist ) min_dist = dist;
              if( dist > max_dist ) max_dist = dist;
            }
            // should only draw good matches
           for( int i = 0; i < descriptors.rows(); i++ )
            {  MatOfDMatch temp = new MatOfDMatch();
               if( matches.toArray()[i].distance < 3*min_dist )
               {   temp.fromArray(matches.toArray()[i]);
                   goedematches.push_back(temp); 
                   }        
           // }
            }

           Log.d("LOG!", "Number of good matches= " + goedematches.size());

When I just do the matcher.match(descriptors,descriptors1,matches); and read out the matches with Log.d("LOG!", "Number of good matches= " + matches.size()); I get about 450 even if I take a picture of something that doesn't even look like my image.

EDIT:

This is when I compare the same image. image with itself. The output are 0x0 good matches. When I use the same picture and one that has nothing to do with it, I get about 471 matches. There is something wrong inside the code, but I can't seem to see what's wrong

Matching the same image

Bruteforce and matching giving reverse results. Why?

I've been making an application where 2 images can be compared (one (2 pictures on the SD card, one from the camera). my smartphone). There I use a FAST detector and FREAK descriptor on a limited amount of keypoints (i filtered out the 500 300 best ones according to the response). When I try to match it with BRUTEFORCE_HAMMING, it gives back 0 matches.

Matching happens with

  MatOfDMatch matches = new MatOfDMatch();

     matcher = DescriptorMatcher.create(DescriptorMatcher.BRUTEFORCE_SL2);
        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 i = 0; i < descriptors.rows(); i++ )
     { double dist = matches.toArray()[i].distance;
       if( dist < min_dist ) min_dist = dist;
       if( dist > max_dist ) max_dist = dist;
     }
     // should only draw good matches
    for( int i = 0; i < descriptors.rows(); i++ )
     {  MatOfDMatch temp = new MatOfDMatch();
        if( matches.toArray()[i].distance < 3*min_dist 2*min_dist )
        {   temp.fromArray(matches.toArray()[i]);
            goedematches.push_back(temp); 
            }        
    // }
     }

    Log.d("LOG!", "Number of good matches= " + goedematches.size());

When I just do the matcher.match(descriptors,descriptors1,matches); and read out the matches with Log.d("LOG!", "Number of good matches= " + matches.size()); compare the image to itself, I get about 450 even if I take a picture of something that doesn't even look like my image.

EDIT:

This is when I compare the same image with itself. the following output. The output are is 0x0 good matches.

image description

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 good matches= 0x0

When I use the same picture and one that has nothing to do with it, I get about 471 matches. There is something wrong inside the code, but I can't seem to see what's wrong

Matching the same imagewrong (the code seems to reserve, cause everything that is the same isn't matched, and it's matched when it's completely different. Where is the code am I doing it wrong?)

IMPORTANT: Don't mind the red dots on the right picture, it's just an old picture I took when I drew the keypoints on the screen. It does not stand for the matching itself! It could be any other picture that has nothing to do with the first image.

image description

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 good matches= 1x286

This Question has been posted on Stackoverflow as well.