Ask Your Question

Revision history [back]

more SIFT matches than descriptors

Hi there,

I am comparing objects by using SIFT features in Python. I am using the FLANN KNN matcher. This works well, but occasionally I get more matches than I had features to match with.

kp, des = sift.detectAndCompute(frame, None)
kp2, des2 = sift.detectAndCompute(frame2, None)
flann = cv2.FlannBasedMatcher(index_params, search_params)
matches = flann.knnMatch(des, des2, k=2)
good = []
for m, n in matches:
    if m.distance < 0.75*n.distance:
        good.append(m)

So, len(good) can be higher than len(des) or len(des2) in practice. Question is: how can this happen? As per my understanding, there shouldn't be more matching features than features in total.