编译OpenCV3.4.6出现 fatal error: opencv2/xfeatures2d/cuda.hpp: No such file or directory

  • Post author:
  • Post category:其他


在编译stitching模块时会提示:


找不到cuda.hpp即matchers.hpp:52:42: fatal error: opencv2/xfeatures2d/cuda.hpp: No such file or directory



解决方法

opencv/modules/stitching/CMakeLists.txt文件中加入一条语句使其include opencv_contrib/modules/xfeatures2d/include,可以是绝对路径,如

INCLUDE_DIRECTORIES("/home/spring/Soft/opencv3.4.2/opencv_contrib/modules/xfeatures2d/include"

编译时有很多文件会下载超时,毕竟是去github上去下载的,网速很慢,建议用cmake-gui

在这里插入图片描述

比如像这种文件,以及还有ippicv_2019_lnx_intel64_general_20180723.tgz 和face_landmark_model.dat等等。

error while loading shared libraries: libopencv_xfeatures2d.so.3.4: cannot open shared object file

找到libopencv_开头到库的目录,在

/usr/local/lib

下面,在

/etc/ld.so.conf.d/

下面新建一个opencv.conf(可能已经存在),

里面写入

/usr/local/lib

最后执行下

sudo ldconfig -v

即可

本文转载自:https://www.cnblogs.com/minglou/articles/11110713.html