nareshmlx/opencv-pr huggingface dataset:
**File:** modules/video/src/tracking/tracker_nano.cpp
**Change Type:** added
**Context:** PR #22808: support Nanotrack in video module

**Code Changes:**
```diff
@@ -0,0 +1,359 @@
+// This file is part of OpenCV project.
+// It is subject to the license terms in the LICENSE file found in the top-level directory
+// of this distribution and at http://opencv.org/license.html.
+
+// This file is modified from the https://github.com/HonglinChu/NanoTrack/blob/master/ncnn_macos_nanotrack/nanotrack.cpp
+// Author, HongLinChu, 1628464345@qq.com
+// Adapt to OpenCV, ZihaoMu: zihaomu@outlook.com
+
+// Link to original inference code: https://github.com/HonglinChu/NanoTrack
```

Review comment:
> `float(0.5)` `0.5f`
**File:** modules/video/src/tracking/tracker_nano.cpp
**Change Type:** added
**Context:** PR #22808: support Nanotrack in video module

**Code Changes:**
```diff
@@ -0,0 +1,359 @@
+// This file is part of OpenCV project.
+// It is subject to the license terms in the LICENSE file found in the top-level directory
+// of this distribution and at http://opencv.org/license.html.
+
+// This file is modified from the https://github.com/HonglinChu/NanoTrack/blob/master/ncnn_macos_nanotrack/nanotrack.cpp
+// Author, HongLinChu, 1628464345@qq.com
+// Adapt to OpenCV, ZihaoMu: zihaomu@outlook.com
+
+// Link to original inference code: https://github.com/HonglinChu/NanoTrack
```

Review comment:
> MatShape Unused.
**File:** samples/python/tracker.py
**Change Type:** modified
**Context:** PR #22808: support Nanotrack in video module

**Code Changes:**
```diff
@@ -9,6 +9,9 @@
     network:     https://www.dropbox.com/s/rr1lk9355vzolqv/dasiamrpn_model.onnx?dl=0
     kernel_r1:   https://www.dropbox.com/s/999cqx5zrfi7w4p/dasiamrpn_kernel_r1.onnx?dl=0
     kernel_cls1: https://www.dropbox.com/s/qvmtszx5h339a0w/dasiamrpn_kernel_cls1.onnx?dl=0
+For NanoTrack:
+    nanotrack_backbone: https://github.com/HonglinChu/SiamTrackers/blob/master/NanoTrack/models/onnx/nanotrack_backbone_sim.onnx
+    nanotrack_headneck: https://github.com/HonglinChu/SiamTrackers/blob/master/NanoTrack/models/onnx/nanotrack_head_sim.onnx
 
 USAGE:
     tracker.py [-h] [--input INPUT] [--tracker_algo TRACKER_ALGO]
```

Review comment:
> nanotrack_backone typo multiple places
**File:** modules/3d/test/test_tsdf.cpp
**Change Type:** modified
**Context:** PR #22863: TSDF tests refactored

**Code Changes:**
```diff
@@ -56,7 +56,7 @@ struct RenderInvoker : ParallelLoopBody
                 Point3f screenVec = reproj(Point3f((float)x, (float)y, 1.f));
                 float xyt = 1.f / (screenVec.x * screenVec.x +
                     screenVec.y * screenVec.y + 1.f);
-                Point3f dir = normalize(Vec3f(pose.rotation() * screenVec));
+                Point3f dir = cv::normalize(Vec3f(pose.rotation() * screenVec));
                 // screen space axis
                 dir.y = -dir.y;
 
@@ -113,7 +113,7 @@ struct RenderColorInvoker : ParallelLoopBody
```

Review comment:
`colors` is not used in tests.
**File:** modules/3d/test/test_tsdf.cpp
**Change Type:** modified
**Context:** PR #22863: TSDF tests refactored
**Review Line:** 1016

