cv2 'module' object has no attribute 'drawMatchesKnn'

asked 2016-02-09 00:47:27 -0500

vinllen gravatar image

My python version is 2.7, and i also install pyopencv, but the code cv2.drawMatches throws an error:

Traceback (most recent call last):
  File "", line 26, in <module>
    img3 = cv2.drawMatchesKnn(img1,kp1,img2,kp2,good,flags=2)
AttributeError: 'module' object has no attribute 'drawMatchesKnn'

I also install python-3.4, and when i switch python version to 3.4, and install opencv-3.1, it looks like cv2 module cannot work in my computer:

Python 3.4.0 (default, Feb  5 2016, 19:51:52)
[GCC 4.2.1 Compatible Apple LLVM 6.1.0 (clang-602.0.53)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named 'cv2'

Could anyone help me ? Thanks very much!

edit retag flag offensive close merge delete


os ? opencv version ?

you will need opencv3 for drawMatchesKnn

berak gravatar imageberak ( 2016-02-09 01:00:32 -0500 )edit