How to Access Points location on OpenCV Matcher?

。_饼干妹妹 提交于 2019-12-04 11:22:33

matched_points1 and 2 will be the corresponding points in the left and right images. Then, you can find the indices of the good_matches with idx1=good_matches[i].trainIdx for the left image and idx2=good_matches[i].queryIdx for the right image. Then just add the corresponding points to your matched_points vector to obtain the x,y point vector of the matches.

long num_matches = good_matches.size();
vector<Point2f> matched_points1;
vector<Point2f> matched_points2;

for (int i=0;i<num_matches;i++)
{
    int idx1=good_matches[i].trainIdx;
    int idx2=good_matches[i].queryIdx;
    matched_points1.push_back(points1[idx1]);
    matched_points2.push_back(points2[idx2]);
}

Now you have two vectors of the matched points. I think that's what you're asking?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!