我一直在智能手機上的Android應用程序,其中2張圖片可以比較(一個在SD卡上,一個從相機)。我在有限的關鍵點上使用FREAK描述符(根據響應篩選出500個最好的關鍵點)。當我嘗試將它與BRUTEFORCE_SL2匹配時,它會返回0個匹配項。Bruteforce匹配與FREAK描述符一起工作嗎?
這是因爲FREAK和Bruteforce在一起工作不好嗎?或者我在代碼中做錯了什麼?
匹配情況與
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());
當我只是做了
matcher.match(descriptors,descriptors1,matches);
與
Log.d("LOG!", "Number of good matches= " + matches.size());
宣讀了比賽,我得到約450即使我拿的圖片甚至不像我的形象。
你最後一句話是什麼意思?謝謝你的信息,我會試試漢明並檢查我的結果 – user1393500 2013-05-01 18:11:31
我編輯了我的答案。我希望現在更清楚。 – JonesV 2013-05-01 19:31:55
是的,我一直在嘗試漢明,但goedematches.size()給出了奇怪的結果。與原始圖像沒有任何關係的圖像比與原始圖像幾乎相同的圖像更好地匹配。 – user1393500 2013-05-01 23:48:52