2019-03-19 13:49:57 +00:00
|
|
|
#include "common.hh"
|
2019-03-24 18:43:25 +00:00
|
|
|
#include "methods.hh"
|
2019-03-20 11:34:46 +00:00
|
|
|
#include "parseargs.hh"
|
2019-03-24 18:43:25 +00:00
|
|
|
#include <iostream>
|
2019-03-25 11:24:19 +00:00
|
|
|
#include <cstdlib>
|
|
|
|
#include <ctime>
|
2019-03-19 10:15:42 +00:00
|
|
|
|
2019-03-19 12:49:37 +00:00
|
|
|
int main(int ac, char **av) {
|
2019-03-25 11:24:19 +00:00
|
|
|
std::srand(std::time(nullptr));
|
2019-03-24 20:34:04 +00:00
|
|
|
auto const [input_file, output_file, iterations, method,
|
2019-03-24 18:43:25 +00:00
|
|
|
verbose] = parse_args(ac, av);
|
|
|
|
spdlog::set_level(verbose ? spdlog::level::debug : spdlog::level::info);
|
|
|
|
spdlog::debug("Input file:\t{}", input_file.native());
|
|
|
|
spdlog::debug("Output file:\t{}", output_file.native());
|
|
|
|
spdlog::debug("Iterations:\t{}", iterations);
|
2019-03-20 11:34:46 +00:00
|
|
|
auto [input_image, process_image] = init_image(input_file.native());
|
2019-03-19 10:15:42 +00:00
|
|
|
|
2019-03-20 19:14:55 +00:00
|
|
|
switch (method) {
|
|
|
|
case 1: {
|
2019-03-25 11:24:19 +00:00
|
|
|
method1(input_image, process_image, iterations);
|
2019-03-20 19:14:55 +00:00
|
|
|
break;
|
|
|
|
}
|
2019-03-21 01:49:00 +00:00
|
|
|
case 2: {
|
2019-03-25 11:24:19 +00:00
|
|
|
method2(input_image, process_image, iterations);
|
2019-03-21 01:49:00 +00:00
|
|
|
break;
|
|
|
|
}
|
2019-03-20 19:14:55 +00:00
|
|
|
default:
|
|
|
|
spdlog::error("Requested method {} is not implemented.");
|
|
|
|
std::exit(-1);
|
|
|
|
}
|
2019-03-20 11:34:46 +00:00
|
|
|
|
|
|
|
cv::imwrite(output_file.native(), process_image);
|
2019-03-19 09:14:19 +00:00
|
|
|
return 0;
|
|
|
|
}
|