add cli main
This commit is contained in:
parent
09ddfccadc
commit
2e24f0314b
4 changed files with 48 additions and 0 deletions
24
src/main_cli.cpp
Normal file
24
src/main_cli.cpp
Normal file
|
@ -0,0 +1,24 @@
|
|||
#include <filesystem>
|
||||
#include <iostream>
|
||||
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
int main(int argc, const char* argv[]) {
|
||||
// We take an image path and a list of points (grouped by 4 to define
|
||||
// bounding boxes).
|
||||
if (argc < 6 or (argc - 2) % 4 != 0) {
|
||||
std::cerr
|
||||
<< "Usage: " << argv[0] << " path/to/image"
|
||||
<< " x1 y1 x2 y2 [...]\n"
|
||||
<< "x/y points must be grouped by 4 to define bounding boxes\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
const fs::path input(argv[1]);
|
||||
if (!fs::exists(input)) {
|
||||
std::cerr << "Input file " << input << " does not exist.\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue