Reputation: 446
I'm trying to run one of the samples included in opencv: find_obj.py. OpenCV version: 2.4 OS: ArchLinx
There is an error at the function:
flann = cv2.flann_Index(desc2, flann_params)
The error is:
File "find_obj2.py", line 27, in match_flann
flann = cv2.flann_Index(desc2, flann_params)
TypeError: <unknown> is not a numpy array
Please anyone knows how to fix this?
Upvotes: 2
Views: 1114
Reputation: 446
Solution found: i replaced the following line in find_obj.py:
surf = cv2.SURF(1000)
kp1, desc1 = surf.detect(img1, None, False)
kp2, desc2 = surf.detect(img2, None, False)
desc1.shape = (-1, surf.descriptorSize())
desc2.shape = (-1, surf.descriptorSize())
with those:
surf_det = cv2.FeatureDetector_create("SURF")
surf_ext = cv2.DescriptorExtractor_create("SURF")
kp1 = surf_det.detect(img1)
kp2 = surf_det.detect(img2)
kp1, desc1 = surf_ext.compute(img1, kp1)
kp2, desc2 = surf_ext.compute(img2, kp2)
Hope this may help someone else... :D
Upvotes: 5