13 std::vector<int> id_submarkers)
17 for (
auto p : corners)
21 _mask = cv::Mat::ones(m.size(), CV_8UC1);
26 float bitSize = (
at(1).x -
at(0).x) /
int(
mat().cols + 2);
27 float nsubBits = (submarker.
at(1).x - submarker.
at(0).x) / bitSize;
29 int x_min = int(round(submarker[0].x / bitSize +
mat().cols / 2));
30 int x_max = x_min + nsubBits;
31 int y_min = int(round(-submarker[0].y / bitSize +
mat().cols / 2));
32 int y_max = y_min + nsubBits;
34 for (
int y = y_min; y < y_max; y++)
36 for (
int x = x_min; x < x_max; x++)
38 _mask.at<uchar>(y, x) = 0;
45 int nBitsSquared = int(sqrt(
mat().total()));
51 marker += -1 * (
mask() - 1);
53 copyMakeBorder(marker, markerBorder, 1, 1, 1, 1, cv::BORDER_CONSTANT, 0);
57 for (
int y = 0; y < markerBorder.rows - 1; y++)
59 for (
int x = 0; x < markerBorder.cols - 1; x++)
61 if (((markerBorder.at<uchar>(y, x) == markerBorder.at<uchar>(y + 1, x + 1)) &&
62 (markerBorder.at<uchar>(y, x) != markerBorder.at<uchar>(y, x + 1) ||
63 markerBorder.at<uchar>(y, x) != markerBorder.at<uchar>(y + 1, x)))
67 ((markerBorder.at<uchar>(y, x + 1) == markerBorder.at<uchar>(y + 1, x)) &&
68 (markerBorder.at<uchar>(y, x + 1) != markerBorder.at<uchar>(y, x) ||
69 markerBorder.at<uchar>(y, x + 1) != markerBorder.at<uchar>(y + 1, x + 1))))
71 cv::Point3f(x - nBitsSquared / 2.
f, -(y - nBitsSquared / 2.
f), 0) * bitSize);