A clarification with BFMatcher.knnMatch
Hi,
I am using Opencv-3.0.0 beta through Python 2.7.x , under Ubuntu 14.04 LTS. I am using the descriptor matching between two images through BFMatcher.knnMatch. I am doing the following commands:
orb = cv2.ORB_create(nfeatures=60);
kp1, des1 = orb.detectAndCompute(img1, None);
kp2, des2 = orb.detectAndCompute(img2, None);
bf = cv2.BFMatcher(cv2.NORM_HAMMING, crossCheck=True);
Now when I issue the following command:
matches = bf.knnMatch(des1,des2); I get the following error:
Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: only length-1 arrays can be converted to Python scalars
Can someone explain to me what does this mean? is it possible that ORB descriptors and keypoints are not compatible with knnMatch method?
Thanks
when in doubt, - try the builtin help :
so, it pretty much looks like you forgot to supply the
k
param, and it mistook your des2 for k (version2)I tried that and it still didn't work. It gave another error: cv2.error: /home/s0r2637/Downloads/opencv/modules/core/src/stat.cpp:3731: error: (-215) K == 1 && update == 0 && mask.empty() in function batchDistance
what exactly did you do now?
I am sorry I did the following:
matches = bf.knnMatch(des1,des2, k=10);