Skip to content

Commit e2267f9

Browse files
authored
Add files via upload
1 parent c199f27 commit e2267f9

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

histogramEqualization.cpp

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#include "opencv2/highgui.hpp"
2+
#include "opencv2/imgproc.hpp"
3+
4+
int main(int args, char** argv) {
5+
6+
cv::Mat img, result;
7+
img = cv::imread(argv[1]);
8+
9+
cv::namedWindow("Input Image", cv::WINDOW_AUTOSIZE);
10+
cv::namedWindow("Histogram Equalized Image", cv::WINDOW_AUTOSIZE);
11+
12+
if(img.empty()) {
13+
printf("No image path given as imput");
14+
return 1;
15+
}
16+
17+
cv::cvtColor(img, img, cv::COLOR_BGR2GRAY);
18+
19+
cv::equalizeHist(img, result);
20+
21+
cv::cvtColor(result, result, cv::COLOR_GRAY2BGR);
22+
23+
cv::imshow("Input Image", img);
24+
cv::imshow("Histogram Equalized Image", result);
25+
26+
cv::waitKey(0);
27+
return 0;
28+
}
29+
30+

0 commit comments

Comments
 (0)