2つの画像でSIFTを使用し、opencvのBFMatcherを使用してキーポイントに一致させようとしています。BFMatcherでの一致のOpenCVの長さ
ただし、一致の数はクエリ記述子の数と同じではありません。誰かが彼らが平等ではない理由を説明することはできますか?
docs match()function "クエリセットの各ディスクリプタに最適な一致を検出します。"
import cv2
import numpy as np
im1 = cv2.imread("trex1.png", cv2.IMREAD_GRAYSCALE)
im2 = cv2.imread("trex2.png", cv2.IMREAD_GRAYSCALE)
sift = cv2.xfeatures2d.SIFT_create()
kp1, des1 = sift.detectAndCompute(im1, None)
kp2, des2 = sift.detectAndCompute(im2, None)
im_kp1 = np.zeros(im1.shape, dtype=np.uint8)
im_kp2 = np.zeros(im1.shape, dtype=np.uint8)
im_kp1 = cv2.drawKeypoints(im1,kp1,None)
im_kp2 = cv2.drawKeypoints(im2,kp2,None)
bf = cv2.BFMatcher(cv2.NORM_L2, crossCheck=True)
matches = bf.match(des1,des2)
print len(des1)
# Result : 78
print len(des2)
# Result : 71
print len(matches)
# Result : 55