#include<iostream>
#include<opencv2/highgui/highgui.hpp>
#include<opencv2/imgproc/imgproc.hpp>
using namespace cv;
using namespace std;
//直方图均衡化
int main()
{
//加载源图像
Mat srcImage, dstImage;
srcImage = imread("Image.png");
if (!srcImage.data)
{
cerr << "Can not open the Image!" << endl;
return EXIT_FAILURE;
}
imshow("源图像", srcImage);
//转为灰度图像
cvtColor(srcImage, srcImage, COLOR_BGR2GRAY);
//直方图均衡化
equalizeHist(srcImage,dstImage);
//显示结果
imshow("直方图均衡化",dstImage);
//等待
waitKey(0);
return 0;
}