Ask Your Question

erudumeller's profile - activity

2015-07-07 07:25:51 -0500 received badge  Enthusiast
2015-07-02 10:53:59 -0500 commented question more SIFT matches than descriptors

@Doomb0t 's explanation is right, but this is not the solution to the problem. Setting k to 1 means the distance test does not work anymore, making len(good) always equal to the maximum of len(des) and len(des2). For some reason that is unclear to me, the algorithm first finds the longest list of descriptors, and then tries to find a match (or two in this case) in the shorter one. What I want it to do is to only find matches for the shorter one, so there are no duplicates in matching. I have looked through the c++ documentation (the python one is quite lacking), but haven't yet found something that lets me do this.

2015-07-02 06:14:10 -0500 asked a question 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:

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.