Go to the documentation of this file.
59 #define HAMM_HIST_MAX 10
61 int main(
int argc,
char *argv[])
77 printf(
"Usage: %s [options] <input files>\n", argv[0]);
86 if (!strcmp(famname,
"tag36h11")) {
88 }
else if (!strcmp(famname,
"tag25h9")) {
90 }
else if (!strcmp(famname,
"tag16h5")) {
92 }
else if (!strcmp(famname,
"tagCircle21h7")) {
94 }
else if (!strcmp(famname,
"tagCircle49h12")) {
96 }
else if (!strcmp(famname,
"tagStandard41h12")) {
98 }
else if (!strcmp(famname,
"tagStandard52h13")) {
100 }
else if (!strcmp(famname,
"tagCustom48h12")) {
103 printf(
"Unrecognized tag family name. Use e.g. \"tag36h11\".\n");
112 printf(
"\"hamming\" parameter is out-of-range.\n");
115 printf(
"Unable to add family to detector due to insufficient memory to allocate the tag-family decoder. Try reducing \"hamming\" from %d or choose an alternative tag family.\n",
getopt_get_int(
getopt,
"hamming"));
129 for (
int iter = 0; iter < maxiters; iter++) {
134 double total_time = 0;
137 printf(
"iter %d / %d\n", iter + 1, maxiters);
139 for (
int input = 0; input <
zarray_size(inputs); input++) {
142 memset(hamm_hist, 0,
sizeof(hamm_hist));
147 printf(
"loading %s\n", path);
149 printf(
"%20s ", path);
159 printf(
"pjpeg failed to load: %s, error %d\n", path, err);
166 printf(
"illumination invariant\n");
172 for (
int y = 0; y < imc->
height; y++) {
173 for (
int x = 0; x < imc->
width; x++) {
174 double r = imc->
buf[y*imc->
stride + 3*x + 0] / 255.0;
175 double g = imc->
buf[y*imc->
stride + 3*x + 1] / 255.0;
176 double b = imc->
buf[y*imc->
stride + 3*x + 2] / 255.0;
179 double v = 0.5 + log(g) - alpha*log(b) - (1-alpha)*log(r);
198 printf(
"couldn't load %s\n", path);
202 printf(
"image: %s %dx%d\n", path, im->
width, im->
height);
206 if (errno == EAGAIN) {
207 printf(
"Unable to create the %d threads requested.\n",td->
nthreads);
211 for (
int i = 0; i <
zarray_size(detections); i++) {
216 printf(
"detection %3d: id (%2dx%2d)-%-4d, hamming %d, margin %8.3f\n",
220 total_hamm_hist[det->
hamming]++;
229 total_quads += td->
nquads;
235 printf(
"%5d ", hamm_hist[i]);
239 printf(
"%12.3f ", t);
240 printf(
"%5d", td->
nquads);
253 printf(
"%5d ", total_hamm_hist[i]);
254 printf(
"%12.3f ", total_time);
255 printf(
"%5d", total_quads);
263 if (!strcmp(famname,
"tag36h11")) {
265 }
else if (!strcmp(famname,
"tag25h9")) {
267 }
else if (!strcmp(famname,
"tag16h5")) {
269 }
else if (!strcmp(famname,
"tagCircle21h7")) {
271 }
else if (!strcmp(famname,
"tagCircle49h12")) {
273 }
else if (!strcmp(famname,
"tagStandard41h12")) {
275 }
else if (!strcmp(famname,
"tagStandard52h13")) {
277 }
else if (!strcmp(famname,
"tagCustom48h12")) {
void getopt_destroy(getopt_t *gopt)
int getopt_parse(getopt_t *gopt, int argc, char *argv[], int showErrors)
int getopt_get_int(getopt_t *getopt, const char *lname)
void image_u8_destroy(image_u8_t *im)
void tag36h11_destroy(apriltag_family_t *tf)
void tag16h5_destroy(apriltag_family_t *tf)
apriltag_family_t * tagCustom48h12_create()
getopt_t * getopt_create()
void getopt_add_bool(getopt_t *gopt, char sopt, const char *lname, int def, const char *help)
zarray_t * apriltag_detector_detect(apriltag_detector_t *td, image_u8_t *im_orig)
image_u8x3_t * pjpeg_to_u8x3_baseline(pjpeg_t *pj)
void getopt_add_string(getopt_t *gopt, char sopt, const char *lname, const char *def, const char *help)
void getopt_do_usage(getopt_t *gopt)
image_u8_t * pjpeg_to_u8_baseline(pjpeg_t *pj)
static int zarray_size(const zarray_t *za)
apriltag_family_t * tag25h9_create()
void getopt_add_double(getopt_t *gopt, char sopt, const char *lname, const char *def, const char *help)
image_u8_t * image_u8_create(unsigned int width, unsigned int height)
apriltag_family_t * tag16h5_create()
void tagCircle49h12_destroy(apriltag_family_t *tf)
apriltag_family_t * tagCircle21h7_create()
bool str_ends_with(const char *haystack, const char *needle)
const char * getopt_get_string(getopt_t *gopt, const char *lname)
apriltag_detector_t * apriltag_detector_create()
double getopt_get_double(getopt_t *getopt, const char *lname)
void apriltag_detections_destroy(zarray_t *detections)
void tagCircle21h7_destroy(apriltag_family_t *tf)
apriltag_family_t * family
int image_u8_write_pnm(const image_u8_t *im, const char *path)
int main(int argc, char *argv[])
void image_u8x3_destroy(image_u8x3_t *im)
void tagCustom48h12_destroy(apriltag_family_t *tf)
void apriltag_detector_add_family_bits(apriltag_detector_t *td, apriltag_family_t *fam, int bits_corrected)
void apriltag_detector_destroy(apriltag_detector_t *td)
void tag25h9_destroy(apriltag_family_t *tf)
void pjpeg_destroy(pjpeg_t *pj)
apriltag_family_t * tagCircle49h12_create()
const zarray_t * getopt_get_extra_args(getopt_t *gopt)
static void zarray_get(const zarray_t *za, int idx, void *p)
static void timeprofile_display(timeprofile_t *tp)
static uint64_t timeprofile_total_utime(timeprofile_t *tp)
void getopt_add_int(getopt_t *gopt, char sopt, const char *lname, const char *def, const char *help)
image_u8_t * image_u8_create_from_pnm(const char *path)
apriltag_family_t * tag36h11_create()
int getopt_get_bool(getopt_t *getopt, const char *lname)
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:19