opencv.hpp头文件的内容为:
#ifndef __OPENCV_ALL_HPP__
#define __OPENCV_ALL_HPP__#include "opencv2/core.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/photo.hpp"
#include "opencv2/video.hpp"
#include "opencv2/features2d.hpp"
#include "opencv2/objdetect.hpp"
#include "opencv2/calib3d.hpp"
#include "opencv2/imgcodecs.hpp"
#include "opencv2/videoio.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/ml.hpp"
#endif
所以代码文件中直接添加:#include<opencv2/opencv.hpp>