PyCharm:将SIFT与opencv-contrib(Mac)结合使用

时间:2019-06-29 08:05:13

标签: macos opencv pycharm opencv-contrib

我有一个Python / OpenCV项目,正在尝试使用来自opencv-contrib的xfeatures2d模块。我正在使用Mac,而我的IDE是PyCharm。我已经通过“首选项”>“项目解释器”安装了软件包opencv-contrib-python和opencv-python。

但是,当我尝试运行下面的代码时,出现以下错误:

import cv2
import numpy as np

img = cv2.imread("NotreDame.jpg", 0)

sift = cv2.xfeatures2d.SIFT_create()


line 6, in <module>
sift = cv2.xfeatures2d.SIFT_create()
cv2.error: OpenCV(4.1.0) /Users/travis/build/skvark/opencv-python/opencv_contrib/modules/xfeatures2d/src/sift.cpp:1207: error: (-213:The function/feature is not implemented) This algorithm is patented and is excluded in this configuration; Set OPENCV_ENABLE_NONFREE CMake option and rebuild the library in function 'create'

我已经使用以下方法在计算机上安装了opencv和opencv-contrib:

 $ pip install opencv-python==3.4.2.17
 $ pip install opencv-contrib-python==3.4.2.17

我不确定如何解决此错误。任何见解都会受到赞赏。

0 个答案:

没有答案