2#include <visp3/core/vpConfig.h>
4#include <visp3/detection/vpDetectorAprilTag.h>
6#include <visp3/core/vpXmlParserCamera.h>
7#include <visp3/core/vpImageTools.h>
8#include <visp3/gui/vpDisplayFactory.h>
9#include <visp3/io/vpImageIo.h>
11void usage(
const char **argv,
int error);
13void usage(
const char **argv,
int error)
15 std::cout <<
"Synopsis" << std::endl
17 <<
" [--output, -o <filename>]"
18 <<
" [--tag-size <size>]"
19 <<
" [--tag-family <family>]"
21#if defined(VISP_HAVE_DISPLAY)
24 <<
" [--help, -h]" << std::endl
26 std::cout <<
"Description" << std::endl
27 <<
" Create AprilTag or ArUco marker image." << std::endl
29 <<
" --output, -o <filename>" << std::endl
30 <<
" Output image." << std::endl
31 <<
" Default: tag.png" << std::endl
33 <<
" --tag-size <size>" << std::endl
34 <<
" Tag size in pixels." << std::endl
35 <<
" Default: 400" << std::endl
37 <<
" --tag-family <family>" << std::endl
38 <<
" Apriltag family. Supported values are:" << std::endl
39 <<
" 0: TAG_36h11" << std::endl
40 <<
" 1: TAG_36h10 (DEPRECATED)" << std::endl
41 <<
" 2: TAG_36ARTOOLKIT (DEPRECATED)" << std::endl
42 <<
" 3: TAG_25h9" << std::endl
43 <<
" 4: TAG_25h7 (DEPRECATED)" << std::endl
44 <<
" 5: TAG_16h5" << std::endl
45 <<
" 6: TAG_CIRCLE21h7" << std::endl
46 <<
" 7: TAG_CIRCLE49h12" << std::endl
47 <<
" 8: TAG_CUSTOM48h12" << std::endl
48 <<
" 9: TAG_STANDARD41h12" << std::endl
49 <<
" 10: TAG_STANDARD52h13" << std::endl
50 <<
" 11: TAG_ARUCO_4x4_50" << std::endl
51 <<
" 12: TAG_ARUCO_4x4_100" << std::endl
52 <<
" 13: TAG_ARUCO_4x4_250" << std::endl
53 <<
" 14: TAG_ARUCO_4x4_1000" << std::endl
54 <<
" 15: TAG_ARUCO_5x5_50" << std::endl
55 <<
" 16: TAG_ARUCO_5x5_100" << std::endl
56 <<
" 17: TAG_ARUCO_5x5_250" << std::endl
57 <<
" 18: TAG_ARUCO_5x5_1000" << std::endl
58 <<
" 19: TAG_ARUCO_6x6_50" << std::endl
59 <<
" 20: TAG_ARUCO_6x6_100" << std::endl
60 <<
" 21: TAG_ARUCO_6x6_250" << std::endl
61 <<
" 22: TAG_ARUCO_6x6_1000" << std::endl
62 <<
" 23: TAG_ARUCO_7x7_50" << std::endl
63 <<
" 24: TAG_ARUCO_7x7_100" << std::endl
64 <<
" 25: TAG_ARUCO_7x7_250" << std::endl
65 <<
" 26: TAG_ARUCO_7x7_1000" << std::endl
66 <<
" 27: TAG_ARUCO_MIP_36h12" << std::endl
67 <<
" Default: 0 (36h11)" << std::endl
69 <<
" --tag-id <id>" << std::endl
70 <<
" Marker id. " << std::endl
71 <<
" Default: 0" << std::endl
73#if defined(VISP_HAVE_DISPLAY)
74 <<
" --display, -d" << std::endl
75 <<
" Display generated marker." << std::endl
76 <<
" Default: disabled" << std::endl
79 <<
" --help, -h" << std::endl
80 <<
" Print this helper message." << std::endl
84 std::cout <<
"Error" << std::endl
86 <<
"Unsupported parameter " << argv[
error] << std::endl;
90int main(
int argc,
const char **argv)
92#if defined(VISP_HAVE_APRILTAG)
94#ifdef ENABLE_VISP_NAMESPACE
100 std::string opt_filename =
"tag.png";
101 bool opt_display_tag =
false;
102 unsigned int opt_pix_size = 400;
105 for (
int i = 1;
i < argc; ++
i) {
106 if (((std::string(argv[i]) ==
"--output") || (std::string(argv[i]) ==
"-o")) && (i + 1 < argc)) {
107 opt_filename = std::string(argv[++i]);
109 else if (std::string(argv[i]) ==
"--tag-size" && i + 1 < argc) {
110 opt_pix_size =
static_cast<unsigned int>(atoi(argv[++i]));
112 else if (std::string(argv[i]) ==
"--tag-family" && i + 1 < argc) {
115 else if (std::string(argv[i]) ==
"--tag-id" && i + 1 < argc) {
116 opt_tag_id = atoi(argv[++i]);
118#if defined(VISP_HAVE_DISPLAY)
119 else if ((std::string(argv[i]) ==
"--display") || (std::string(argv[i]) ==
"-d")) {
120 opt_display_tag =
true;
123 else if (std::string(argv[i]) ==
"--help" || std::string(argv[i]) ==
"-h") {
133 std::cout <<
"Create marker" << std::endl;
134 std::cout <<
" Family: " << opt_tag_family << std::endl;
135 std::cout <<
" Id : " << opt_tag_id << std::endl;
136 std::cout <<
" Size : " << opt_pix_size <<
" x " << opt_pix_size <<
" pixels" << std::endl;
141 if (detector.getTagImage(Ismall, opt_tag_id)) {
144 std::cout <<
"Saved in: " << opt_filename << std::endl;
147 if (opt_display_tag) {
151 std::cout <<
"Click in the image to quit..." << std::endl;
@ TAG_36h11
AprilTag 36h11 pattern (recommended).
Class that defines generic functionalities for display.
static bool getClick(const vpImage< unsigned char > &I, bool blocking=true)
static void display(const vpImage< unsigned char > &I)
static void flush(const vpImage< unsigned char > &I)
static void write(const vpImage< unsigned char > &I, const std::string &filename, int backend=IO_DEFAULT_BACKEND)
Definition of the vpImage class member functions.
vpDisplay * allocateDisplay()
Return a newly allocated vpDisplay specialization if a GUI library is available or nullptr otherwise.