}
}
-int show_menu(const char *title, const int *options, const char **names,
- int cnt)
-{
- printf("*********************************************\n");
- printf("* %38s *\n", title);
- printf("*-------------------------------------------*\n");
- int i = 0;
- for (i = 0; i < cnt; ++i)
- printf("* %2i. %34s *\n", options[i], names[i]);
-
- printf("*********************************************\n\n");
- int selection = 0;
- printf("Your choice: ");
- if (scanf("%20i", &selection) == 0) {
- if (scanf("%*[^\n]%*c") != 0) {
- printf("ERROR: Reading the input line error.\n");
- return -1;
- }
- printf("ERROR: Incorrect input.\n");
- }
-
- return selection;
-}
-
int perform_configure_set_model_config_path(mv_engine_config_h engine_cfg)
{
int err = MEDIA_VISION_ERROR_NONE;
int err = MEDIA_VISION_ERROR_NONE;
int sel_opt = 0;
- const int options[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 };
const char *names[] = { "Set Model Configuration",
"Set Model Weights",
"Set Model Data Type",
}
while (sel_opt == 0) {
- sel_opt = show_menu("Select Actions: ", options, names,
- ARRAY_SIZE(options));
+ sel_opt = show_menu_linear("Select Actions: ", names, ARRAY_SIZE(names));
switch (sel_opt) {
case 1:
err = perform_configure_set_model_config_path(handle);
int err = MEDIA_VISION_ERROR_NONE;
int sel_opt = 0;
- const int options[] = { 1, 2, 3, 4, 5, 6,
- 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
- 17, 18, 19 };
const char *names[] = { "Configuration",
"TFLite(cpu + Mobilenet)",
"OpenCV(cpu + Squeezenet)",
mv_source_h mvSource = NULL;
while (sel_opt == 0) {
- sel_opt = show_menu("Select Action:", options, names,
- ARRAY_SIZE(options));
+ sel_opt = show_menu_linear("Select Action:", names, ARRAY_SIZE(names));
switch (sel_opt) {
case 1: {
//perform configuration
}
sel_opt = 0;
- const int options_last[2] = { 1, 2 };
- const char *names_last[2] = { "Yes", "No" };
-
while (sel_opt == 0) {
- sel_opt =
- show_menu("Run Image Classification again?: ", options_last,
- names_last, ARRAY_SIZE(options_last));
+ sel_opt = show_menu_yes_or_no("Run Image Classification again?: ");
switch (sel_opt) {
case 1:
do_another = 1;
int err = MEDIA_VISION_ERROR_NONE;
int sel_opt = 0;
- const int options[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
const char *names[] = { "Configuration",
"TFLITE(CPU) + MobileNetV1+SSD",
"OPENCV(CPU) + MobileNetV1+SSD",
mv_source_h mvSource = NULL;
while (sel_opt == 0) {
- sel_opt = show_menu("Select Action:", options, names,
- ARRAY_SIZE(options));
+ sel_opt = show_menu_linear("Select Action:", names, ARRAY_SIZE(names));
switch (sel_opt) {
case 1: {
//perform configuration
}
sel_opt = 0;
- const int options_last[2] = { 1, 2 };
- const char *names_last[2] = { "Yes", "No" };
-
while (sel_opt == 0) {
- sel_opt = show_menu("Run Object Detection again?:", options_last,
- names_last, ARRAY_SIZE(options_last));
+ sel_opt = show_menu_yes_or_no("Run Object Detection again?:");
switch (sel_opt) {
case 1:
do_another = 1;
int err = MEDIA_VISION_ERROR_NONE;
int sel_opt = 0;
- const int options[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
const char *names[] = { "Configuration",
"TFLite(CPU) + MobileNetV1 + SSD",
"OPENCV(CPU) + Resnet10 + SSD",
mv_source_h mvSource = NULL;
while (sel_opt == 0) {
- sel_opt = show_menu("Select Action:", options, names,
- ARRAY_SIZE(options));
+ sel_opt =
+ show_menu_linear("Select Action:", names, ARRAY_SIZE(names));
switch (sel_opt) {
case 1: {
//perform configuration
}
sel_opt = 0;
- const int options_last[] = { 1, 2 };
- const char *names_last[] = { "Yes", "No" };
-
while (sel_opt == 0) {
- sel_opt = show_menu("Run Face Detection again?:", options_last,
- names_last, ARRAY_SIZE(options_last));
+ sel_opt = show_menu_yes_or_no("Run Face Detection again?:");
switch (sel_opt) {
case 1:
do_another = 1;
int err = MEDIA_VISION_ERROR_NONE;
int sel_opt = 0;
- const int options[] = { 1, 2, 3, 4, 5, 6, 7, 8 };
const char *names[] = { "Configuration",
"Tflite(CPU) + TweakCNN",
"OPENCV(CPU) + TweakCNN",
mv_source_h mvSource = NULL;
while (sel_opt == 0) {
- sel_opt = show_menu("Select Action:", options, names,
- ARRAY_SIZE(options));
+ sel_opt = show_menu_linear("Select Action:", names, ARRAY_SIZE(names));
switch (sel_opt) {
case 1: {
//perform configuration
}
sel_opt = 0;
- const int options_last[] = { 1, 2 };
- const char *names_last[] = { "Yes", "No" };
-
while (sel_opt == 0) {
- sel_opt = show_menu(
- "Run Facial Landmark Detection again?:", options_last,
- names_last, ARRAY_SIZE(options_last));
+ sel_opt = show_menu_yes_or_no("Run Facial Landmark Detection again?:");
switch (sel_opt) {
case 1:
do_another = 1;
int err = MEDIA_VISION_ERROR_NONE;
int sel_opt = 0;
- const int options[] = { 1, 2, 3, 4, 5, 6, 7 };
const char *names[] = { "Configuration",
"TFLITE(CPU) + CPM",
"Hosted: TFLITE(CPU) + CPM",
mv_source_h mvSource = NULL;
while (sel_opt == 0) {
- sel_opt = show_menu("Select Action:", options, names,
- ARRAY_SIZE(options));
+ sel_opt = show_menu_linear("Select Action:", names, ARRAY_SIZE(names));
switch (sel_opt) {
case 1: {
//perform configuration
}
sel_opt = 0;
- const int options_last[] = { 1, 2 };
- const char *names_last[] = { "Yes", "No" };
-
while (sel_opt == 0) {
- sel_opt = show_menu(
- "Run Pose Landmark Detection again?:", options_last,
- names_last, ARRAY_SIZE(options_last));
+ sel_opt = show_menu_yes_or_no("Run Pose Landmark Detection again?:");
switch (sel_opt) {
case 1:
do_another = 1;
{
int sel_opt = 0;
- const int options[] = { 1, 2, 3, 4, 5, 6 };
- const char *names[] = { "Image Classification", "Object Detection",
- "Face Detection", "Facial Landmark Detection",
- "Pose Landmark Detection", "Exit" };
+ const char *names[] = {
+ "Image Classification", "Object Detection",
+ "Face Detection", "Facial Landmark Detection",
+ "Pose Landmark Detection", "Exit"
+ };
int err = MEDIA_VISION_ERROR_NONE;
while (sel_opt == 0) {
- sel_opt = show_menu("Select Action:", options, names,
- ARRAY_SIZE(options));
+ sel_opt = show_menu_linear("Select Action:", names, ARRAY_SIZE(names));
switch (sel_opt) {
case 1: {
err = perform_image_classification();
if (err != MEDIA_VISION_ERROR_NONE) {
- printf("Fail to perform image classification. ERROR[0x%x]\n", err);
+ printf("Fail to perform image classification. ERROR[0x%x]\n",
+ err);
}
} break;
case 2: {
case 4: {
err = perform_facial_landmark_detection();
if (err != MEDIA_VISION_ERROR_NONE) {
- printf("Fail to perform facial landmark detection. ERROR[0x%x]\n", err);
+ printf("Fail to perform facial landmark detection. ERROR[0x%x]\n",
+ err);
}
} break;
case 5: {
int do_another = 0;
sel_opt = 0;
- const int options_last[] = { 1, 2 };
- const char *names_last[] = { "Yes", "No" };
-
while (sel_opt == 0) {
- sel_opt =
- show_menu("Another action?: ", options_last, names_last, 2);
+ sel_opt = show_menu_yes_or_no("Another action?: ");
switch (sel_opt) {
case 1:
do_another = 1;