运行环境:win10+opencv3.4+vs2017
imread:读取图像,输入参数为图像路径;
#include <opencv2/opencv.hpp>
#include <iostream>
using namespace cv;
using namespace std;
int main(int artc, char** argv) {
Mat src = imread("D:/test.png");
if (src.empty())
{
printf("could not load image... ");
return -1;
}
namedWindow("input", CV_WINDOW_AUTOSIZE);//构建一个窗口,自适应图片大小
imshow("input", src);//显示
waitKey(0);
return 0;
}