Go to the documentation of this file.
17 va_copy(args2, args1);
19 const int N = vsnprintf(NULL, 0, fmt, args1);
27 char* res_fmt = calloc(N+1,
sizeof(
char));
28 const int n = vsnprintf(res_fmt, N+1, fmt, args2);
44 return copysign(1, a->
id - b->
id);
47 for (
int e = 0; e<4; e++) {
48 for (
int c = 0; c<2; c++) {
49 const double d = a->
p[e][c] - b->
p[e][c];
51 return copysign(1, d);
69 main(
int argc,
char *argv[])
76 char*
const path_img =
format(
"%s.jpg", argv[1]);
82 char*
const path_det_true =
format(
"%s.txt", argv[1]);
83 FILE *fp = fopen(path_det_true,
"r");
95 const char fmt_det[] =
"%i, (%.4lf %.4lf), (%.4lf %.4lf), (%.4lf %.4lf), (%.4lf %.4lf)";
96 const char fmt_ref_parse[] =
"%i, (%lf %lf), (%lf %lf), (%lf %lf), (%lf %lf)";
110 char*
const det_fmt =
format(fmt_det,
112 det->
p[0][0], det->
p[0][1], det->
p[1][0], det->
p[1][1],
113 det->
p[2][0], det->
p[2][1], det->
p[3][0], det->
p[3][1]);
123 printf(
"Got: %s\n", det_fmt);
124 printf(
"Expected: %s\n", line);
128 const int nparsed = sscanf(
131 &ref.
p[0][0], &ref.
p[0][1], &ref.
p[1][0], &ref.
p[1][1],
132 &ref.
p[2][0], &ref.
p[2][1], &ref.
p[3][0], &ref.
p[3][1]);
135 assert(nparsed == 9);
140 if (!equ || det->
id != ref.
id) {
141 fprintf(stderr,
"Mismatch.\nGot:\n %s\nExpected:\n %s\n", det_fmt, line);
152 if ((fgetc(fp) != -1) && (i !=
zarray_size(detections))) {
void image_u8_destroy(image_u8_t *im)
void tag36h11_destroy(apriltag_family_t *tf)
zarray_t * apriltag_detector_detect(apriltag_detector_t *td, image_u8_t *im_orig)
char * format(const char *fmt,...)
image_u8_t * pjpeg_to_u8_baseline(pjpeg_t *pj)
static int zarray_size(const zarray_t *za)
int main(int argc, char *argv[])
apriltag_detector_t * apriltag_detector_create()
void apriltag_detections_destroy(zarray_t *detections)
void apriltag_detector_destroy(apriltag_detector_t *td)
int detection_compare_function(const apriltag_detection_t *a, const apriltag_detection_t *b)
static void apriltag_detector_add_family(apriltag_detector_t *td, apriltag_family_t *fam)
void pjpeg_destroy(pjpeg_t *pj)
static void zarray_get(const zarray_t *za, int idx, void *p)
static void zarray_sort(zarray_t *za, int(*compar)(const void *, const void *))
ssize_t apriltag_test_getline(char **lineptr, size_t *n, FILE *stream)
int detection_array_element_compare_function(const void *_a, const void *_b)
apriltag_family_t * tag36h11_create()
pjpeg_t * pjpeg_create_from_file(const char *path, uint32_t flags, int *error)
apriltag
Author(s): Edwin Olson
, Max Krogius
autogenerated on Sun Apr 20 2025 02:08:47