34 lines
702 B
C++
34 lines
702 B
C++
|
|
#include "histo.h"
|
||
|
|
#include <opencv2/core.hpp>
|
||
|
|
#include <opencv2/highgui.hpp>
|
||
|
|
#include <opencv2/imgproc.hpp>
|
||
|
|
#include <iostream>
|
||
|
|
|
||
|
|
using namespace cv;
|
||
|
|
|
||
|
|
int main(){
|
||
|
|
Mat img = imread("../orange1.jpg", IMREAD_COLOR);
|
||
|
|
Mat dest, hsv;
|
||
|
|
|
||
|
|
cvtColor(img, hsv, COLOR_BGR2HSV);
|
||
|
|
|
||
|
|
imshow("img", img);
|
||
|
|
Histo::showHisto(img);
|
||
|
|
|
||
|
|
std::vector<Mat> chs;
|
||
|
|
split(hsv, chs);
|
||
|
|
|
||
|
|
//equalizeHist(chs[0], chs[0]); //if using Lab this is the channel that need to be used
|
||
|
|
//equalizeHist(chs[1], chs[1]);
|
||
|
|
equalizeHist(chs[2], chs[2]);
|
||
|
|
|
||
|
|
merge(chs, dest);
|
||
|
|
cvtColor(dest, dest, COLOR_HSV2BGR);
|
||
|
|
|
||
|
|
imshow("dest", dest);
|
||
|
|
Histo::showHisto(dest, "eredmeny");
|
||
|
|
|
||
|
|
waitKey();
|
||
|
|
return 0;
|
||
|
|
}
|