Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Hi there, I´m using BruteForceMatcher.knnMatch

My results are filtered this way.

for(int i = 0; i < matches2.size(); ++i) { if (matches2[i].size() < 2) continue;

    if((matches2[i][0].distance < 0.59*(matches2[i][1].distance)) && ((int) matches2[i].size()<=2 && (int) matches2[i].size()>0))//Surf detector 0.56 StarFeatureDetector 0.59 Brisk 0.6
       good_matches.push_back(matches2[i][0]);

    if((matches2[i][0].distance <0.675*(matches2[i][1].distance)) && ((int) matches2[i].size()<=2 && (int) matches2[i].size()>0))//Surf detector 0.56 StarFeatureDetector 0.59 Bris 0.675
        out_matches.push_back(matches2[i][0]);


}

After I filtered the matches, I´m checking the ration: if(out_matches.size()!=0) { double x=((double)good_matches.size()/(double)out_matches.size()); cout<<"x:"<<x&lt;<endl; if(0.2<x="" &amp;&amp;="" good_matches.size()&gt;="6" &amp;&amp;="" out_matches.size()&gt;2)="" {="" found="" }<="" p="">

click to hide/show revision 2
Code formatting

Hi there, I´m using BruteForceMatcher.knnMatch

My results are filtered this way.

for(int i = 0; i < matches2.size(); ++i)
 {
     if (matches2[i].size() < 2)
         continue; 

     if((matches2[i][0].distance < 0.59*(matches2[i][1].distance)) && ((int) matches2[i].size()<=2 && (int) matches2[i].size()>0))//Surf detector 0.56 StarFeatureDetector 0.59 Brisk 0.6
       good_matches.push_back(matches2[i][0]);

    if((matches2[i][0].distance <0.675*(matches2[i][1].distance)) && ((int) matches2[i].size()<=2 && (int) matches2[i].size()>0))//Surf detector 0.56 StarFeatureDetector 0.59 Bris 0.675
        out_matches.push_back(matches2[i][0]);


}

After I filtered the matches, I´m checking the ration: if(out_matches.size()!=0) { double x=((double)good_matches.size()/(double)out_matches.size()); cout<<"x:"<<x&lt;<endl; if(0.2<x="" &amp;&amp;="" good_matches.size()&gt;="6" &amp;&amp;="" out_matches.size()&gt;2)="" {="" found="" }<="" p="">

click to hide/show revision 3
Code formatting

Hi there, I´m using BruteForceMatcher.knnMatch

My results are filtered this way.

for(int i = 0; i < matches2.size(); ++i)
{
    if (matches2[i].size() < 2)
        continue; 



    if((matches2[i][0].distance < 0.59*(matches2[i][1].distance)) && ((int) matches2[i].size()<=2 && (int) matches2[i].size()>0))//Surf detector 0.56 StarFeatureDetector 0.59 Brisk 0.6
       good_matches.push_back(matches2[i][0]);

    if((matches2[i][0].distance <0.675*(matches2[i][1].distance)) && ((int) matches2[i].size()<=2 && (int) matches2[i].size()>0))//Surf detector 0.56 StarFeatureDetector 0.59 Bris 0.675
        out_matches.push_back(matches2[i][0]);


}

After I filtered the matches, I´m checking the ration: ratio:

    if(out_matches.size()!=0)
    { 
      double x=((double)good_matches.size()/(double)out_matches.size());
      cout<<"x:"<<x&lt;<endl; if(0.2<x="" &amp;&amp;="" good_matches.size()&gt;="6" &amp;&amp;="" out_matches.size()&gt;2)="" {="" found="" }<="" p="">

cout<<"x:"<<x<<endl; if(0.2<x && good_matches.size()>=6 && out_matches.size()>2) { //found }