modified options for fifth method
This commit is contained in:
parent
d2393561d6
commit
87beb6fe8b
@ -4,7 +4,13 @@
|
|||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
#include <tuple>
|
#include <tuple>
|
||||||
|
|
||||||
[[nodiscard]] auto parse_args(int, char**) -> std::
|
[[nodiscard]] auto parse_args(int, char**) -> std::tuple<std::filesystem::path,
|
||||||
tuple<std::filesystem::path, std::filesystem::path, int, int, int, bool, bool>;
|
std::filesystem::path,
|
||||||
|
int,
|
||||||
|
int,
|
||||||
|
int,
|
||||||
|
int,
|
||||||
|
bool,
|
||||||
|
bool>;
|
||||||
|
|
||||||
#endif /* GENETIC_IMAGE_INCLUDE_GENIMG_PARSEARGS_HH_ */
|
#endif /* GENETIC_IMAGE_INCLUDE_GENIMG_PARSEARGS_HH_ */
|
||||||
|
@ -7,9 +7,12 @@
|
|||||||
int main(int ac, char** av)
|
int main(int ac, char** av)
|
||||||
{
|
{
|
||||||
std::srand(std::time(nullptr));
|
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]
|
controlled_size, verbose]
|
||||||
= parse_args(ac, av);
|
= parse_args(ac, av);
|
||||||
|
if (rows == 0) {
|
||||||
|
rows = columns;
|
||||||
|
}
|
||||||
spdlog::set_level(verbose ? spdlog::level::debug : spdlog::level::info);
|
spdlog::set_level(verbose ? spdlog::level::debug : spdlog::level::info);
|
||||||
spdlog::set_pattern("[thread %t] %+");
|
spdlog::set_pattern("[thread %t] %+");
|
||||||
spdlog::debug("Input file:\t{}", input_file.native());
|
spdlog::debug("Input file:\t{}", input_file.native());
|
||||||
|
@ -22,22 +22,25 @@ void processFilenames(po::variables_map const& vm,
|
|||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] auto parse_args(int t_ac, char** t_av)
|
[[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");
|
po::options_description desc("Allowed options");
|
||||||
desc.add_options()
|
desc.add_options()
|
||||||
("help,h", "Display this help message")
|
("help,h", "Display this help message")
|
||||||
("input,i", po::value<path>(), "Input image")
|
("input,i", po::value<path>(), "Input image")
|
||||||
("output,o", po::value<path>(),
|
("output,o", po::value<path>(),
|
||||||
"Image output path (default: \"output_\" + input path)")
|
"Image output path (default: \"output_\" + input path)")
|
||||||
("iterations,n", po::value<int>(), "Number of iterations (default: 2000)")
|
("iterations,n", po::value<int>(), "Number of iterations (default: 2000)")
|
||||||
("method,m", po::value<int>(), "Method number to be used (default: 1)")
|
("method,m", po::value<int>(), "Method number to be used (default: 1)")
|
||||||
("division,d", po::value<int>(),
|
("columns,c", po::value<int>(),
|
||||||
"For method 5, number of regions the reference image should be divided "
|
"For method 5 only, number of columns the reference image should be "
|
||||||
"into. For instance, -d4 will divide the reference image into a 4*4 "
|
"divided into. (default: 1)")
|
||||||
"matrice of smaller images. (default: 1)")
|
("rows,r", po::value<int>(),
|
||||||
("size,s", "Controlled size of the random shapes (default: false)")
|
"For method 5 only, number of rows the reference image should be "
|
||||||
("verbose,v", "Enables verbosity");
|
"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::variables_map vm;
|
||||||
po::store(po::parse_command_line(t_ac, t_av, desc), vm);
|
po::store(po::parse_command_line(t_ac, t_av, desc), vm);
|
||||||
po::notify(vm);
|
po::notify(vm);
|
||||||
@ -55,7 +58,7 @@ void processFilenames(po::variables_map const& vm,
|
|||||||
input_path, output_path,
|
input_path, output_path,
|
||||||
vm.count("iterations") ? vm["iterations"].as<int>() : DEFAULT_ITERATIONS,
|
vm.count("iterations") ? vm["iterations"].as<int>() : DEFAULT_ITERATIONS,
|
||||||
vm.count("method") ? vm["method"].as<int>() : 1,
|
vm.count("method") ? vm["method"].as<int>() : 1,
|
||||||
vm.count("division") ? vm["division"].as<int>() : 1,
|
vm.count("column") ? vm["column"].as<int>() : 1,
|
||||||
vm.count("size"),
|
vm.count("rows") ? vm["rows"].as<int>() : 0, vm.count("size"),
|
||||||
vm.count("verbose"));
|
vm.count("verbose"));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user