From 10c43e56423d399046f1c94d2e8fe6d729b8836a Mon Sep 17 00:00:00 2001 From: Maxim Smolskiy Date: Thu, 30 Nov 2023 10:59:06 +0300 Subject: [PATCH] Merge pull request #24597 from MaximSmolskiy:fix-bug-in-ChessBoardDetector-findQuadNeighbors Fix bug in ChessBoardDetector::findQuadNeighbors #24597 ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [x] The PR is proposed to the proper branch - [ ] There is a reference to the original bug report and related work - [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [ ] The feature is well documented and sample code can be built with the project CMake --- modules/calib3d/src/calibinit.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/calib3d/src/calibinit.cpp b/modules/calib3d/src/calibinit.cpp index c979f0bb62..e4909bb575 100644 --- a/modules/calib3d/src/calibinit.cpp +++ b/modules/calib3d/src/calibinit.cpp @@ -1630,7 +1630,7 @@ void ChessBoardDetector::findQuadNeighbors() { // check edge lengths, make sure they're compatible // edges that are different by more than 1:4 are rejected - float ediff = cur_quad.edge_len - q_k.edge_len; + const float ediff = fabs(cur_quad.edge_len - q_k.edge_len); if (ediff > 32*cur_quad.edge_len || ediff > 32*q_k.edge_len) {