以下是我的cmake选项:
cmake -D WITH_TBB = ON -D WITH_EIGEN = ON -D BUILD_DOCS = ON -D BUILD_TESTS = OFF -D BUILD_PERF_TESTS = OFF -D BUILD_EXAMPLES = OFF -D WITH_OPENCL = OFF -D WITH_CUDA = OFF -D BUILD_opencv_gpu = OFF - d BUILD_opencv_gpuarithm = OFF -D BUILD_opencv_gpubgsegm = OFF -D BUILD_opencv_gpucodec = OFF -D BUILD_opencv_gpufeatures2d = OFF -D BUILD_opencv_gpufilters = OFF -D BUILD_opencv_gpuimgproc = OFF -D BUILD_opencv_gpulegacy = OFF -D BUILD_opencv_gpuoptflow = OFF -D BUILD_opencv_gpustereo = OFF -D BUILD_opencv_gpuwarping = OFF - D CMAKE_BUILD_TYPE = RELEASE -D CMAKE_INSTALL_PREFIX = / usr / local -D PYTHON_DEFAULT_EXECUTABLE = / usr / local / bin / python -D PYTHON_EXECUTABLE = / usr / local / bin / python -D PYTHON_INCLUDE_DIRS = / usr / local / include / python3.5m -D PYTHON_LIBRARY = / usr / local / lib / libpython3.5m.so ../../ opencv-3.1.0
我只需输入:
import cv2
cv2.xfeatures2d.SURF_create(400)
然后发生错误:
追踪(最近一次通话): 文件"",第1行,in AttributeError:module' cv2'没有属性' xfeatures2d'
导致此问题的可能原因是什么?