**Code Changes:**
```diff
-    OpenCLStatusRevert oclStatus;
-    oclStatus.off();
-    valid_points_test_custom_framesize(VolumeType::TSDF, VolumeTestSrcType::ODOMETRY_FRAME);
-}
+    Mat points, normals;
+    points  = upoints.getMat(ACCESS_READ);
+    normals = unormals.getMat(ACCESS_READ);
 
-TEST(TSDF_CPU, valid_points_common_framesize_mat)
-{
-    OpenCLStatusRevert oclStatus;
```

Review comment:
Points are not checked.
**File:** modules/3d/test/test_tsdf.cpp
**Change Type:** modified
**Context:** PR #22863: TSDF tests refactored
**Review Line:** 1034

**Code Changes:**
```diff
-    OpenCLStatusRevert oclStatus;
-    oclStatus.off();
-    normal_test_custom_framesize(VolumeType::HashTSDF, VolumeTestFunction::RAYCAST, VolumeTestSrcType::MAT);
-}
+    Mat points, normals;
+    points  = upoints.getMat(ACCESS_READ);
+    normals = unormals.getMat(ACCESS_READ);
 
-TEST(HashTSDF_CPU, raycast_common_framesize_normals_frame)
-{
-    OpenCLStatusRevert oclStatus;
```

Review comment:
Points are not checked.
**File:** modules/3d/test/test_tsdf.cpp
**Change Type:** modified
**Context:** PR #22863: TSDF tests refactored
**Review Line:** 1117

**Code Changes:**
```diff
-{
-    OpenCLStatusRevert oclStatus;
-    oclStatus.off();
-    normal_test_custom_framesize(VolumeType::ColorTSDF, VolumeTestFunction::FETCH_NORMALS, VolumeTestSrcType::MAT);
+    ASSERT_GT(profile, 0) << "There are no points in profile";
+    ASSERT_GT(enface, 0) << "There are no points in enface";
+    ASSERT_LT(abs(0.5 - percentValidity), 0.05) << "percentValidity should be in range 45-55%, but it's " << percentValidity*100.f << "%";
 }
 
-TEST(ColorTSDF_CPU, fetch_points_normals)
+TEST_P(VolumeTestFixture, valid_points)
```

Review comment:
It's very weak check for `points`. `colors` part is not checked.
**File:** modules/3d/include/opencv2/3d/volume_settings.hpp
**Change Type:** modified
**Context:** PR #22863: TSDF tests refactored
**Review Line:** 33

**Code Changes:**
```diff
@@ -31,7 +31,6 @@ class CV_EXPORTS_W VolumeSettings
     * @param volumeType volume type.
     */
     VolumeSettings(VolumeType volumeType);
-
     VolumeSettings(const VolumeSettings& vs);
     ~VolumeSettings();
 
```

Review comment:
`explicit` constructors should be used.
**File:** modules/3d/include/opencv2/3d/volume_settings.hpp
**Change Type:** modified
**Context:** PR #22863: TSDF tests refactored
**Review Line:** 33

**Code Changes:**
```diff
@@ -31,7 +31,6 @@ class CV_EXPORTS_W VolumeSettings
     * @param volumeType volume type.
     */
     VolumeSettings(VolumeType volumeType);
-
     VolumeSettings(const VolumeSettings& vs);
     ~VolumeSettings();
 
```

Review comment:
This will be fixed in my next PR
**File:** modules/videoio/src/cap_interface.hpp
**Change Type:** modified
**Context:** PR #22792: Add support for CAP_PROP_ORIENTATION_AUTO to AVFoundation backend

**Code Changes:**
```diff
@@ -221,6 +221,8 @@ class IVideoCapture
     virtual int getCaptureDomain() { return CAP_ANY; } // Return the type of the capture object: CAP_DSHOW, etc...
 };
 
+void applyMetadataRotation(const IVideoCapture& cap, OutputArray mat);
+
 class IVideoWriter
 {
 public:
@@ -249,21 +251,58 @@ class LegacyCapture : public IVideoCapture
```

Review comment:
> IVideoCapture This is "interface" class ('I' prefix). Only public virtual pure methods are allowed here. Implementation should go to implementation classes or dedicated functions (with `IVideoCapture& cap` extra parameter).
**File:** modules/videoio/src/cap_interface.hpp
**Change Type:** modified
**Context:** PR #22792: Add support for CAP_PROP_ORIENTATION_AUTO to AVFoundation backend

**Code Changes:**
```diff
@@ -221,6 +221,8 @@ class IVideoCapture
     virtual int getCaptureDomain() { return CAP_ANY; } // Return the type of the capture object: CAP_DSHOW, etc...
 };
 
+void applyMetadataRotation(const IVideoCapture& cap, OutputArray mat);
+
 class IVideoWriter
 {
 public:
@@ -249,21 +251,58 @@ class LegacyCapture : public IVideoCapture
```

Review comment:
Lets avoid multi-level switches. If capture is not opened then any query calls are invalid (0 value is a legacy from C API).
**File:** modules/videoio/src/cap_interface.hpp
**Change Type:** modified
**Context:** PR #22792: Add support for CAP_PROP_ORIENTATION_AUTO to AVFoundation backend

**Code Changes:**
```diff
@@ -221,6 +221,8 @@ class IVideoCapture
     virtual int getCaptureDomain() { return CAP_ANY; } // Return the type of the capture object: CAP_DSHOW, etc...
 };
 
+void applyMetadataRotation(const IVideoCapture& cap, OutputArray mat);
+
 class IVideoWriter
 {
 public:
@@ -249,21 +251,58 @@ class LegacyCapture : public IVideoCapture
```

Review comment:
Done, also applied to set().
**File:** modules/videoio/src/cap_interface.hpp
**Change Type:** modified
**Context:** PR #22792: Add support for CAP_PROP_ORIENTATION_AUTO to AVFoundation backend

**Code Changes:**
```diff
@@ -221,6 +221,8 @@ class IVideoCapture
     virtual int getCaptureDomain() { return CAP_ANY; } // Return the type of the capture object: CAP_DSHOW, etc...
 };
 
+void applyMetadataRotation(const IVideoCapture& cap, OutputArray mat);
+
 class IVideoWriter
 {
 public:
@@ -249,21 +251,58 @@ class LegacyCapture : public IVideoCapture
```

Review comment:
OK, done. Left it as an inline function, but I'd prefer to move the body to a .cpp file - just don't know which.
**File:** modules/videoio/src/cap_interface.hpp
**Change Type:** modified
**Context:** PR #22792: Add support for CAP_PROP_ORIENTATION_AUTO to AVFoundation backend

**Code Changes:**
```diff
@@ -221,6 +221,8 @@ class IVideoCapture
     virtual int getCaptureDomain() { return CAP_ANY; } // Return the type of the capture object: CAP_DSHOW, etc...
 };
 
+void applyMetadataRotation(const IVideoCapture& cap, OutputArray mat);
+
 class IVideoWriter
 {
 public:
@@ -249,21 +251,58 @@ class LegacyCapture : public IVideoCapture
```

Review comment:
`rotation_auto` and `rotation_angle` are enough as parameters. I propose to split concerns.
**File:** modules/videoio/src/cap_interface.hpp
**Change Type:** modified
**Context:** PR #22792: Add support for CAP_PROP_ORIENTATION_AUTO to AVFoundation backend

**Code Changes:**
```diff
@@ -221,6 +221,8 @@ class IVideoCapture
     virtual int getCaptureDomain() { return CAP_ANY; } // Return the type of the capture object: CAP_DSHOW, etc...
 };
 
+void applyMetadataRotation(const IVideoCapture& cap, OutputArray mat);
+
 class IVideoWriter
 {
 public:
@@ -249,21 +251,58 @@ class LegacyCapture : public IVideoCapture
```

Review comment:
So, something like ``` static void applyMetadataRotation(bool rotation_auto, int rotation_angle, OutputArray mat) { if (!rotation_auto) return; ... } ``` and at the call site ``` applyMetadataRotation( 0 != cap.getProperty(CAP_PROP_ORIENTATION_AUTO), static_cast<int>(cap.getProperty(CAP_PROP_ORIENTATION_META)), image); ``` ? I don't what the call site looks like in this variation. Maybe split applyMetadataRotation in two: ``` static void applyMetadataRotation(const IVideoCapture& cap, OutputArray mat) { bool rotation_auto = 0 != cap.getProperty(CAP_PROP_ORIENTATION_AUTO); int rotation_angle = static_cast<int>(cap.getProperty(CAP_PROP_ORIENTATION_META)); if (rotation_auto) { applyMetadataRotation(mat, rotation_angle); } } static void applyMetadataRotation(int rotation_angle, OutputArray mat) { ... } ```
**File:** modules/videoio/src/cap_interface.hpp
**Change Type:** modified
**Context:** PR #22792: Add support for CAP_PROP_ORIENTATION_AUTO to AVFoundation backend

**Code Changes:**
```diff
@@ -221,6 +221,8 @@ class IVideoCapture
     virtual int getCaptureDomain() { return CAP_ANY; } // Return the type of the capture object: CAP_DSHOW, etc...
 };
 
+void applyMetadataRotation(const IVideoCapture& cap, OutputArray mat);
+
 class IVideoWriter
 {
 public:
@@ -249,21 +251,58 @@ class LegacyCapture : public IVideoCapture
```

Review comment:
Yes, I mean `static void applyMetadataRotation(int rotation_angle, bool autorotation, OutputArray mat)`. The current version works for me too.
**File:** modules/videoio/src/cap_interface.hpp
**Change Type:** modified
**Context:** PR #22792: Add support for CAP_PROP_ORIENTATION_AUTO to AVFoundation backend

**Code Changes:**
```diff
@@ -221,6 +221,8 @@ class IVideoCapture
     virtual int getCaptureDomain() { return CAP_ANY; } // Return the type of the capture object: CAP_DSHOW, etc...
 };
 
+void applyMetadataRotation(const IVideoCapture& cap, OutputArray mat);
+
 class IVideoWriter
 {
 public:
@@ -249,21 +251,58 @@ class LegacyCapture : public IVideoCapture
```

Review comment:
I'd prefer to keep it as-is, then. The next PR that adds support for orientation metadata to another backend can decide to refactor this function, I guess, if necessary.
**File:** modules/videoio/src/cap_interface.hpp
**Change Type:** modified
**Context:** PR #22792: Add support for CAP_PROP_ORIENTATION_AUTO to AVFoundation backend

**Code Changes:**
```diff
@@ -221,6 +221,8 @@ class IVideoCapture
     virtual int getCaptureDomain() { return CAP_ANY; } // Return the type of the capture object: CAP_DSHOW, etc...
 };
 
+void applyMetadataRotation(const IVideoCapture& cap, OutputArray mat);
+
 class IVideoWriter
 {
 public:
@@ -249,21 +251,58 @@ class LegacyCapture : public IVideoCapture
```

Review comment:
I would prefer to split definition (here) and declaration (e.g., in cap.cpp file)
**File:** modules/videoio/src/cap_ffmpeg.cpp
**Change Type:** modified
**Context:** PR #22792: Add support for CAP_PROP_ORIENTATION_AUTO to AVFoundation backend
**Review Line:** 115

**Code Changes:**
```diff
@@ -112,7 +112,7 @@ class CvCapture_FFMPEG_proxy CV_FINAL : public cv::IVideoCapture
         }
 
         cv::Mat tmp(height, width, CV_MAKETYPE(CV_8U, cn), data, step);
-        this->rotateFrame(tmp);
+        applyMetadataRotation(*this, tmp);
         tmp.copyTo(frame);
 
         return true;
@@ -137,30 +137,6 @@ class CvCapture_FFMPEG_proxy CV_FINAL : public cv::IVideoCapture
 
```

