25 lines
647 B
C++
25 lines
647 B
C++
|
#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;
|
||
|
}
|