Skip to content Skip to sidebar Skip to footer

Opencv Bfmatcher Match() Always Return Error

I'm training a BFMatcher with 4 descriptors: bf = cv2.BFMatcher() bf.clear() bf.add(des1) bf.add(des2) bf.add(des3) bf.add(des4) bf.train() bf.match(des1) The code bf.match(des1

Solution 1:

You are right, you can add descriptors in lists but you can only match with single descriptors, so, go over the whole des1 array and match every single descriptor and save the matches in a list, or a set if you don't want them to be repeated!

matches=set()
fordescin desc1:
    matches_img = bf.knnMatch(desc,k=2)
    formatchin matches_img:
        matches.add(match)

Solution 2:

you should use:

bf  = cv2.BFMatcher(cv2.NORM_HAMMING)

when using ORB. The error shows that the type used for ORB descriptor is not supported with the defualt L2 distance of the matcher.

Post a Comment for "Opencv Bfmatcher Match() Always Return Error"