0
in this answer我理解了之前的所有內容「// 5.使用RANSAC驗證匹配項」。如何通過ORB獲得良好的Homography?
在我的代碼中,除了ransacTest的部分外,我使用該代碼。我面臨的問題是,我得到太多錯誤的「匹配」,並且/或者有時我的代碼找到的對象周圍的矩形太扭曲。
//Template image's corners
obj_corners[0] = cvPoint(0, 0);
obj_corners[1] = cvPoint(best_img.cols, 0);
obj_corners[2] = cvPoint(best_img.cols, best_img.rows);
obj_corners[3] = cvPoint(0, best_img.rows);
obj.clear();
scene.clear();
for (int i = 0; i < best_matches.size(); i++)
{
//Get the keypoints from the good matches
obj.push_back(best_img_keypoints[ best_matches[i].queryIdx ].pt); // Template image
scene.push_back(frame_keypoints[ best_matches[i].trainIdx ].pt); // Frame
}
// -----Find homography----- //
std::vector<uchar> outlier_mask; //I don't use this line
cv::Mat H = findHomography(obj, scene, CV_RANSAC, reprojThres, outlier_mask);
cv::perspectiveTransform(obj_corners, scene_corners, H);
a)如果我使用基礎矩陣,我將能夠使用findHomography和perspectiveTransform?
b)上述行中是否有錯誤?