forked from vchukanov/cppimagefilterbase
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
39 lines (35 loc) · 972 Bytes
/
main.cpp
File metadata and controls
39 lines (35 loc) · 972 Bytes
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
#include <iostream>
#include "png_toolkit.h"
#include "png_filter.h"
#include "config_reader.h"
#include "filter_list.h"
#include <map>
int main( int argc, char *argv[] )
{
// toolkit filter_name base_pic_name sudent_tool student_pic_name limitPix limitMSE
// toolkit near test images!
try
{
if (argc != 4)
throw "Not enough arguments";
png_toolkit studTool;
config_reader configReader;
filter_list filterList;
std::vector<config_data> cnfData;
configReader.read(argv[1]);
studTool.load(argv[2]);
image_data imgData = studTool.getPixelData();
configReader.toAreaBoarders(imgData.h, imgData.w);
cnfData = configReader.getConfigData();
for (auto& item : cnfData) {
filterList.find_filter(item.nameOfFilter)->filter(imgData, item);
}
studTool.save(argv[3]);
}
catch (const char *str)
{
std::cout << "Error: " << str << std::endl;
return 1;
}
return 0;
}