是在make那一步出的问题
/opencv-3.4.5/modules/stitching/include/opencv2/stitching/detail/matchers.hpp:206:11: error: ‘SURF_CUDA’ in namespace ‘cv::cuda’ does not name a type
cuda::SURF_CUDA surf_;
网上查到的教程一般是在告诉你把cmakelists中206行的OCV_OPTION(OPENCV_ENABLE_NONFREE "Enable non-free algorithms" ON)最后的OFF改成ON,但我在cmake的时候已经将OPENCV_ENABLE_NONFREE= True设置好了
于是打开报错文件matcher.hpp,
# include "/home/zsh/opencv-3.4.5/modules/core/include/opencv2/core/cuda.hpp"
去这个cuda.hpp内确实没有找到SURF_CUDA这个类,自己尝试写了个这个名字的空类,又显示重定义
/home/zsh/opencv-3.4.5/opencv_contrib-3.4.5/modules/xfeatures2d/include/opencv2/xfeatures2d/cuda.hpp:86:18: error: redefinition of ‘class cv::cuda::SURF_CUDA’
class CV_EXPORTS SURF_CUDA
所以其实这个类本身存在,只是路径错了,把matchers.hpp内的目录改掉就正常编译了