【问题标题】:Facing issue installing openCV 2.4.9 on ubuntu 18.04在 ubuntu 18.04 上安装 openCV 2.4.9 时遇到问题
【发布时间】:2019-02-21 09:14:08
【问题描述】:

我正在尝试在 ubuntu 18.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

【问题讨论】:

  • 为什么要安装这么老版本的opencv。现在甚至可以使用 opencv 4。
  • 实际上,我现在正在做一个使用这个版本的 opnCv 的项目。所以我必须下载相同的版本。我无法将其升级到最新版本
  • 看看here
  • @MaheshChandKandpal 相关问题及解答可在here
  • @MaheshChandKandpal 我想你可以用这个补丁修复它here 但我不确定..

标签: opencv ubuntu installation ubuntu-18.04


【解决方案1】:

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

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

【讨论】:

  • 在运行我的应用程序时,运行时错误未定义符号失败:_ZN2cv8imencodeERKSsRKNS_11_InputArrayERSt6vectorIhSaIhEERKS5_IiSaIiEE 你对此有什么想法吗?
猜你喜欢
  • 1970-01-01
  • 2019-11-11
  • 1970-01-01
  • 2020-12-13
  • 2021-12-01
  • 2019-02-05
  • 2012-08-27
  • 2015-07-26
  • 1970-01-01
相关资源
最近更新 更多