#include <error.h>
#include <argp.h>
-#define MAX_ARGS 3
-#define INDEX_MAX 4
-#define BARCODE_STRING_MAX 255
-#define RESULT_STRING_MAX 20
+#define MAX_ARGS 2
-static const char doc[] = "[VQA-barcode]\vmediavision barcode performance test\n\
- e.g) mv_barcode_test_performance barcode.png result.txt";
-static const char args_doc[] = "SOURCE ANNOTATION";
+#define NANO_PER_SEC ((__clock_t) 1000000000)
+#define NANO_PER_MILLI ((__clock_t) 1000000)
+#define MILLI_PER_SEC ((__clock_t) 1000)
+
+static const char doc[] = "[VQA-barcode]\vmediavision barcode assessment\n\
+ e.g) mv_barcode_assessment barcode.png\n\
+ 2 # number of barcode\n\
+ 123456789 # 1'st barcode\n\
+ 987654321 # 2nd barcode";
+static const char args_doc[] = "SOURCE";
struct arguments
{
char *annotation;
};
-#define NANO_PER_SEC ((__clock_t) 1000000000)
-#define NANO_PER_MILLI ((__clock_t) 1000000)
-#define MILLI_PER_SEC ((__clock_t) 1000)
-
struct timespec diff(struct timespec start, struct timespec end)
{
struct timespec temp;
}
return temp;
}
+
unsigned long gettotalmillisec(const struct timespec time)
{
return time.tv_sec * MILLI_PER_SEC + time.tv_nsec / NANO_PER_MILLI;
{
MEDIA_VISION_FUNCTION_ENTER();
- struct arguments *arguments = (struct arguments *) user_data;
- FILE *fp;
- char buf[BARCODE_STRING_MAX + 1] = {0};
- char result[INDEX_MAX][RESULT_STRING_MAX] = {"no_detect", "match", "no_match", "failed"};
- unsigned int idx = INDEX_MAX -1;
-
- if (number_of_barcodes == 0)
- idx = 0;
- else {
- size_t message_size = sizeof(messages[0]);
- fp = fopen(arguments->annotation, "rt");
- if (fp != NULL) {
- if (fgets(buf, BARCODE_STRING_MAX, fp) != NULL){
- if (strncmp(messages[0], buf, message_size) == 0)
- idx = 1;
- else
- idx = 2;
- }
- fclose(fp);
- } else {
- LOGE("Errors were occurred during opening the file!!! file : %s", arguments->annotation);
- idx = 3;
- }
-
+ int i = 0;
+ printf("%i\n", number_of_barcodes);
+ for (i = 0; i < number_of_barcodes; ++i) {
+ const char *cur_message = messages[i];
+ printf("%s\n", cur_message);
}
- printf("%s|%s|%s", arguments->source, arguments->annotation, result[idx]);
MEDIA_VISION_FUNCTION_LEAVE();
}
roi.width = image_width;
roi.height = image_height;
- err = mv_barcode_detect(source, mv_engine_config, roi, barcode_detected_cb, arguments);
+ err = mv_barcode_detect(source, mv_engine_config, roi, barcode_detected_cb, NULL);
if (MEDIA_VISION_ERROR_NONE != err) {
LOGE("Errors were occurred during barcode detection!!! code : %i", err);
}
out:
if (MEDIA_VISION_ERROR_NONE != err)
- printf("%s|%s|failed", arguments->source, arguments->annotation);
+ printf("-1\n");
if (data_buffer != NULL) {
delete [] data_buffer;
else if(state->argc < MAX_ARGS)
argp_failure(state, 1, 0, "too few arguments");
arguments->source = arg;
- arguments->annotation = state->argv[state->next];
- state->next = state->argc;
break;
default:
return ARGP_ERR_UNKNOWN;
struct timespec s_tspec;
struct timespec e_tspec;
- LOGI("Media Vision Test-Accuracy is launched.");
+ LOGI("Media Vision Assessment-Barcode is launched.");
struct arguments arguments;
argp_parse (&argp, argc, argv, 0, 0, &arguments);
struct timespec diffspec = diff(s_tspec, e_tspec);
unsigned long timeDiff = gettotalmillisec(diffspec);
- printf("|%lums\n", timeDiff);
+ printf("%lums\n", timeDiff);
- LOGI("Media Vision Test-Accuracy is closed.");
+ LOGI("Media Vision Assessment-Barcode is closed.");
return 0;
}