diff --git a/include/genimg/parseargs.hh b/include/genimg/parseargs.hh index 484ac2c..51df852 100644 --- a/include/genimg/parseargs.hh +++ b/include/genimg/parseargs.hh @@ -4,7 +4,13 @@ #include #include -[[nodiscard]] auto parse_args(int, char**) -> std:: -tuple; +[[nodiscard]] auto parse_args(int, char**) -> std::tuple; #endif /* GENETIC_IMAGE_INCLUDE_GENIMG_PARSEARGS_HH_ */ diff --git a/src/main.cc b/src/main.cc index fe76031..f13de5f 100644 --- a/src/main.cc +++ b/src/main.cc @@ -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()); diff --git a/src/parseargs.cc b/src/parseargs.cc index 9e290a2..26c959f 100644 --- a/src/parseargs.cc +++ b/src/parseargs.cc @@ -22,22 +22,25 @@ void processFilenames(po::variables_map const& vm, } [[nodiscard]] auto parse_args(int t_ac, char** t_av) --> std::tuple + -> std::tuple { po::options_description desc("Allowed options"); desc.add_options() - ("help,h", "Display this help message") - ("input,i", po::value(), "Input image") - ("output,o", po::value(), - "Image output path (default: \"output_\" + input path)") - ("iterations,n", po::value(), "Number of iterations (default: 2000)") - ("method,m", po::value(), "Method number to be used (default: 1)") - ("division,d", po::value(), - "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)") - ("verbose,v", "Enables verbosity"); + ("help,h", "Display this help message") + ("input,i", po::value(), "Input image") + ("output,o", po::value(), + "Image output path (default: \"output_\" + input path)") + ("iterations,n", po::value(), "Number of iterations (default: 2000)") + ("method,m", po::value(), "Method number to be used (default: 1)") + ("columns,c", po::value(), + "For method 5 only, number of columns the reference image should be " + "divided into. (default: 1)") + ("rows,r", po::value(), + "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); po::notify(vm); @@ -55,7 +58,7 @@ void processFilenames(po::variables_map const& vm, input_path, output_path, vm.count("iterations") ? vm["iterations"].as() : DEFAULT_ITERATIONS, vm.count("method") ? vm["method"].as() : 1, - vm.count("division") ? vm["division"].as() : 1, - vm.count("size"), + vm.count("column") ? vm["column"].as() : 1, + vm.count("rows") ? vm["rows"].as() : 0, vm.count("size"), vm.count("verbose")); }