爲了解決這個錯誤,我嘗試添加額外的模塊opencv-contrib-master從https://github.com/opencv/opencv_contrib.git我遵循自述文件中給出的步驟。 MD文件,但在運行「讓」我讓下面的輸出:AttributeError:'模塊'對象沒有屬性'xfeatures2d'[python/opencv 3.1.0 dev]
[ 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。在'make'之前,我跑了:
cmake -DOPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules /usr/local .. -DWITH_IPP=OFF -DWITH_OPENGL=ON -DWITH_QT=ON -DBUILD_EXAMPLES=ON
我接近許多資源但沒有結果。任何形式的幫助都是可觀的。
我得到了解決......問題是,我是不是我的額外模塊即xfeatures2d被存儲在哪裏分配路徑。 thanx您的回覆:) – Glachas
這是奇怪的,你已經在cmake的選項'cmake的-DOPENCV_EXTRA_MODULES_PATH = ../../opencv_contrib/modules'是假定了額外moudules是(或者xfeatures2d)定義。也許你已經定義了一條錯誤的道路? –
我也不知道它爲什麼起作用。我也很驚訝,即使在運行cmake的時候提供了路徑,但它並沒有在opencv build/module目錄中添加模塊。我只觀察到extra_modules沒有鏈接的錯誤,所以我嘗試了上面的命令。 – Glachas