opencv3.2.0中DMatch类型

  • 比如有两张图片img1,img2开始做他俩的匹配
  • bf = cv2.BFMatcher(cv.NORM_L2)
  • matches = bf.knnMatch(des1,des2,k=3)
  • DMatch.distance - 每个des1[i]有3个最近邻
  • DMatch.trainIdx - img2当前图片des2[i]索引所以等于i
  • DMatch.queryIdx - img1当前des1[i]的索引所以等于i
  • DMatch.imgIdx - des1对应的图片索引比如两个图片那么des1对应的图片索引为0


例子:

matches[0][0].imgIdx
Out[102]: 0
matches[0][0].queryIdx
Out[103]: 0
matches[0][1].imgIdx
Out[104]: 0
matches[0][0].imgIdx
Out[105]: 0
matches[0][0].trainIdx
Out[106]: 2974
matches[0][0].imgIdx
Out[107]: 0
matches[0][0].queryIdx
Out[108]: 0
matches[0][0].trainIdx
Out[109]: 2974
matches[0][1].imgIdx
Out[110]: 0
matches[0][1].queryIdx
Out[111]: 0
matches[0][1].trainIdx
Out[112]: 2955
matches[1][0].imgIdx
Out[113]: 0
matches[1][0].queryIdx
Out[114]: 1


猜你喜欢

转载自blog.csdn.net/qq_25964837/article/details/80246733