#include<opencv2/opencv.hpp>
#include<iostream>
using namespace std;
using namespace cv;
int main()
{
Mat img;
Mat a = (Mat_<int>(3, 3) << 1, 2, 3, 4, 5, 6, 7, 8, 9);
img = imread("C:/opencv/lena.png", IMREAD_COLOR);
Mat gray = imread("C:/opencv/lena.png", IMREAD_GRAYSCALE);
waitKey(0);
return 0;
}
使用image Watch 查看灰度图与原图
效果如下: