Code to equalize a photograph in c++?
#include <opencv2/opencv.hpp> #include <iostream> using namespace cv; using namespace std; int main(int argc, char** argv) { Mat img = imread("../images/cat.jpg"); if (img.empty()) { cout << "Failed to open the image" << endl; return -1; } Mat ycrcb; cvtColor(img, ycrcb, COLOR_BGR2YCrCb); vector<Mat> channels; split(ycrcb, channels); equalizeHist(channels[0], channels[0]); Mat result; merge(channels, ycrcb); cvtColor(ycrcb, result, COLOR_YCrCb2BGR); imshow("image", img); imshow("result", result); waitKey(); return 0; }