16 #include <mrpt/3rdparty/do_opencv_includes.h>
38 bool useScaramuzzaMethod)
51 bool corners_found =
false;
57 vector<CvPoint2D32f> corners_list;
58 corners_count = CORNERS_COUNT;
59 corners_list.resize(CORNERS_COUNT);
63 int find_chess_flags = cv::CALIB_CB_ADAPTIVE_THRESH;
64 if (normalize_image) find_chess_flags |= cv::CALIB_CB_NORMALIZE_IMAGE;
67 if (!useScaramuzzaMethod)
69 vector<cv::Point2f> pointbuf;
73 cvImg, check_size, pointbuf, find_chess_flags);
75 corners_list.resize(pointbuf.size());
76 for (
size_t i = 0; i < pointbuf.size(); i++)
78 corners_list[i].x = pointbuf[i].x;
79 corners_list[i].y = pointbuf[i].y;
90 if (corners_found && corners_count != CORNERS_COUNT) corners_found =
false;
97 &iplImg, &corners_list[0], corners_count, cvSize(5, 5),
99 cvTermCriteria(CV_TERMCRIT_ITER | CV_TERMCRIT_EPS, 10, 0.01f));
104 for (y = 0, k = 0; y < check_size.height; y++)
105 for (
int x = 0; x < check_size.width; x++, k++)
106 cornerCoords.emplace_back(corners_list[k].x, corners_list[k].y);
109 return corners_found;
135 std::vector<std::vector<TPixelCoordf>>& cornerCoords,
142 const IplImage img_ipl = cvIplImage(img_m);
144 std::vector<std::vector<CvPoint2D32f>> corners_list;
150 if (corners_found && !corners_list.empty())
153 cornerCoords.resize(corners_list.size());
156 for (
size_t i = 0; i < corners_list.size(); i++)
164 cvTermCriteria(CV_TERMCRIT_ITER | CV_TERMCRIT_EPS, 10, 0.01f));
170 corners_list[i][k].x, corners_list[i][k].y));
179 cornerCoords[i][0].y},
180 pt_x1{cornerCoords[i][1].x, cornerCoords[i][1].y},
199 cornerCoords.clear();