Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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

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);

crossCheck=True);

Now when I issue the following command:

matches = bf.knnMatch(des1,des2); I get the following error:

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