在Ubuntu 18.04中从源代码编译OpenCV

时间:2018-12-13 23:14:19

标签: python-3.x opencv

我正在运行Ubuntu 18.04 LTS的虚拟机中工作。我已经下载了openCV版本4.0.0,以及最新的opencv_contrib分支。我在opencv文件夹中创建了一个构建目录,并使用以下命令运行cmake:

cmake -D CMAKE_BUILD_TYPE=RELEASE     -D CMAKE_INSTALL_PREFIX=/usr/local     -D INSTALL_C_EXAMPLES=ON     -D INSTALL_PYTHON_EXAMPLES=ON     -D OPENCV_EXTRA_MODULES_PATH=~/opencv_build/opencv_contrib/modules     -D BUILD_EXAMPLES=ON ..-DPYTHON_DEFAULT_EXECUTABLE=$(which python3) ..

但是,当我尝试运行make -j3时,出现此错误:

modules/python3/CMakeFiles/opencv_python3.dir/build.make:62: recipe for target 'modules/python3/CMakeFiles/opencv_python3.dir/__/src2/cv2.cpp.o' failed
make[2]: *** [modules/python3/CMakeFiles/opencv_python3.dir/__/src2/cv2.cpp.o] Error 1
CMakeFiles/Makefile2:24707: recipe for target 'modules/python3/CMakeFiles/opencv_python3.dir/all' failed
make[1]: *** [modules/python3/CMakeFiles/opencv_python3.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 96%] Built target example_tutorial_SURF_detection_Demo
[ 96%] Linking CXX executable ../../bin/example_tutorial_SURF_FLANN_matching_Demo
[ 96%] Built target example_tutorial_SURF_FLANN_matching_Demo
Makefile:162: recipe for target 'all' failed
make: *** [all] Error 2

我已经确认已安装python 3.6.7版本。当我检查错误中的目标文件所在的目录时,它为空。我最终希望在Java中使用openCV,使用openCV在我的javafx应用程序中捕获网络摄像头。

0 个答案:

没有答案