#include <iostream>
#include<opencv2/opencv.hpp>
using namespace cv;
int main(int argc, char** argv) {
//读取图片文件
Mat src = imread("./images/faces.png");
//检查文件是否存在
if (src.empty()) {
printf("could not load image...\n");
return -1;
}
//展示图片
namedWindow("test opencv setup", CV_WINDOW_AUTOSIZE);
imshow("test opencv setup", src);
//修改图片
Mat output_images;
cvtColor(src, output_images, CV_BGR2GRAY);
namedWindow("output window", CV_WINDOW_AUTOSIZE);
imshow("output gray images", output_images);
//保存图片
imwrite("./images/facesgray.png", output_images);
waitKey(0);
return 0;
}
openCV3学习笔记一,图像的加载,修改,保存
最新推荐文章于 2020-10-24 20:14:23 发布