29 #ifndef HIGHLYRELIABLEMARKERS_H 30 #define HIGHLYRELIABLEMARKERS_H 36 #include <opencv2/core/core.hpp> 37 #include <opencv2/imgproc/imgproc.hpp> 64 unsigned int getId(
unsigned int rot = 0)
const {
return _ids[rot]; };
70 bool get(
unsigned int pos,
unsigned int rot = 0)
const {
return _bits[rot][pos]; }
75 const std::vector< bool > &
getRotation(
unsigned int rot)
const {
return _bits[rot]; };
85 void set(
unsigned int pos,
bool val,
bool updateIds=
true);
90 unsigned int size()
const {
return n() * n(); };
95 unsigned int n()
const {
return _n; };
101 unsigned int selfDistance(
unsigned int &minRot)
const;
109 return selfDistance(minRot);
116 unsigned int distance(
const MarkerCode &m,
unsigned int &minRot)
const;
124 return distance(m, minRot);
130 void fromString(std::string
s);
135 std::string toString()
const;
142 cv::Mat getImg(
unsigned int pixSize)
const;
145 unsigned int _ids[4];
146 std::vector< bool > _bits[4];
152 unsigned int hammingDistance(
const std::vector< bool > &m1,
const std::vector< bool > &m2)
const;
166 bool fromFile(std::string filename);
171 bool toFile(std::string filename);
178 unsigned int distance(
const MarkerCode &m,
unsigned int &minMarker,
unsigned int &minRot);
185 unsigned int minMarker, minRot;
186 return distance(m, minMarker, minRot);
192 unsigned int minimunDistance();
198 template <
class T >
static std::string
toStr(T num) {
199 std::stringstream ss;
228 bool findId(
unsigned int id,
unsigned int &orgPos);
231 std::vector< std::pair< unsigned int, unsigned int > >
_orderD;
245 static bool loadDictionary(
Dictionary D,
float correctionDistance = 1);
246 static bool loadDictionary(std::string filename,
float correctionDistance = 1);
255 static int detect(
const cv::Mat &in,
int &nRotations);
262 static unsigned int _n;
271 static bool checkBorders(cv::Mat grey);
276 static MarkerCode getMarkerCode(
const cv::Mat &grey);
282 #endif // HIGHLYRELIABLEMARKERS_H
unsigned int selfDistance() const
unsigned int size() const
static std::string toStr(T num)
unsigned int distance(const MarkerCode &m) const
unsigned int distance(const MarkerCode &m)
static Dictionary & getDictionary()
unsigned int getId(unsigned int rot=0) const
const std::vector< bool > & getRotation(unsigned int rot) const
static unsigned int _correctionDistance
static BalancedBinaryTree _binaryTree
std::vector< std::pair< unsigned int, unsigned int > > _orderD
std::vector< std::pair< int, int > > _binaryTree
static unsigned int _ncellsBorder