代码之家  ›  专栏  ›  技术社区  ›  Mahesh Chand

在ubuntu 18.04上安装openCV 2.4.9面临问题

  •  0
  • Mahesh Chand  · 技术社区  · 5 年前

    我正试图在Ubuntu18.0上安装openCv 我遵循了这些步骤 blog

    但当我运行这个命令时

    制作

    它抛出以下错误

    [ 57%] Built target opencv_perf_ocl
    [ 57%] Built target opencv_nonfree
    [ 57%] Built target opencv_perf_nonfree
    [ 58%] Built target opencv_test_nonfree
    [ 58%] Building CXX object modules/contrib/CMakeFiles/opencv_contrib.dir/src/chamfermatching.cpp.o
    /home/knoldus/opencv-2.4.9/modules/contrib/src/chamfermatching.cpp: In member function ‘void cv::ChamferMatcher::Matching::computeDistanceTransform(cv::Mat&, cv::Mat&, cv::Mat&, float, float, float)’:
    /home/knoldus/opencv-2.4.9/modules/contrib/src/chamfermatching.cpp:969:30: error: the compiler can assume that the address of ‘annotate_img’ will never be NULL [-Werror=address]
                 if (&annotate_img!=NULL) {
                                  ^
    /home/knoldus/opencv-2.4.9/modules/contrib/src/chamfermatching.cpp:1016:34: error: the compiler can assume that the address of ‘annotate_img’ will never be NULL [-Werror=address]
                     if (&annotate_img!=NULL) {
                                      ^
    /home/knoldus/opencv-2.4.9/modules/contrib/src/chamfermatching.cpp: In member function ‘cv::ChamferMatcher::Match* cv::ChamferMatcher::Matching::localChamferDistance(cv::Point, cv::Mat&, cv::Mat&, cv::ChamferMatcher::Template*, float)’:
    /home/knoldus/opencv-2.4.9/modules/contrib/src/chamfermatching.cpp:1111:25: error: the compiler can assume that the address of ‘orientation_img’ will never be NULL [-Werror=address]
         if (&orientation_img!=NULL) {
                             ^
    /home/knoldus/opencv-2.4.9/modules/contrib/src/chamfermatching.cpp:1111:5: warning: nonnull argument ‘orientation_img’ compared to NULL [-Wnonnull-compare]
         if (&orientation_img!=NULL) {
         ^~
    /home/knoldus/opencv-2.4.9/modules/contrib/src/chamfermatching.cpp: In member function ‘void cv::ChamferMatcher::Matching::computeDistanceTransform(cv::Mat&, cv::Mat&, cv::Mat&, float, float, float)’:
    /home/knoldus/opencv-2.4.9/modules/contrib/src/chamfermatching.cpp:1016:17: warning: nonnull argument ‘annotate_img’ compared to NULL [-Wnonnull-compare]
                     if (&annotate_img!=NULL) {
                     ^~
    /home/knoldus/opencv-2.4.9/modules/contrib/src/chamfermatching.cpp:969:13: warning: nonnull argument ‘annotate_img’ compared to NULL [-Wnonnull-compare]
                 if (&annotate_img!=NULL) {
                 ^~
    cc1plus: some warnings being treated as errors
    modules/contrib/CMakeFiles/opencv_contrib.dir/build.make:158: recipe for target 'modules/contrib/CMakeFiles/opencv_contrib.dir/src/chamfermatching.cpp.o' failed
    make[2]: *** [modules/contrib/CMakeFiles/opencv_contrib.dir/src/chamfermatching.cpp.o] Error 1
    CMakeFiles/Makefile2:2974: recipe for target 'modules/contrib/CMakeFiles/opencv_contrib.dir/all' failed
    make[1]: *** [modules/contrib/CMakeFiles/opencv_contrib.dir/all] Error 2
    Makefile:151: recipe for target 'all' failed
    make: *** [all] Error 2
    
    0 回复  |  直到 5 年前
        1
  •  4
  •   Christoffer    5 年前

    安装旧版本的opencv可能会导致很多问题,如本问题所述(请查看注释)。

    • 关于CxCompiler检测的Cmake错误的解决方案可以是 建立 here
    • 解决方案 fatal error: stdlib.h: No such file or directory 可以 被发现 here
    • 最新版本的 问题可以在补丁中找到 here