3 #include <opencv2/imgproc/imgproc.hpp>    10     max_correction_rate=max(0.
f,
min(1.0
f,max_correction_rate));
    20     out.create(nbits_sq,nbits_sq,CV_8UC1);
    23     for(
int r=0;r<nbits_sq;r++){
    24         uchar *pr=out.ptr<uchar>(r);
    25         for(
int c=0;c<nbits_sq;c++)
    36     for(
int i=0;i<63;i++){
    44      assert(in.rows == in.cols);
    46     if (in.type() == CV_8UC1) grey = in;
    47     else cv::cvtColor(in, grey, CV_BGR2GRAY);
    49     cv::threshold(grey, grey, 125, 255, cv::THRESH_BINARY | cv::THRESH_OTSU);
    59                 marker_id=
_dic[ids[i]];
    83      int bits_a=
sqrt(total_nbits);
    88     int swidth = thres_img.rows / bits_a2;
    89     for (
int y = 0; y < bits_a2; y++) {
    91         if (y == 0 || y == bits_a2-1)
    93         for (
int x = 0; 
x < bits_a2; 
x += inc) {
    94             cv::Mat 
square = thres_img(cv::Rect(
x*swidth, y*swidth, swidth, swidth));
    95             if (cv::countNonZero(square) > (swidth * swidth) / 2)
   104     cv::Mat _bits = cv::Mat::zeros(bits_a, bits_a, CV_8UC1);
   107     for (
int y = 0; y < bits_a; y++) {
   109         for (
int x = 0; 
x < bits_a; 
x++) {
   110             int Xstart = (
x + 1) * (swidth);
   111             int Ystart = (y + 1) * (swidth);
   112             cv::Mat 
square = thres_img(cv::Rect(Xstart, Ystart, swidth, swidth));
   113             int nZ = cv::countNonZero(square);
   114             if (nZ > (swidth * swidth) / 2)
   115                 _bits.at< uchar >(y, 
x) = 1;
   132      std::bitset<64> bits;
   134      for (
int y = code.rows-1; y >=0 ; y--)
   135          for (
int x =  code.cols-1; 
x >=0; 
x--)
   136              bits[bidx++]=code.at<uchar>(y,
x);
   137      return bits.to_ullong();
   143      for (
int i = 0; i < in.rows; i++) {
   144          for (
int j = 0; j < in.cols; j++) {
   145              out.at< uchar >(i, j) = in.at< uchar >(in.cols - j - 1, i);
 
int _maxCorrectionAllowed
DICT_TYPES getType() const 
void setParams(const Dictionary &dic, float max_correction_rate)
uint64_t touulong(const cv::Mat &code)
cv::Mat rotate(const cv::Mat &in)
const CwiseUnaryOp< internal::scalar_square_op< Scalar >, const Derived > square() const 
void toMat(uint64_t code, int nbits_sq, cv::Mat &out)
bool getInnerCode(const cv::Mat &thres_img, int total_nbits, vector< uint64_t > &ids)
const std::map< uint64_t, uint16_t > & getMapCode() const 
TFSIMD_FORCE_INLINE const tfScalar & x() const 
std::string getName() const 
bool is(uint64_t code) const 
static std::string getTypeString(DICT_TYPES t)
const CwiseUnaryOp< internal::scalar_sqrt_op< Scalar >, const Derived > sqrt() const 
int hamm_distance(uint64_t a, uint64_t b)
bool detect(const cv::Mat &in, int &marker_id, int &nRotations)