Merge pull request #22208 from vrabaud:34_calibinit
authorVincent Rabaud <vrabaud@users.noreply.github.com>
Thu, 7 Jul 2022 22:24:01 +0000 (00:24 +0200)
committerGitHub <noreply@github.com>
Thu, 7 Jul 2022 22:24:01 +0000 (01:24 +0300)
Add missing code.

* Add missing code.

This was removed in c7fc563dc0ac2d21ad2bd618e741227c0a4b4f76
The resize is also a side-effect.

* Use shorteer cv::Point2f *=

modules/calib3d/src/calibinit.cpp

index 0a8cdd5c6f9381fd0a867a043b049c0eb0b82038..1dff8de6e64325c32e21ae3bc43a36cbeb27c436 100644 (file)
@@ -1232,7 +1232,7 @@ int ChessBoardDetector::cleanFoundConnectedQuads(std::vector<ChessBoardQuad*>& q
         centers[i] = ci;
         center += ci;
     }
-    center.x *= (1.0f / quad_count);
+    center *= (1.0f / quad_count);
 
     // If we still have more quadrangles than we should,
     // we try to eliminate bad ones based on minimizing the bounding box.
@@ -1298,6 +1298,7 @@ int ChessBoardDetector::cleanFoundConnectedQuads(std::vector<ChessBoardQuad*>& q
         quad_group[min_box_area_index] = quad_group[quad_count];
         centers[min_box_area_index] = centers[quad_count];
     }
+    quad_group.resize(quad_count);
 
     return quad_count;
 }