2019-03-19 12:49:37 +00:00
|
|
|
#include "parseargs.hh"
|
|
|
|
#include <boost/program_options.hpp>
|
|
|
|
#include <cstdlib>
|
|
|
|
#include <iostream>
|
|
|
|
#include <string>
|
|
|
|
|
2019-03-19 13:22:44 +00:00
|
|
|
constexpr int DEFAULT_ITERATIONS = 5000;
|
|
|
|
|
|
|
|
std::tuple<std::string, std::string, bool, int> parse_args(int t_ac,
|
|
|
|
char **t_av) {
|
2019-03-19 12:49:37 +00:00
|
|
|
namespace po = boost::program_options;
|
|
|
|
po::options_description desc("Allowed options");
|
|
|
|
desc.add_options()("help,h", "Display this help message")(
|
|
|
|
"input,i", po::value<std::string>(), "Input image")(
|
|
|
|
"output,o", po::value<std::string>(),
|
2019-03-19 13:22:44 +00:00
|
|
|
"Image or video output path (default: input path + \"_output\")")(
|
|
|
|
"iterations,n", po::value<int>(),
|
|
|
|
"Number of iterations (default: 5000)")("video,v", "Enable video output");
|
2019-03-19 12:49:37 +00:00
|
|
|
po::variables_map vm;
|
|
|
|
po::store(po::parse_command_line(t_ac, t_av, desc), vm);
|
|
|
|
po::notify(vm);
|
|
|
|
if (vm.count("help") || !vm.count("input")) {
|
|
|
|
std::cout << desc << "\n";
|
|
|
|
std::exit(1);
|
|
|
|
}
|
2019-03-19 13:22:44 +00:00
|
|
|
return std::make_tuple(
|
|
|
|
vm["input"].as<std::string>(),
|
|
|
|
vm.count("output")
|
|
|
|
? vm["output"].as<std::string>()
|
|
|
|
: vm["input"].as<std::string>() + std::string{"_output"},
|
|
|
|
vm.count("video") ? true : false,
|
|
|
|
vm.count("iterations") ? vm["iterations"].as<int>() : DEFAULT_ITERATIONS);
|
2019-03-19 12:49:37 +00:00
|
|
|
}
|