Review comment:
Apparently this PR breaks FFmpeg plugin build (with `-DVIDEOIO_PLUGIN_LIST=ffmpeg` option). In this mode it does not compile `cap.cpp` which contains `applyMetadataRotation` function and can not find it. Perhaps we could move this function to one of headers used by both AVFoundation and FFmpeg backends or to a separate source module and add it to the plugin compilation process.
**File:** modules/videoio/src/cap_ffmpeg.cpp
**Change Type:** modified
**Context:** PR #22792: Add support for CAP_PROP_ORIENTATION_AUTO to AVFoundation backend
**Review Line:** 115

**Code Changes:**
```diff
@@ -112,7 +112,7 @@ class CvCapture_FFMPEG_proxy CV_FINAL : public cv::IVideoCapture
         }
 
         cv::Mat tmp(height, width, CV_MAKETYPE(CV_8U, cn), data, step);
-        this->rotateFrame(tmp);
+        applyMetadataRotation(*this, tmp);
         tmp.copyTo(frame);
 
         return true;
@@ -137,30 +137,6 @@ class CvCapture_FFMPEG_proxy CV_FINAL : public cv::IVideoCapture
 
```

Review comment:
Should I take care of this in a separate PR or will you do it internally in the team?
**File:** modules/videoio/src/cap_ffmpeg.cpp
**Change Type:** modified
**Context:** PR #22792: Add support for CAP_PROP_ORIENTATION_AUTO to AVFoundation backend
**Review Line:** 115

**Code Changes:**
```diff
@@ -112,7 +112,7 @@ class CvCapture_FFMPEG_proxy CV_FINAL : public cv::IVideoCapture
         }
 
         cv::Mat tmp(height, width, CV_MAKETYPE(CV_8U, cn), data, step);
-        this->rotateFrame(tmp);
+        applyMetadataRotation(*this, tmp);
         tmp.copyTo(frame);
 
         return true;
@@ -137,30 +137,6 @@ class CvCapture_FFMPEG_proxy CV_FINAL : public cv::IVideoCapture
 
```

Review comment:
I'll try to fix it today.
**File:** modules/dnn/src/layers/tile_layer.cpp
**Change Type:** added
**Context:** PR #22809: dnn: support ONNX Tile

**Code Changes:**
```diff
@@ -0,0 +1,97 @@
+// This file is part of OpenCV project.
+// It is subject to the license terms in the LICENSE file found in the top-level directory
+// of this distribution and at http://opencv.org/license.html.
+
+#include "../precomp.hpp"
+#include "layers_common.hpp"
+
+#include <opencv2/dnn/shape_utils.hpp>
+
```

Review comment:
Does this work for all-const inputs?
**File:** modules/dnn/src/layers/tile_layer.cpp
**Change Type:** added
**Context:** PR #22809: dnn: support ONNX Tile

**Code Changes:**
```diff
@@ -0,0 +1,97 @@
+// This file is part of OpenCV project.
+// It is subject to the license terms in the LICENSE file found in the top-level directory
+// of this distribution and at http://opencv.org/license.html.
+
+#include "../precomp.hpp"
+#include "layers_common.hpp"
+
+#include <opencv2/dnn/shape_utils.hpp>
+
```

Review comment:
If we don't support it, we should expect 1 input.
**File:** modules/dnn/src/layers/tile_layer.cpp
**Change Type:** added
**Context:** PR #22809: dnn: support ONNX Tile

**Code Changes:**
```diff
@@ -0,0 +1,97 @@
+// This file is part of OpenCV project.
+// It is subject to the license terms in the LICENSE file found in the top-level directory
+// of this distribution and at http://opencv.org/license.html.
+
+#include "../precomp.hpp"
+#include "layers_common.hpp"
+
+#include <opencv2/dnn/shape_utils.hpp>
+
```

Review comment:
Indeed one input should be expected, but `repeats` is an input item for Tile. I did not find a example on removing a constant input from the inputs of a layer in the ONNX importer though. Maybe I missed something. So I just leave it as-is but put it in the list of parameters in addition.
**File:** modules/dnn/src/layers/tile_layer.cpp
**Change Type:** added
**Context:** PR #22809: dnn: support ONNX Tile

