c++ - OpenCV drawMatches -- queryIdx and trainIdx

ID : 274530

viewed : 32

Tags : c++image-processingopencvcomputer-visionc++





Top 3 Answer for c++ - OpenCV drawMatches -- queryIdx and trainIdx

vote vote

95

That depends on how you get matches.

If you call match function in the order:

match(descriptor_for_keypoints1, descriptor_for_keypoints2, matches) 

then queryIdx refers to keypoints1 and trainIdx refers to keypoints2, or vice versa.

vote vote

85

the variable "matches" is a list of DMatch objects.

If we are iterating over this list of DMatch objects, then each item will have the following attributes:

  1. item.distance: This attribute gives us the distance between the descriptors. A lower distance indicates a better match.
  2. item.trainIdx: This attribute gives us the index of the descriptor in the list of train descriptors (in our case, it’s the list of descriptors in the img2).
  3. item.queryIdx: This attribute gives us the index of the descriptor in the list of query descriptors (in our case, it’s the list of descriptors in the img1).
  4. item.imgIdx: This attribute gives us the index of the train image.
vote vote

70

Top 3 video Explaining c++ - OpenCV drawMatches -- queryIdx and trainIdx







Related QUESTION?