-
Notifications
You must be signed in to change notification settings - Fork 0
/
apriltag.hpp
123 lines (101 loc) · 2.97 KB
/
apriltag.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
//
// Created by huangqinjin on 5/31/17.
//
#ifndef APRILTAG_HPP
#define APRILTAG_HPP
extern "C"
{
struct zarray;
struct apriltag_family;
struct apriltag_detector;
struct apriltag_detection;
struct image_u8;
}
namespace cv
{
class Mat;
}
namespace apriltag
{
template<typename T>
using identity = T;
class family
{
public:
static family get(const char* name);
explicit family(apriltag_family* tf = nullptr);
family(family&&);
~family();
family& operator=(const family&) = delete;
const char* name() const;
apriltag_family* impl;
};
family tag16h5();
family tag25h7();
family tag25h9();
family tag36h10();
family tag36h11();
family tag36artoolkit();
class detection
{
public:
class tag
{
public:
tag() = delete;
tag(const tag&) = delete;
tag& operator=(const tag&) = delete;
int id() const;
identity<const double(&)[2]> center() const;
identity<const double(&)[2]> corner(int i) const;
identity<const double(&)[4][2]> corners() const;
operator identity<const double(&)[4][2]>() const;
};
class iterator
{
public:
using value_type = const tag;
using pointer = const tag*;
using reference = const tag&;
iterator& operator++() { ++impl; return *this; }
iterator operator++(int) { iterator tmp(*this); ++(*this); return tmp; }
bool operator==(const iterator& other) const { return impl == other.impl; }
bool operator!=(const iterator& other) const { return !operator==(other); }
pointer operator->() const { return reinterpret_cast<pointer>(*impl); }
reference operator*() const { return *operator->(); }
apriltag_detection** impl;
};
using const_iterator = iterator;
explicit detection(zarray* d = nullptr);
detection(detection&&);
~detection();
detection(const detection&) = delete;
detection& operator=(const detection&) = delete;
bool empty() const;
int size() const;
const_iterator begin() const;
const_iterator end() const;
const tag& operator[](int i) const;
void draw(cv::Mat& img, int flags = 0);
zarray* impl;
};
class detector
{
public:
explicit detector(apriltag_detector*);
explicit detector(family tf = tag36h11());
detector(detector&&);
~detector();
detector& operator=(const detector&) = delete;
int threads() const;
void threads(int n);
int level() const;
void level(int n);
detection detect(const image_u8* img);
detection detect(const image_u8& img);
detection detect(const cv::Mat& img);
apriltag_detector* impl;
family tf;
};
}
#endif //APRILTAG_HPP