**Code Changes:**
```diff
@@ -0,0 +1,97 @@
+// This file is part of OpenCV project.
+// It is subject to the license terms in the LICENSE file found in the top-level directory
+// of this distribution and at http://opencv.org/license.html.
+
+#include "../precomp.hpp"
+#include "layers_common.hpp"
+
+#include <opencv2/dnn/shape_utils.hpp>
+
```

Review comment:
It should, the input size should still be 2 for tile>1 and 3 for tile-1.
**File:** modules/dnn/src/layers/tile_layer.cpp
**Change Type:** added
**Context:** PR #22809: dnn: support ONNX Tile

**Code Changes:**
```diff
@@ -0,0 +1,97 @@
+// This file is part of OpenCV project.
+// It is subject to the license terms in the LICENSE file found in the top-level directory
+// of this distribution and at http://opencv.org/license.html.
+
+#include "../precomp.hpp"
+#include "layers_common.hpp"
+
+#include <opencv2/dnn/shape_utils.hpp>
+
```

Review comment:
Do we have a test for that? It's just you send only 1 input as far as I can see ```cpp std::vector<Mat> inputs, output; Mat input0_blob = getBlob(node_proto, 0); inputs.push_back(input0_blob); runLayer(layerParams, inputs, output); CV_Assert(output.size() == 1); addConstant(node_proto.output(0), output[0]); return; ``` UPD: Nvm, I missed "LE".
**File:** modules/dnn/src/layers/tile_layer.cpp
**Change Type:** added
**Context:** PR #22809: dnn: support ONNX Tile

**Code Changes:**
```diff
@@ -0,0 +1,97 @@
+// This file is part of OpenCV project.
+// It is subject to the license terms in the LICENSE file found in the top-level directory
+// of this distribution and at http://opencv.org/license.html.
+
+#include "../precomp.hpp"
+#include "layers_common.hpp"
+
+#include <opencv2/dnn/shape_utils.hpp>
+
```

Review comment:
You can see the example here: https://github.com/opencv/opencv/blob/3f371fe2dd909b29fa6cc01b35649e3b58b265f2/modules/dnn/src/onnx/onnx_importer.cpp#L660 I might've missed something obvious in the API(pop_back or something), but my approach is clear inputs and add new ones manually. In your case that would be clear + add first input.
**File:** modules/dnn/src/layers/tile_layer.cpp
**Change Type:** added
**Context:** PR #22809: dnn: support ONNX Tile

**Code Changes:**
```diff
@@ -0,0 +1,97 @@
+// This file is part of OpenCV project.
+// It is subject to the license terms in the LICENSE file found in the top-level directory
+// of this distribution and at http://opencv.org/license.html.
+
+#include "../precomp.hpp"
+#include "layers_common.hpp"
+
+#include <opencv2/dnn/shape_utils.hpp>
+
```

Review comment:
**Update**: The constant inputs are filtered out by: ```cpp void ONNXImporter::addLayer(LayerParams& layerParams, const opencv_onnx::NodeProto& node_proto) { // ... for (int j = 0; j < node_proto.input_size(); j++) { const std::string& input_name = node_proto.input(j); IterLayerId_t layerId = layer_id.find(input_name); if (layerId != layer_id.end()) { // ... } } } ``` , since those constant inputs have no corresponding layers. I guess we can now limit the number of inputs for Tile to be exactly one without the 'clear + add first input' change, can't we? --- Surprisingly, the number of input (printed in `getMemoryShapes`, something like this `std::cout << "Tile: getMemoryShapes: " << inputs.size() << std::endl;`) is always one regardless of the 'clear + add first input' change. I also had a try with the tile onnx model with `repeats` being `category: Constant` instead of `category: Initializer`, and the number of input is still one. Any ideas?
**File:** modules/dnn/src/layers/tile_layer.cpp
**Change Type:** added
**Context:** PR #22809: dnn: support ONNX Tile

