-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
185 lines (184 loc) · 8.39 KB
/
main.cpp
File metadata and controls
185 lines (184 loc) · 8.39 KB
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
#include "imageProc.cpp"
int main()
{
string input_image;
int selection;
double scaling_factor;
int num_rotations;
int x_scale;
int y_scale;
string output_image;
int user_continue = 1;
cout << "************************************************" << endl;
cout << " CSPB 1300 Image Processing Application" << endl;
cout << " Coded by Mayra Weidner " << endl;
cout << "************************************************" << endl;
cout << " " << endl;
cout << "Enter input BMP file name including file extension ";
cin >> input_image;
while (user_continue == 1) // loop will run through options until user quits or inputs invalid option
{
cout << "You are currently working with " << input_image << endl;
cout << " " << endl;
cout << "-------------------------------------------" << endl;
cout << " IMAGE PROCESSING MENU" << endl;
cout << "-------------------------------------------" << endl;
cout << "1) Vignette" << endl;
cout << "2) Clarendon" << endl;
cout << "3) Grayscale" << endl;
cout << "4) Rotate 90 degrees" << endl;
cout << "5) Rotate in multiples of 90 degrees" << endl;
cout << "6) Enlarge" << endl;
cout << "7) High contrast" << endl;
cout << "8) Lighten" << endl;
cout << "9) Darken" << endl;
cout << "10) Black, white, red, green, and blue" << endl;
cout << "11) Change image" << endl;
cout << " " << endl;
cout << "Enter menu selection or Q to quit: " << endl;
cin >> selection;
if (selection == 1)
{
cout << "You selected vignette" << endl;
cout << "Enter out BMP file name including bmp file extension " << endl;
cin >> output_image;
vector<vector<Pixel>> image = read_image(input_image); // Read bmp file and store in 2D vector
vector<vector<Pixel>> new_image = process_1(image); // call using input vector and save to new vector
bool success = write_image(output_image, new_image); // Write 2D vector to file
cout << " " << endl;
cout << "***Successfully applied vignette!***" << endl;
cout << " " << endl;
}
else if (selection == 2)
{
cout << "You selected clarendon" << endl;
cout << "Enter out BMP file name including bmp file extension " << endl;
cin >> output_image;
cout << "Enter positive decimal for scaling factor (i.e. 0.3): " << endl;
cin >> scaling_factor;
vector<vector<Pixel>> image = read_image(input_image);
vector<vector<Pixel>> new_image = process_2(image, scaling_factor);
bool success = write_image(output_image, new_image);
cout << " " << endl;
cout << "***Successfully applied clarendon!***" << endl;
cout << " " << endl;
}
else if (selection == 3)
{
cout << "You selected grayscale" << endl;
cout << "Enter out BMP file name including bmp file extension " << endl;
cin >> output_image;
vector<vector<Pixel>> image = read_image(input_image);
vector<vector<Pixel>> new_image = process_3(image);
bool success = write_image(output_image, new_image);
cout << " " << endl;
cout << "***Successfully applied grayscale!***" << endl;
cout << " " << endl;
}
else if (selection == 4)
{
cout << "You selected rotate 90 degrees" << endl;
cout << "Enter out BMP file name including bmp file extension " << endl;
cin >> output_image;
vector<vector<Pixel>> image = read_image(input_image);
vector<vector<Pixel>> new_image = process_4(image);
bool success = write_image(output_image, new_image);
cout << " " << endl;
cout << "***Successfully applied 90 degree rotation!***" << endl;
cout << " " << endl;
}
else if (selection == 5)
{
cout << "You selected rotate multiple 90 degrees" << endl;
cout << "Enter out BMP file name including bmp file extension " << endl;
cin >> output_image;
cout << "Enter positive integer for number of 90 degree rotations (i.e. 2): " << endl;
cin >> num_rotations;
vector<vector<Pixel>> image = read_image(input_image);
vector<vector<Pixel>> new_image = process_5(image, num_rotations);
bool success = write_image(output_image, new_image);
cout << " " << endl;
cout << "***Successfully applied multiple 90 degree rotations!***" << endl;
cout << " " << endl;
}
else if (selection == 6)
{
cout << "You selected enlarge" << endl;
cout << "Enter out BMP file name including bmp file extension " << endl;
cin >> output_image;
cout << "Enter positive integer for x scale (i.e. 2): " << endl;
cin >> x_scale;
cout << "Enter positive integer for y scale (i.e. 3): " << endl;
cin >> y_scale;
vector<vector<Pixel>> image = read_image(input_image);
vector<vector<Pixel>> new_image = process_6(image, x_scale, y_scale);
bool success = write_image(output_image, new_image);
cout << " " << endl;
cout << "***Successfully applied enlarge!***" << endl;
cout << " " << endl;
}
else if (selection == 7)
{
cout << "You selected high contrast" << endl;
cout << "Enter out BMP file name including bmp file extension " << endl;
cin >> output_image;
vector<vector<Pixel>> image = read_image(input_image);
vector<vector<Pixel>> new_image = process_7(image);
bool success = write_image(output_image, new_image);
cout << " " << endl;
cout << "***Successfully applied high contrast!***" << endl;
cout << " " << endl;
}
else if (selection == 8)
{
cout << "You selected lighten" << endl;
cout << "Enter out BMP file name including bmp file extension " << endl;
cin >> output_image;
cout << "Enter positive decimal for scaling factor (i.e. 0.3): " << endl;
cin >> scaling_factor;
vector<vector<Pixel>> image = read_image(input_image);
vector<vector<Pixel>> new_image = process_8(image, scaling_factor);
bool success = write_image(output_image, new_image);
cout << " " << endl;
cout << "***Successfully applied lighten!***" << endl;
cout << " " << endl;
}
else if (selection == 9)
{
cout << "You selected darken" << endl;
cout << "Enter out BMP file name including bmp file extension " << endl;
cin >> output_image;
cout << "Enter positive decimal for scaling factor (i.e. 0.3): " << endl;
cin >> scaling_factor;
vector<vector<Pixel>> image = read_image(input_image);
vector<vector<Pixel>> new_image = process_9(image, scaling_factor);
bool success = write_image(output_image, new_image);
cout << " " << endl;
cout << "***Successfully applied darken!***" << endl;
cout << " " << endl;
}
else if (selection == 10)
{
cout << "You selected black, white, red, green, and blue" << endl;
cout << "Enter out BMP file name including bmp file extension " << endl;
cin >> output_image;
vector<vector<Pixel>> image = read_image(input_image);
vector<vector<Pixel>> new_image = process_10(image);
bool success = write_image(output_image, new_image);
cout << " " << endl;
cout << "***Successfully applied black, white, red, green, and blue filter!***" << endl;
cout << " " << endl;
}
else if (selection == 11)
{
cout << "What file would you like to use now? " << endl;
cin >> input_image;
}
else
{
cout << "Thank you for using my program! Quitting now..." << endl;
user_continue = 0;
}
}
return 0;
}