AttributeError:'模块'对象没有属性' xfeatures2d' [python / opencv 3.1.0 dev]

时间:2016-09-19 21:56:57

标签: python-2.7 cmake ubuntu-14.04 opencv3.0 gcc4.9

要解决此错误,我尝试从https://github.com/opencv/opencv_contrib.git添加额外模块opencv-contrib-master我按照readme.md文件中给出的步骤进行操作,但在运行' make'我得到以下输出:

[  4%] Built target libwebp
[  4%] Built target opencv_core_pch_dephelp
[  4%] Built target pch_Generate_opencv_core
Scanning dependencies of target opencv_core
[  4%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/system.cpp.o
Linking CXX shared library ../../lib/libopencv_core.so
[  7%] Built target opencv_core
[  7%] Built target opencv_ts_pch_dephelp
[  7%] Built target pch_Generate_opencv_ts
[  7%] Built target opencv_imgproc_pch_dephelp
[  8%] Built target pch_Generate_opencv_imgproc
Linking CXX shared library ../../lib/libopencv_imgproc.so
[ 11%] Built target opencv_imgproc
[ 11%] Built target opencv_imgcodecs_pch_dephelp
[ 11%] Built target pch_Generate_opencv_imgcodecs
Linking CXX shared library ../../lib/libopencv_imgcodecs.so
[ 12%] Built target opencv_imgcodecs
[ 12%] Built target opencv_videoio_pch_dephelp
[ 12%] Built target pch_Generate_opencv_videoio
Linking CXX shared library ../../lib/libopencv_videoio.so
[ 13%] Built target opencv_videoio
[ 13%] Built target opencv_highgui_pch_dephelp
[ 13%] Built target pch_Generate_opencv_highgui
Linking CXX shared library ../../lib/libopencv_highgui.so
[ 14%] Built target opencv_highgui
[ 14%] Built target opencv_ts
[ 14%] Built target opencv_perf_core_pch_dephelp
[ 14%] Built target pch_Generate_opencv_perf_core
Linking CXX executable ../../bin/opencv_perf_core
[ 16%] Built target opencv_perf_core
[ 16%] Built target opencv_test_core_pch_dephelp
[ 16%] Generating test_precomp.hpp.gch/opencv_test_core_RELEASE.gch
In file included from <command-line>:0:0:
/usr/include/stdc-predef.h:1:0: fatal error: can’t create precompiled header /home/chandu/Opencv/opencv/release/modules/core/test_precomp.hpp.gch/opencv_test_core_RELEASE.gch: Permission denied
 /* Copyright (C) 1991-2014 Free Software Foundation, Inc.
  ^
  compilation terminated.
  Preprocessed source stored into /tmp/cchn5Yvk.out file, please attach this to your bugreport.
 ERROR: Cannot create report: [Errno 17] File exists: '/var/crash/_usr_lib_gcc_x86_64-linux-gnu_4.9_cc1plus.1000.crash'
 make[2]: *** [modules/core/test_precomp.hpp.gch/opencv_test_core_RELEASE.gch] Error 1
 make[1]: *** [modules/core/CMakeFiles/pch_Generate_opencv_test_core.dir/all] Error 2
 make: *** [all] Error 2

有人告诉gcc版本可能有问题,但我更新了gcc版本但没有成功。我正在使用版本4.9.4的gcc和版本14.04.1的ubuntu。之前&#39;制作&#39;我跑了一步:

cmake -DOPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules /usr/local .. -DWITH_IPP=OFF -DWITH_OPENGL=ON -DWITH_QT=ON -DBUILD_EXAMPLES=ON

我找到了很多资源但没有结果。任何形式的帮助都是值得的。

2 个答案:

答案 0 :(得分:0)

您是否尝试使用sudo预先添加命令?

答案 1 :(得分:0)

问题是xfeatures2d没有从opencv-contrib模块导出。所以,当我跑步时,制作&#39;命令它无法将该模块添加到opencv构建模块。 我运行了以下命令,后跟make命令:

 export xfeatures2d=/path/to/opencv_contrib/modules/ 

它对我有用。