**Code Changes:**
```diff
@@ -0,0 +1,97 @@
+// This file is part of OpenCV project.
+// It is subject to the license terms in the LICENSE file found in the top-level directory
+// of this distribution and at http://opencv.org/license.html.
+
+#include "../precomp.hpp"
+#include "layers_common.hpp"
+
+#include <opencv2/dnn/shape_utils.hpp>
+
```

Review comment:
Yeah, you're right. Since mentioned inputs don't become constant layers, we get only the first one. Then we just need to change the assert from <=3 to exactly 1.
**File:** modules/objdetect/src/qrcode.cpp
**Change Type:** modified
**Context:** PR #22695: Improve QR code version estimation

**Code Changes:**
```diff
@@ -16,7 +16,6 @@
 
 #include <limits>
 #include <cmath>
-#include <iostream>
 #include <queue>
 #include <limits>
 #include <map>
@@ -990,6 +989,7 @@ class QRDecode
     bool straightDecodingProcess();
```

Review comment:
I propose to rename version candidates to proper names like `versionByNumModules`, `versionByNumTransitions` or something else meaningful.
**File:** modules/objdetect/src/qrcode.cpp
**Change Type:** modified
**Context:** PR #22695: Improve QR code version estimation

**Code Changes:**
```diff
@@ -16,7 +16,6 @@
 
 #include <limits>
 #include <cmath>
-#include <iostream>
 #include <queue>
 #include <limits>
 #include <map>
@@ -990,6 +989,7 @@ class QRDecode
     bool straightDecodingProcess();
```

Review comment:
const. Please add reference to documentation where it was taken.
**File:** modules/objdetect/src/qrcode.cpp
**Change Type:** modified
**Context:** PR #22695: Improve QR code version estimation

**Code Changes:**
```diff
@@ -16,7 +16,6 @@
 
 #include <limits>
 #include <cmath>
-#include <iostream>
 #include <queue>
 #include <limits>
 #include <map>
@@ -990,6 +989,7 @@ class QRDecode
     bool straightDecodingProcess();
```

Review comment:
I propose to iterate from zero to `sizeof(versionCodes)/sizeof(versionCodes[0])` to be sure that loop and the table are consistent. `Mat currVers(Size(3, 6), CV_8UC1, versionCodes[i-7]);` will be `Mat currVers(Size(3, 6), CV_8UC1, versionCodes[i]);` AN you can do `indexMinDist+=7` after the loop, if it's needed.
**File:** modules/objdetect/src/qrcode.cpp
**Change Type:** modified
**Context:** PR #22695: Improve QR code version estimation

**Code Changes:**
```diff
@@ -16,7 +16,6 @@
 
 #include <limits>
 #include <cmath>
-#include <iostream>
 #include <queue>
 #include <limits>
 #include <map>
@@ -990,6 +989,7 @@ class QRDecode
     bool straightDecodingProcess();
```

Review comment:
The version will appear in log twice.
**File:** modules/objdetect/src/qrcode.cpp
**Change Type:** modified
**Context:** PR #22695: Improve QR code version estimation

**Code Changes:**
```diff
@@ -16,7 +16,6 @@
 
 #include <limits>
 #include <cmath>
-#include <iostream>
 #include <queue>
 #include <limits>
 #include <map>
@@ -990,6 +989,7 @@ class QRDecode
     bool straightDecodingProcess();
```

Review comment:
I propose to extract 0.16 as constant and add comment about meaning and value origin.
**File:** modules/objdetect/src/qrcode.cpp
**Change Type:** modified
**Context:** PR #22695: Improve QR code version estimation

**Code Changes:**
```diff
@@ -16,7 +16,6 @@
 
 #include <limits>
 #include <cmath>
-#include <iostream>
 #include <queue>
 #include <limits>
 #include <map>
@@ -990,6 +989,7 @@ class QRDecode
     bool straightDecodingProcess();
```

Review comment:
The name does not contain function semantic. I propose something like `nearestVertices` or `closestPair`.