How to get the positions of the matched points with Brute-Force Matching / SIFT Descriptors

半世苍凉 提交于 2020-01-06 07:53:26

问题


I tried matching my SIFT-Keypoints with BF-matcher. I used to do it like this tutorial https://docs.opencv.org/3.0-beta/doc/py_tutorials/py_feature2d/py_matcher/py_matcher.html

But if i want to get the x,y-positions with print(good) it gives me only something like DMatch 000001DD9C4E0EB0

How can I convert this into positions?


回答1:


As you provided no code, I answer your question based on the code in the tutorial. Basically, keypoints are the points detected by the SIFT algorithm with the rotation, scale and x,y position, and descriptors are just the vectors of features used to match them. In the matches variable you have a set of matches between descriptors (DMatch). Keypoints are located in kp1 and kp2. To find two points (p1,p2) that are matched use the code like this:

for match in matches:
  p1 = kp1[match.queryIdx].pt
  p2 = kp2[match.trainIdx].pt


来源:https://stackoverflow.com/questions/54203873/how-to-get-the-positions-of-the-matched-points-with-brute-force-matching-sift

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