|
|
@ -61,19 +61,15 @@ int main(void) |
|
|
|
tab.at<float>(i, 0) = matches[i].distance; |
|
|
|
tab.at<float>(i, 0) = matches[i].distance; |
|
|
|
sortIdx(tab, index, SORT_EVERY_COLUMN + SORT_ASCENDING); |
|
|
|
sortIdx(tab, index, SORT_EVERY_COLUMN + SORT_ASCENDING); |
|
|
|
vector<DMatch> bestMatches; /*<! best match */ |
|
|
|
vector<DMatch> bestMatches; /*<! best match */ |
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i<30; i++) |
|
|
|
for (int i = 0; i<30; i++) |
|
|
|
bestMatches.push_back(matches[index.at<int>(i, 0)]); |
|
|
|
bestMatches.push_back(matches[index.at<int>(i, 0)]); |
|
|
|
|
|
|
|
|
|
|
|
Mat result; |
|
|
|
Mat result; |
|
|
|
drawMatches(img1, keyImg1, img2, keyImg2, bestMatches, result); |
|
|
|
drawMatches(img1, keyImg1, img2, keyImg2, bestMatches, result); |
|
|
|
namedWindow(*itDesc+": "+*itMatcher, WINDOW_AUTOSIZE); |
|
|
|
namedWindow(*itDesc+": "+*itMatcher, WINDOW_AUTOSIZE); |
|
|
|
imshow(*itDesc + ": " + *itMatcher, result); |
|
|
|
imshow(*itDesc + ": " + *itMatcher, result); |
|
|
|
FileStorage fs(*itDesc+"_"+*itMatcher+"_"+fileName[0]+"_"+fileName[1]+".xml", FileStorage::WRITE); |
|
|
|
FileStorage fs(*itDesc+"_"+*itMatcher+"_"+fileName[0]+"_"+fileName[1]+".xml", FileStorage::WRITE); |
|
|
|
fs<<"Matches"<<matches; |
|
|
|
fs<<"Matches"<<matches; |
|
|
|
|
|
|
|
|
|
|
|
vector<DMatch>::iterator it; |
|
|
|
vector<DMatch>::iterator it; |
|
|
|
|
|
|
|
|
|
|
|
cout << "Index \tIndex \tindex \tdistance\n"; |
|
|
|
cout << "Index \tIndex \tindex \tdistance\n"; |
|
|
|
cout << "in img1\tin img2\timage\t\n"; |
|
|
|
cout << "in img1\tin img2\timage\t\n"; |
|
|
|
for (it = matches.begin(); it != matches.end(); it++) |
|
|
|
for (it = matches.begin(); it != matches.end(); it++) |
|
|
|