#include<opencv2/opencv.hpp> #include<iostream> #include<math.h> using namespace cv; int main(int argc, char** argv) { Mat src = imread("C:/Users/Administrator/Desktop/1.png", IMREAD_ANYCOLOR); if (src.empty()) { printf("colud not load image\n"); return -1; } namedWindow("test open setup", CV_WINDOW_AUTOSIZE); //第一个参数表示窗口的名字, src表示数据 imshow("test open setup", src); namedWindow("output windows", CV_WINDOW_AUTOSIZE); Mat output_show; cvtColor(src, output_show, CV_BGR2HLS); imshow("output windows", output_show); imwrite("C:/Users/Administrator/Desktop/2.png", output_show); waitKey(0); return 0; }