为python安装带有额外模块(sift、surf…)的OpenCV 3.0

为python安装带有额外模块(sift、surf…)的OpenCV 3.0,python,opencv,Python,Opencv,我尝试(多次)使用额外的软件包(sift、surf…)为python安装OpenCV 3.0,但我总是失败,我真的被卡住了。 我在主环境中试过,然后在虚拟环境中试过 以下是我所做的: cd git git clone https://github.com/Itseez/opencv_contrib.git cd .. wget https://github.com/Itseez/opencv/archive/3.0.0-beta.zip unzip 3.0.0-beta.zip cd openc

我尝试(多次)使用额外的软件包(sift、surf…)为python安装OpenCV 3.0,但我总是失败,我真的被卡住了。 我在主环境中试过,然后在虚拟环境中试过

以下是我所做的:

cd git
git clone https://github.com/Itseez/opencv_contrib.git
cd ..
wget https://github.com/Itseez/opencv/archive/3.0.0-beta.zip
unzip 3.0.0-beta.zip
cd opencv-3.0.0-beta/
mkdir release
cd release/
workon OCR
cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/home/jbd/src/opencv-3.0.0b -D OPENCV_EXTRA_MODULES_PATH=/home/jbd/git/opencv_contrib/modules -D BUILD_opencv_python3=ON -D PYTHON2_EXECUTABLE=/home/jbd/.virtualenv/OCR/bin/python -D PYTHON_INCLUDE_DIR=/home/jbd/.virtualenv/OCR/include/python2.7 -D PYTHON_LIBRARY=/usr/lib/libpython2.7.so -D PYTHON2_NUMPY_INCLUDE_DIRS=/home/jbd/.virtualenv/OCR/local/lib/python2.7/site-packages/numpy ..
make -j7
make install
cd ~/.virtualenv/OCR/lib/python2.7/site-packages/
ln -s /home/jbd/src/opencv-3.0.0b/lib/python2.7/site-packages/cv2.so
无论我以何种方式安装它,我都会得到:

回溯(最近一次呼叫最后一次): 文件“/home/jbd/git/ocr/test.py”,第10行,在 sift=cv2.xfeature2d.sift() AttributeError:“模块”对象没有属性“SIFT”

与:

如果有人发现我错了

非常感谢

>>> help(cv2.xfeatures2d)
Help on module cv2.xfeatures2d in cv2:

NAME
    cv2.xfeatures2d

FILE
    (built-in)

FUNCTIONS
    SIFT_create(...)
        SIFT_create([,nfeatures[,nOctaveLayers[,contrastThreshold[,edgeThreshold[,sigma]]]]) -> retval

    SURF_create(...)
        SURF_create([,hessianThreshold[,nOctaves[,nOctaveLayers[,extended[,upright]]]]]) -> retval

在opencv3.0中,您必须使用
XXXX\u create()
函数来获取实例 因此,它是:

orb = cv2.ORB_create()
以及:


在opencv3.0中,您必须使用
XXXX\u create()
函数来获取实例 因此,它是:

orb = cv2.ORB_create()
以及:


非常感谢,我错过了,我的安装终于好了:)非常感谢,我错过了,我的安装终于好了:)
sift = cv2.xfeatures2d.SIFT_create()
sift.detect(...)
sift.compute(...)