2021-07-01 14:47:13 +00:00
|
|
|
#include <vector>
|
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
#include <configfile.hpp>
|
|
|
|
#include <paths.hpp>
|
|
|
|
#include <error.hpp>
|
|
|
|
#include <tomlcpp.hpp>
|
|
|
|
|
|
|
|
bool configFileOpen(struct optData* data) {
|
2021-07-01 19:45:19 +00:00
|
|
|
auto configFile = toml::parseFile(prefixConfig + "config.toml");
|
2021-07-01 14:47:13 +00:00
|
|
|
if (!configFile.table) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
auto useHaarResult = configFile.table->getBool("use_haar");
|
|
|
|
if (useHaarResult.first) {
|
|
|
|
data->useHaar = useHaarResult.second;
|
|
|
|
}
|
2021-07-03 09:53:57 +00:00
|
|
|
auto showCameraResult = configFile.table->getBool("show_camera");
|
|
|
|
if (showCameraResult.first) {
|
|
|
|
data->showCamera = showCameraResult.second;
|
|
|
|
}
|
2021-07-03 19:58:17 +00:00
|
|
|
auto noEyesResult = configFile.table->getBool("no_eyes");
|
|
|
|
if (noEyesResult.first) {
|
|
|
|
data->noEyes = noEyesResult.second;
|
|
|
|
}
|
2021-07-01 14:47:13 +00:00
|
|
|
auto modelNameResult = configFile.table->getString("model");
|
|
|
|
if (modelNameResult.first) {
|
|
|
|
data->model = modelNameResult.second;
|
|
|
|
}
|
2021-07-03 19:19:46 +00:00
|
|
|
auto cameraResult = configFile.table->getInt("min_camera_id");
|
|
|
|
if (cameraResult.first) {
|
|
|
|
data->minCameraID = cameraResult.second;
|
|
|
|
}
|
2021-07-01 14:47:13 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|