diff options
Diffstat (limited to 'src/annotator.cc')
-rw-r--r-- | src/annotator.cc | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/annotator.cc b/src/annotator.cc new file mode 100644 index 0000000..c74f04f --- /dev/null +++ b/src/annotator.cc @@ -0,0 +1,45 @@ +#include "playback.h" +#include "ui.h" +#include "labeller.h" +#include <vector> +#include <iostream> +#include <memory> + +// Removes flags from args (in-place) and returns vector of flags +std::vector<std::string> extractFlags(std::vector<std::string>& args) { + std::vector<std::string> ret; + auto it = args.begin(); + while(it != args.end()) { + if((*it)[0] == '-') { + while((*it)[0] == '-') { + (*it).erase((*it).begin()); + } + ret.push_back(*it); + args.erase(it); + } else { + it++; + } + } + return ret; +} + +int main(int argc, char *argv[]) { + std::string exename = argv[0]; + std::vector<std::string> args(&argv[1], &argv[argc]); + std::vector<std::string> flags = extractFlags(args); + if(args.empty()) { + std::cout << "Must provide a path to a video to process!" << std::endl; + } + std::cout << "Loading video " << args[0] << std::endl; + std::filesystem::path p(args[0]); + std::shared_ptr<frontend::playback> playback(new frontend::playback(p)); + // Format save path + auto savedir = std::filesystem::path("save") / p.parent_path().filename(); + std::filesystem::create_directories(savedir); + auto savepath = savedir / (p.stem().string() + ".txt"); + std::cout << "Saves are written to: " << savepath << std::endl; + std::shared_ptr<backend::labeller> labeller(new backend::labeller(savepath)); + frontend::ui ui(playback, labeller); + ui.begin(); + return 0; +} |