From 78a765cb8166d719ddf5e283badbd06676eddbe4 Mon Sep 17 00:00:00 2001 From: Alexander Smorkalov Date: Fri, 16 Feb 2024 12:11:31 +0300 Subject: [PATCH] Reverted Compensate edge length in ChessBoardDetector::generateQuads #24833 --- modules/calib3d/src/calibinit.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/modules/calib3d/src/calibinit.cpp b/modules/calib3d/src/calibinit.cpp index ea5e5023b9..4b57aad1fe 100644 --- a/modules/calib3d/src/calibinit.cpp +++ b/modules/calib3d/src/calibinit.cpp @@ -234,7 +234,7 @@ public: all_quads_count = 0; } - void generateQuads(const cv::Mat& image_, int flags, int dilations); + void generateQuads(const cv::Mat& image_, int flags); bool processQuads(std::vector& out_corners, int &prev_sqr_size); @@ -547,7 +547,7 @@ bool findChessboardCorners(InputArray image_, Size pattern_size, rectangle( thresh_img_new, Point(0,0), Point(thresh_img_new.cols-1, thresh_img_new.rows-1), Scalar(255,255,255), 3, LINE_8); detector.reset(); - detector.generateQuads(thresh_img_new, flags, dilations); + detector.generateQuads(thresh_img_new, flags); DPRINTF("Quad count: %d/%d", detector.all_quads_count, (pattern_size.width/2+1)*(pattern_size.height/2+1)); SHOW_QUADS("New quads", thresh_img_new, &detector.all_quads[0], detector.all_quads_count); if (detector.processQuads(out_corners, prev_sqr_size)) @@ -612,7 +612,7 @@ bool findChessboardCorners(InputArray image_, Size pattern_size, rectangle( thresh_img, Point(0,0), Point(thresh_img.cols-1, thresh_img.rows-1), Scalar(255,255,255), 3, LINE_8); detector.reset(); - detector.generateQuads(thresh_img, flags, dilations); + detector.generateQuads(thresh_img, flags); DPRINTF("Quad count: %d/%d", detector.all_quads_count, (pattern_size.width/2+1)*(pattern_size.height/2+1)); SHOW_QUADS("Old quads", thresh_img, &detector.all_quads[0], detector.all_quads_count); if (detector.processQuads(out_corners, prev_sqr_size)) @@ -1755,7 +1755,7 @@ void ChessBoardDetector::findQuadNeighbors() // returns corners in clockwise order // corners don't necessarily start at same position on quad (e.g., // top left corner) -void ChessBoardDetector::generateQuads(const cv::Mat& image_, int flags, int dilations) +void ChessBoardDetector::generateQuads(const cv::Mat& image_, int flags) { binarized_image = image_; // save for debug purposes @@ -1880,9 +1880,6 @@ void ChessBoardDetector::generateQuads(const cv::Mat& image_, int flags, int dil float d = normL2Sqr(q.corners[i]->pt - q.corners[(i+1)&3]->pt); q.edge_len = std::min(q.edge_len, d); } - - const int edge_len_compensation = 2 * dilations; - q.edge_len += 2 * sqrt(q.edge_len) * edge_len_compensation + edge_len_compensation * edge_len_compensation; } all_quads_count = quad_count;