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

在编译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

编译OpenCV3.4.6出现 fatal error: opencv2/xfeatures2d/cuda.hpp: No such file or directory_第1张图片

比如像这种文件,以及还有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

你可能感兴趣的:(Opencv,环境搭建等)