-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontrast.cpp
62 lines (46 loc) · 1.15 KB
/
contrast.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#if 0
#include<opencv2/core/core.hpp>
#include<opencv2/highgui/highgui.hpp>
#include<iostream>
using namespace std;
using namespace cv;
int contrast(int value)
{
const char in_win[] = "Orig.image";
const char out_win[] = "Image converted...(no saved)";
int TBvalContrast = value;
Mat out_img;
/*if (argc != 2)
{
cout << "Usage: <cmd><input image_file>" << endl;
return -1;
}*/
Mat in_img = imread("E:\\Testimage\\lena.bmp");
if (in_img.empty())
{
cout << "Error !!! Image cannot be loaded..." << endl;
return -1;
}
namedWindow(in_win);
moveWindow(in_win, 0, 0);
imshow(in_win, in_img);
waitKey(30);
namedWindow(out_win);
createTrackbar("Contrast", out_win, &TBvalContrast, 100);
cout << "Press ESC key to exit..." << endl;
while (true)
{
in_img.convertTo(out_img, -1, TBvalContrast / 50.0);
imshow(out_win, out_img);
if (waitKey(50) == 27)
{
break;
}
}
}
int main(int argc, char* argv[])
{
contrast(50);
return 0;
}
#endif