opencv_contrib编译:fatal error: opencv2/xfeatures2d/cuda.hpp: No such file or directory

在Ubuntu上编译opencv3.4.2源码时,遇到下面的错误,
错误1:
/home/src/software/opencv-3.4.2/modules/stitching/include/opencv2/stitching/detail/matchers.hpp:52:42: fatal error: opencv2/xfeatures2d/cuda.hpp: No such file or directory
 #  include "opencv2/xfeatures2d/cuda.hpp"
                                          ^
compilation terminated.

解决办法1:
在/home/src/software/opencv-3.4.2/modules/stitching/CMakeLists.txt中加入:
INCLUDE_DIRECTORIES("/home/src/software/opencv-3.4.2/opencv_contrib-3.4.2/modules/xfeatures2d/include")

解决办法2:
根据报错信息,打开/home/src/software/opencv-3.4.2/modules/stitching/include/opencv2/stitching/detail/matchers.hpp文件,将52行
#include "opencv2/xfeatures2d/cuda.hpp"
替换成  #include "/home/src/software/opencv-3.4.2/opencv_contrib-3.4.2/modules/xfeatures2d/include/opencv2/xfeatures2d/cuda.hpp"

重新编译即可。


错误2:
/home/src/software/opencv-3.4.2/opencv_contrib-3.4.2/modules/xfeatures2d/src/boostdesc.cpp:693:46: fatal error: boostdesc_bgm.i: No such file or directory
           #include "boostdesc_bgm.i"
                                              ^
compilation terminated.

解决办法:
应该是boostdesc_bgm.i文件下载失败了,需要手动下载,在/home/src/software/opencv-3.4.2/build路径下找到CMakeDownloadLog.txt,打开后搜索”boostdesc_bgm.i“,复制其下载地址到网页可以看到源码,直接拷贝源码并存为同名文件,把它放在
/home/src/software/opencv-3.4.2/opencv_contrib-3.4.2/modules/xfeatures2d/src
路径下,
以下这些文件也都需要手动下载:
boostdesc_bgm.i
boostdesc_bgm_bi.i
boostdesc_bgm_hd.i
boostdesc_lbgm.i
boostdesc_binboost_064.i
boostdesc_binboost_128.i
boostdesc_binboost_256.i
vgg_generated_120.i
vgg_generated_64.i
vgg_generated_80.i
vgg_generated_48.i
把上述文件放置在上述指定路径下后,直接make重新编译即可
注:opencv源码编译教程和其它报错,大家可以看我之前的博客,祝大家安装顺利!
————————————————
版权声明:本文为CSDN博主「g_grace1」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/sinat_37322535/article/details/120088507

posted @ 2023-08-26 20:36  rainbow70626  阅读(428)  评论(0编辑  收藏  举报