2021-01-26 15:36:22 +00:00
|
|
|
#include <args.hpp>
|
2021-01-26 16:21:06 +00:00
|
|
|
#include <config.hpp>
|
2021-07-03 19:19:46 +00:00
|
|
|
#include <iostream>
|
2021-01-26 15:36:22 +00:00
|
|
|
|
|
|
|
const char* argp_program_version =
|
2021-03-23 16:01:37 +00:00
|
|
|
PROJECT_NAME " " VERSION_CODE "\n\n"
|
2021-01-26 15:36:22 +00:00
|
|
|
"License: GPLv3 <https://www.gnu.org/licenses/gpl-3.0.html>\n"
|
2021-07-03 09:30:26 +00:00
|
|
|
"If you did not receive a copy of the source code, it is available\n"
|
|
|
|
"at <https://git.epicalert.xyz/Epicalert/facecam2d.git> or the\n"
|
2021-03-23 16:01:37 +00:00
|
|
|
"GitLab mirror at <https://gitlab.com/epicalert/facecam2d.git>.";
|
2021-01-26 15:36:22 +00:00
|
|
|
|
2021-06-13 11:02:57 +00:00
|
|
|
#ifndef _WIN32
|
2021-01-26 15:36:22 +00:00
|
|
|
const struct argp_option options[] = {
|
|
|
|
//name, key, arg, flags, doc, group
|
2021-02-06 04:12:37 +00:00
|
|
|
{"haar-cascade", 0x00, 0, 0, "Use Haar Cascades for faster (but less accurate) face detection.", 0},
|
2021-07-03 09:53:57 +00:00
|
|
|
{"show-camera", 0x01, 0, 0, "Show the camera feed in another window", 0},
|
2021-07-03 19:58:17 +00:00
|
|
|
{"no-eyes", 0x02, 0, 0, "Disable eye tracking for better performance.", 0},
|
2021-07-03 09:53:57 +00:00
|
|
|
{"model", 'm', "model", 0, "Name of the model file to use. (not including '.fma')", 0},
|
2021-07-03 19:19:46 +00:00
|
|
|
// this option actually selects the minimum camera id to use,
|
|
|
|
// i.e. instead of trying video0, video1, ... it will try
|
|
|
|
// starting from 'c'.
|
|
|
|
// e.g. -c6 is passed, so the program will try video6, video7, etc.
|
|
|
|
{"camera", 'c', "id", 0, "ID number of camera to use (e.g. /dev/videoXX where XX is the ID)", 0},
|
2021-01-26 15:36:22 +00:00
|
|
|
{0}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct argp argp = {
|
|
|
|
options,
|
|
|
|
parseOptions,
|
|
|
|
0,
|
|
|
|
0
|
|
|
|
};
|
2021-06-09 17:38:03 +00:00
|
|
|
#endif
|
2021-01-26 15:36:22 +00:00
|
|
|
|
|
|
|
struct optData optData = {
|
2021-07-03 19:58:17 +00:00
|
|
|
false,
|
2021-07-03 09:53:57 +00:00
|
|
|
false,
|
2021-02-06 04:12:37 +00:00
|
|
|
false,
|
|
|
|
"test",
|
2021-07-03 19:19:46 +00:00
|
|
|
0,
|
2021-01-26 15:36:22 +00:00
|
|
|
};
|
|
|
|
|
2021-06-13 11:02:57 +00:00
|
|
|
#ifndef _WIN32
|
2021-01-26 15:36:22 +00:00
|
|
|
error_t parseOptions(int key, char* arg, struct argp_state* state) {
|
2021-07-03 19:19:46 +00:00
|
|
|
std::cout << key << ": " << arg << std::endl;
|
2021-01-26 15:36:22 +00:00
|
|
|
switch (key) {
|
|
|
|
case 0x00: //--haar-cascade
|
|
|
|
optData.useHaar = true;
|
|
|
|
break;
|
|
|
|
|
2021-07-03 09:53:57 +00:00
|
|
|
case 0x01: //--show-camera
|
|
|
|
optData.showCamera = true;
|
|
|
|
break;
|
|
|
|
|
2021-07-03 19:58:17 +00:00
|
|
|
case 0x02: //--no-eyes
|
|
|
|
optData.noEyes = true;
|
|
|
|
break;
|
|
|
|
|
2021-02-06 04:12:37 +00:00
|
|
|
case 'm':
|
|
|
|
optData.model = std::string(arg);
|
|
|
|
break;
|
|
|
|
|
2021-07-03 19:19:46 +00:00
|
|
|
case 'c':
|
|
|
|
optData.minCameraID = std::stoi(arg);
|
|
|
|
break;
|
|
|
|
|
2021-01-26 15:36:22 +00:00
|
|
|
default:
|
|
|
|
return ARGP_ERR_UNKNOWN;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2021-06-09 17:38:03 +00:00
|
|
|
#endif
|