modified options for fifth method

This commit is contained in:
Phuntsok Drak-pa 2019-04-13 15:09:07 +02:00
parent d2393561d6
commit 87beb6fe8b
3 changed files with 30 additions and 18 deletions

View File

@ -4,7 +4,13 @@
#include <filesystem>
#include <tuple>
[[nodiscard]] auto parse_args(int, char**) -> std::
tuple<std::filesystem::path, std::filesystem::path, int, int, int, bool, bool>;
[[nodiscard]] auto parse_args(int, char**) -> std::tuple<std::filesystem::path,
std::filesystem::path,
int,
int,
int,
int,
bool,
bool>;
#endif /* GENETIC_IMAGE_INCLUDE_GENIMG_PARSEARGS_HH_ */

View File

@ -7,9 +7,12 @@
int main(int ac, char** av)
{
std::srand(std::time(nullptr));
auto const [input_file, output_file, iterations, method, division,
auto [input_file, output_file, iterations, method, columns, rows,
controlled_size, verbose]
= parse_args(ac, av);
if (rows == 0) {
rows = columns;
}
spdlog::set_level(verbose ? spdlog::level::debug : spdlog::level::info);
spdlog::set_pattern("[thread %t] %+");
spdlog::debug("Input file:\t{}", input_file.native());

View File

@ -22,7 +22,7 @@ void processFilenames(po::variables_map const& vm,
}
[[nodiscard]] auto parse_args(int t_ac, char** t_av)
-> std::tuple<path, path, int, int, int, bool, bool>
-> std::tuple<path, path, int, int, int, int, bool, bool>
{
po::options_description desc("Allowed options");
desc.add_options()
@ -32,11 +32,14 @@ void processFilenames(po::variables_map const& vm,
"Image output path (default: \"output_\" + input path)")
("iterations,n", po::value<int>(), "Number of iterations (default: 2000)")
("method,m", po::value<int>(), "Method number to be used (default: 1)")
("division,d", po::value<int>(),
"For method 5, number of regions the reference image should be divided "
"into. For instance, -d4 will divide the reference image into a 4*4 "
"matrice of smaller images. (default: 1)")
("size,s", "Controlled size of the random shapes (default: false)")
("columns,c", po::value<int>(),
"For method 5 only, number of columns the reference image should be "
"divided into. (default: 1)")
("rows,r", po::value<int>(),
"For method 5 only, number of rows the reference image should be "
"divided into. If the value is equal to 0, then it will be assumed "
"there will be as many rows as there are collumns. (default: 0)")
("size,s", "Enables controlled size of the random shapes")
("verbose,v", "Enables verbosity");
po::variables_map vm;
po::store(po::parse_command_line(t_ac, t_av, desc), vm);
@ -55,7 +58,7 @@ void processFilenames(po::variables_map const& vm,
input_path, output_path,
vm.count("iterations") ? vm["iterations"].as<int>() : DEFAULT_ITERATIONS,
vm.count("method") ? vm["method"].as<int>() : 1,
vm.count("division") ? vm["division"].as<int>() : 1,
vm.count("size"),
vm.count("column") ? vm["column"].as<int>() : 1,
vm.count("rows") ? vm["rows"].as<int>() : 0, vm.count("size"),
vm.count("verbose"));
}