nareshmlx/opencv-pr huggingface dataset:
**File:** modules/highgui/cmake/init.cmake
**Change Type:** modified
**Context:** PR #25661: Highgui backend on top of Framebuffer

**Code Changes:**
```diff
@@ -39,6 +39,8 @@ endmacro()
 add_backend("gtk" WITH_GTK)
 add_backend("win32ui" WITH_WIN32UI)
 add_backend("wayland" WITH_WAYLAND)
+add_backend("framebuffer" WITH_FRAMEBUFFER)
+
 # TODO cocoa
 # TODO qt
 # TODO opengl
```

Review comment:
In our case, the user can have the value of two options WITH_FRAMEBUFFER AND WITH_FRAMEBUFFER_XVFB. By the condition below I am trying to avoid re-include: if(WITH_FRAMEBUFFER AND WITH_FRAMEBUFFER_XVFB) add_backend("framebuffer" WITH_FRAMEBUFFER) else() add_backend("framebuffer" WITH_FRAMEBUFFER) add_backend("framebuffer" WITH_FRAMEBUFFER_XVFB) endif() Do I understand correctly that detect_framebuffer.cmake should be divided into two files - standard and XVFB?
**File:** modules/highgui/cmake/detect_framebuffer.cmake
**Change Type:** added
**Context:** PR #25661: Highgui backend on top of Framebuffer

**Code Changes:**
```diff
@@ -0,0 +1,14 @@
+# --- FB ---
+set(HAVE_FRAMEBUFFER ON)
+if(WITH_FRAMEBUFFER_XVFB)
+  try_compile(HAVE_FRAMEBUFFER_XVFB
+    "${CMAKE_CURRENT_BINARY_DIR}"
+    "${OpenCV_SOURCE_DIR}/cmake/checks/framebuffer.cpp")
+  if(HAVE_FRAMEBUFFER_XVFB)
+    message(STATUS "Check virtual framebuffer - done")
+  else()
```

Review comment:
As an example I looked at detect_win32ui.cmake detect_wayland.cmake detect_gtk.cmake All have a structure ocv_clear_vars(HAVE_WAYLAND_CLIENT HAVE_WAYLAND_CURSOR HAVE_XKBCOMMON HAVE_WAYLAND_PROTOCOLS HAVE_WAYLAND_EGL) if(WITH_WAYLAND) Do I need to change my file as per the comment?
**File:** CMakeLists.txt
**Change Type:** modified
**Context:** PR #25661: Highgui backend on top of Framebuffer

**Code Changes:**
```diff
@@ -304,6 +304,10 @@ OCV_OPTION(WITH_GTK "Include GTK support" ON
 OCV_OPTION(WITH_GTK_2_X "Use GTK version 2" OFF
   VISIBLE_IF UNIX AND NOT APPLE AND NOT ANDROID
   VERIFY HAVE_GTK AND NOT HAVE_GTK3)
+OCV_OPTION(WITH_FRAMEBUFFER "Include framebuffer support" OFF
+  VISIBLE_IF UNIX AND NOT APPLE AND NOT ANDROID)
+OCV_OPTION(WITH_FRAMEBUFFER_XVFB "Include virtual framebuffer support" OFF
+  VISIBLE_IF UNIX AND NOT APPLE AND NOT ANDROID)
 OCV_OPTION(WITH_WAYLAND "Include Wayland support" OFF
         VISIBLE_IF UNIX AND NOT APPLE AND NOT ANDROID
```

Review comment:
WITH_FRAMEBUFFER_XVFB part of WITH_FRAMEBUFFER Each of the options can be specified separately. Do I need to change WITH_FRAMEBUFFER to ON if WITH_FRAMEBUFFER_XVFB=ON? How to do this correctly? For example, I can check and replace in modules/highgui/cmake/init.cmake
**File:** modules/highgui/test/test_gui.cpp
**Change Type:** modified
**Context:** PR #25661: Highgui backend on top of Framebuffer

**Code Changes:**
```diff
@@ -148,7 +148,8 @@ static void Foo(int, void* counter)
         && !defined HAVE_WIN32UI \
         && !defined HAVE_WAYLAND \
     ) \
-    || defined(__APPLE__)  // test fails on Mac (cocoa)
+    || defined(__APPLE__)  /* test fails on Mac (cocoa) */ \
+    || defined HAVE_FRAMEBUFFER /* trackbar is not supported */
 TEST(Highgui_GUI, DISABLED_trackbar_unsafe)
 #else
 TEST(Highgui_GUI, trackbar_unsafe)
```

Review comment:
`HAVE_FRAMEBUFFER_XVFB` is left here and on line 195.
**File:** modules/highgui/CMakeLists.txt
**Change Type:** modified
**Context:** PR #25661: Highgui backend on top of Framebuffer

**Code Changes:**
```diff
@@ -49,6 +49,16 @@ list(REMOVE_ITEM highgui_ext_hdrs "${CMAKE_CURRENT_LIST_DIR}/include/opencv2/${n
 
 set(OPENCV_HIGHGUI_BUILTIN_BACKEND "")
 
+if(WITH_FRAMEBUFFER AND HAVE_FRAMEBUFFER)
+  set(OPENCV_HIGHGUI_BUILTIN_BACKEND "FB")
+  add_definitions(-DHAVE_FRAMEBUFFER)
+  list(APPEND highgui_srcs ${CMAKE_CURRENT_LIST_DIR}/src/window_framebuffer.cpp)
+  list(APPEND highgui_hdrs ${CMAKE_CURRENT_LIST_DIR}/src/window_framebuffer.hpp)
+  if(HAVE_FRAMEBUFFER_XVFB)
```

Review comment:
I think we can simplify this block: ```.cmake if(WITH_FRAMEBUFFER AND HAVE_FRAMEBUFFER) set(OPENCV_HIGHGUI_BUILTIN_BACKEND "FB") add_definitions(-DHAVE_FRAMEBUFFER) list(APPEND highgui_srcs ${CMAKE_CURRENT_LIST_DIR}/src/window_framebuffer.cpp) list(APPEND highgui_hdrs ${CMAKE_CURRENT_LIST_DIR}/src/window_framebuffer.hpp) if(HAVE_FRAMEBUFFER_XVFB) add_definitions(-DHAVE_FRAMEBUFFER_XVFB) endif() endif() ```
**File:** modules/highgui/cmake/detect_framebuffer.cmake
**Change Type:** added
**Context:** PR #25661: Highgui backend on top of Framebuffer

**Code Changes:**
```diff
@@ -0,0 +1,14 @@
+# --- FB ---
+set(HAVE_FRAMEBUFFER ON)
+if(WITH_FRAMEBUFFER_XVFB)
+  try_compile(HAVE_FRAMEBUFFER_XVFB
+    "${CMAKE_CURRENT_BINARY_DIR}"
+    "${OpenCV_SOURCE_DIR}/cmake/checks/framebuffer.cpp")
+  if(HAVE_FRAMEBUFFER_XVFB)
+    message(STATUS "Check virtual framebuffer - done")
+  else()
```

Review comment:
```suggestion "Check virtual framebuffer - failed\n" ```
**File:** modules/highgui/src/window_framebuffer.cpp
**Change Type:** added
**Context:** PR #25661: Highgui backend on top of Framebuffer

**Code Changes:**
```diff
@@ -0,0 +1,798 @@
+// 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 "window_framebuffer.hpp"
+
+#include <opencv2/core/utils/configuration.private.hpp>
```

Review comment:
Perhaps these asserts are ambiguous, we already know that image has wrong number of channels, they can be replaced with a single `CV_Error`: ```suggestion CV_Error(cv::Error::StsBadArg, "Bad image: wrong number of channels"); ```
**File:** modules/highgui/CMakeLists.txt
**Change Type:** modified
**Context:** PR #25661: Highgui backend on top of Framebuffer

**Code Changes:**
```diff
@@ -49,6 +49,16 @@ list(REMOVE_ITEM highgui_ext_hdrs "${CMAKE_CURRENT_LIST_DIR}/include/opencv2/${n
 
 set(OPENCV_HIGHGUI_BUILTIN_BACKEND "")
 
+if(WITH_FRAMEBUFFER AND HAVE_FRAMEBUFFER)
+  set(OPENCV_HIGHGUI_BUILTIN_BACKEND "FB")
+  add_definitions(-DHAVE_FRAMEBUFFER)
+  list(APPEND highgui_srcs ${CMAKE_CURRENT_LIST_DIR}/src/window_framebuffer.cpp)
+  list(APPEND highgui_hdrs ${CMAKE_CURRENT_LIST_DIR}/src/window_framebuffer.hpp)
+  if(HAVE_FRAMEBUFFER_XVFB)
```

Review comment:
code replaced
**File:** platforms/android/build_sdk.py
**Change Type:** modified
**Context:** PR #25746: Android SDK build script: HWAsan flags added for release mode

**Code Changes:**
```diff
@@ -267,10 +267,14 @@ def build_library(self, abi, do_install, no_media_ndk):
             cmake_vars['WITH_ANDROID_MEDIANDK'] = "OFF"
 
         if self.hwasan and "arm64" in abi.name:
+            cmake_vars['OPENCV_ENABLE_MEMORY_SANITIZER'] = "ON"
             hwasan_flags = "-fno-omit-frame-pointer -fsanitize=hwaddress"
-            cmake_vars['CMAKE_CXX_FLAGS_DEBUG']    = hwasan_flags
-            cmake_vars['CMAKE_C_FLAGS_DEBUG']      = hwasan_flags
-            cmake_vars['CMAKE_LINKER_FLAGS_DEBUG'] = hwasan_flags
+            for s in ['OPENCV_EXTRA_C_FLAGS', 'OPENCV_EXTRA_CXX_FLAGS', 'OPENCV_EXTRA_EXE_LINKER_FLAGS',
```

Review comment:
We should not touch generic CMake flags. Use `OPENCV_EXTRA_` flags instead: https://github.com/opencv/opencv/blob/4.10.0/cmake/OpenCVCompilerOptions.cmake#L402-L418 Also append them instead of override if they already exist (e.g. defined by config file).
**File:** platforms/android/build_sdk.py
**Change Type:** modified
**Context:** PR #25746: Android SDK build script: HWAsan flags added for release mode

**Code Changes:**
```diff
@@ -267,10 +267,14 @@ def build_library(self, abi, do_install, no_media_ndk):
             cmake_vars['WITH_ANDROID_MEDIANDK'] = "OFF"
 
         if self.hwasan and "arm64" in abi.name:
+            cmake_vars['OPENCV_ENABLE_MEMORY_SANITIZER'] = "ON"
             hwasan_flags = "-fno-omit-frame-pointer -fsanitize=hwaddress"
-            cmake_vars['CMAKE_CXX_FLAGS_DEBUG']    = hwasan_flags
-            cmake_vars['CMAKE_C_FLAGS_DEBUG']      = hwasan_flags
-            cmake_vars['CMAKE_LINKER_FLAGS_DEBUG'] = hwasan_flags
+            for s in ['OPENCV_EXTRA_C_FLAGS', 'OPENCV_EXTRA_CXX_FLAGS', 'OPENCV_EXTRA_EXE_LINKER_FLAGS',
```

Review comment:
> Also append them instead of override if they already exist (e.g. defined by config file).
**File:** modules/dnn/test/test_int8_layers.cpp
**Change Type:** modified
**Context:** PR #25779: dnn: add DepthToSpace and SpaceToDepth

**Code Changes:**
```diff
@@ -509,6 +509,61 @@ TEST_P(Test_Int8_layers, Eltwise)
     testLayer("split_max", "ONNX", 0.004, 0.012);
 }
 
+TEST_P(Test_Int8_layers, DepthSpaceOps) {
+    auto test_layer_with_onnx_conformance_models = [&](const std::string &model_name, double l1, double lInf) {
+        std::string model_path = _tf("onnx/conformance/node/test_" + model_name + "/model.onnx");
+        auto net = readNet(model_path);
+
+        // load reference inputs and outputs
```

Review comment:
Does difference look very huge? If I'm not mistaken, there is no calculations inside the operation, only transposition.
**File:** modules/dnn/test/test_int8_layers.cpp
**Change Type:** modified
**Context:** PR #25779: dnn: add DepthToSpace and SpaceToDepth

**Code Changes:**
```diff
@@ -509,6 +509,61 @@ TEST_P(Test_Int8_layers, Eltwise)
     testLayer("split_max", "ONNX", 0.004, 0.012);
 }
 
+TEST_P(Test_Int8_layers, DepthSpaceOps) {
+    auto test_layer_with_onnx_conformance_models = [&](const std::string &model_name, double l1, double lInf) {
+        std::string model_path = _tf("onnx/conformance/node/test_" + model_name + "/model.onnx");
+        auto net = readNet(model_path);
+
+        // load reference inputs and outputs
```

Review comment:
Yes, I know. Other test cases seem to be good though. Maybe skip it for TIM-VX backend until the current integrated version is updated and re-test.
**File:** modules/dnn/test/test_int8_layers.cpp
**Change Type:** modified
**Context:** PR #25779: dnn: add DepthToSpace and SpaceToDepth

**Code Changes:**
```diff
@@ -509,6 +509,61 @@ TEST_P(Test_Int8_layers, Eltwise)
     testLayer("split_max", "ONNX", 0.004, 0.012);
 }
 
+TEST_P(Test_Int8_layers, DepthSpaceOps) {
+    auto test_layer_with_onnx_conformance_models = [&](const std::string &model_name, double l1, double lInf) {
+        std::string model_path = _tf("onnx/conformance/node/test_" + model_name + "/model.onnx");
+        auto net = readNet(model_path);
+
+        // load reference inputs and outputs
```

Review comment:
Skip this test for now.
**File:** modules/dnn/src/cuda4dnn/primitives/depth_space_ops.hpp
**Change Type:** added
**Context:** PR #25779: dnn: add DepthToSpace and SpaceToDepth
**Review Line:** 60

**Code Changes:**
```diff
+            // Call reshape on input so that it has the correct shape for permutation
+            input.reshape(internal_shape.begin(), internal_shape.end());
+            kernels::permute(stream, transposed_internal, input, permutation);
+            // Only copying is needed as output already has the expected shape
+            auto t = csl::TensorView<T>(transposed_internal);
+            csl::memcpy(output.get(), t.get(), output.size(), stream);
+        }
+
+        std::size_t get_workspace_memory_in_bytes() const noexcept override { return scratch_mem_in_bytes; }
+
+    private:
```

Review comment:
Could we get rid of `memcpy` here?
**File:** modules/dnn/src/cuda4dnn/primitives/depth_space_ops.hpp
**Change Type:** added
**Context:** PR #25779: dnn: add DepthToSpace and SpaceToDepth
**Review Line:** 60

**Code Changes:**
```diff
+            // Call reshape on input so that it has the correct shape for permutation
+            input.reshape(internal_shape.begin(), internal_shape.end());
+            kernels::permute(stream, transposed_internal, input, permutation);
+            // Only copying is needed as output already has the expected shape
+            auto t = csl::TensorView<T>(transposed_internal);
+            csl::memcpy(output.get(), t.get(), output.size(), stream);
+        }
+
+        std::size_t get_workspace_memory_in_bytes() const noexcept override { return scratch_mem_in_bytes; }
+
+    private:
```

Review comment:
Technically we can, but we will have to make a custom copy of `kernels::permute` because it does not work with tensors of different ranks. https://github.com/opencv/opencv/blob/acd16e384fe6253fb082afe33539ede6506a98e1/modules/dnn/src/cuda/permute.cu#L136-L144
**File:** modules/video/src/tracking/tracker_vit.cpp
**Change Type:** modified
**Context:** PR #25771: video: fix vittrack in the case where crop size grows until out-of-memory when the input is black

**Code Changes:**
```diff
@@ -24,15 +24,16 @@ TrackerVit::~TrackerVit()
 TrackerVit::Params::Params()
 {
     net = "vitTracker.onnx";
-    meanvalue = Scalar{0.485, 0.456, 0.406};
-    stdvalue = Scalar{0.229, 0.224, 0.225};
+    meanvalue = Scalar{0.485, 0.456, 0.406}; // normalized mean (already divided by 255)
+    stdvalue = Scalar{0.229, 0.224, 0.225};  // normalized std (already divided by 255)
 #ifdef HAVE_OPENCV_DNN
     backend = dnn::DNN_BACKEND_DEFAULT;
```

Review comment:
why not just `blobFromImageWithParams`?
**File:** modules/video/src/tracking/tracker_vit.cpp
**Change Type:** modified
**Context:** PR #25771: video: fix vittrack in the case where crop size grows until out-of-memory when the input is black

**Code Changes:**
```diff
@@ -24,15 +24,16 @@ TrackerVit::~TrackerVit()
 TrackerVit::Params::Params()
 {
     net = "vitTracker.onnx";
-    meanvalue = Scalar{0.485, 0.456, 0.406};
-    stdvalue = Scalar{0.229, 0.224, 0.225};
+    meanvalue = Scalar{0.485, 0.456, 0.406}; // normalized mean (already divided by 255)
+    stdvalue = Scalar{0.229, 0.224, 0.225};  // normalized std (already divided by 255)
 #ifdef HAVE_OPENCV_DNN
     backend = dnn::DNN_BACKEND_DEFAULT;
```

Review comment:
Good catch! I was not familiar with this API. Let me have a try with this.
**File:** platforms/android/build_sdk.py
**Change Type:** modified
**Context:** PR #25718: Android SDK build script: HWAsan support added
**Review Line:** 273

**Code Changes:**
```diff
 
+        if self.hwasan and "arm64" in abi.name:
+            hwasan_flags = "-fno-omit-frame-pointer -fsanitize=hwaddress"
+            cmake_vars['CMAKE_CXX_FLAGS_DEBUG']    = hwasan_flags
+            cmake_vars['CMAKE_C_FLAGS_DEBUG']      = hwasan_flags
+            cmake_vars['CMAKE_LINKER_FLAGS_DEBUG'] = hwasan_flags
+
         cmake_vars.update(abi.cmake_vars)
 
         if len(self.disable) > 0:
@@ -380,6 +387,7 @@ def get_ndk_dir():
```

Review comment:
Why "debug" only?
**File:** modules/imgproc/test/test_intersectconvexconvex.cpp
**Change Type:** modified
**Context:** PR #25725: Fixed result buffer overflow in intersectConvexConvex_ for non-convex input
**Review Line:** 291

**Code Changes:**
```diff
+        { 83.80044f  , 124.20074f  }, {122.125854f ,  25.182402f }, { 39.08164f  , 180.08517f  }
+    };
+    std::vector<cv::Point> intersection;
+
+    float area = cv::intersectConvexConvex(convex1, convex2, intersection, false);
+    EXPECT_TRUE(intersection.empty());
+    EXPECT_LE(area, 0.f);
+}
 
 } // namespace
 } // opencv_test
```

Review comment:
What if `intersection` was non-empty before function call, will it be empty afterwards? Maybe we could check it here too.
**File:** modules/imgproc/test/test_intersectconvexconvex.cpp
**Change Type:** modified
**Context:** PR #25725: Fixed result buffer overflow in intersectConvexConvex_ for non-convex input
**Review Line:** 291

**Code Changes:**
```diff
+        { 83.80044f  , 124.20074f  }, {122.125854f ,  25.182402f }, { 39.08164f  , 180.08517f  }
+    };
+    std::vector<cv::Point> intersection;
+
+    float area = cv::intersectConvexConvex(convex1, convex2, intersection, false);
+    EXPECT_TRUE(intersection.empty());
+    EXPECT_LE(area, 0.f);
+}
 
 } // namespace
 } // opencv_test
```

Review comment:
The function calls `cv::OutputArray::release()` for the "error" case, so it's always empty after the test call.
**File:** modules/calib3d/src/calibinit.cpp
**Change Type:** modified
**Context:** PR #25427: Make finding corner neighbor symmetrical in ChessBoardDetector::findQuadNeighbors

**Code Changes:**
```diff
@@ -221,6 +221,26 @@ class ChessBoardDetector
 
     int all_quads_count;
 
+    struct NeighborsFinder {
+        const float thresh_scale = 1.f;
+        ChessBoardDetector& detector;
+        std::vector<int> neighbors_indices;
+        std::vector<float> neighbors_dists;
+        std::vector<Point2f> all_quads_pts;
```

Review comment:
The condition should be moved outside the function. `i` is not used inside the function.
**File:** modules/calib3d/src/calibinit.cpp
**Change Type:** modified
**Context:** PR #25427: Make finding corner neighbor symmetrical in ChessBoardDetector::findQuadNeighbors

**Code Changes:**
```diff
@@ -221,6 +221,26 @@ class ChessBoardDetector
 
     int all_quads_count;
 
+    struct NeighborsFinder {
+        const float thresh_scale = 1.f;
+        ChessBoardDetector& detector;
+        std::vector<int> neighbors_indices;
+        std::vector<float> neighbors_dists;
+        std::vector<Point2f> all_quads_pts;
```

Review comment:
I suppose it should be just `ChessBoardQuad* all_quads`. `AutoBuffer` details are not needed in the function.
**File:** modules/calib3d/src/calibinit.cpp
**Change Type:** modified
**Context:** PR #25427: Make finding corner neighbor symmetrical in ChessBoardDetector::findQuadNeighbors

**Code Changes:**
```diff
@@ -221,6 +221,26 @@ class ChessBoardDetector
 
     int all_quads_count;
 
+    struct NeighborsFinder {
+        const float thresh_scale = 1.f;
+        ChessBoardDetector& detector;
+        std::vector<int> neighbors_indices;
+        std::vector<float> neighbors_dists;
+        std::vector<Point2f> all_quads_pts;
```

Review comment:
`cur_quad` is `all_quads[idx]`, I do not think that it's needed in the function parameters.
**File:** modules/calib3d/src/calibinit.cpp
**Change Type:** modified
**Context:** PR #25427: Make finding corner neighbor symmetrical in ChessBoardDetector::findQuadNeighbors

**Code Changes:**
```diff
@@ -221,6 +221,26 @@ class ChessBoardDetector
 
     int all_quads_count;
 
+    struct NeighborsFinder {
+        const float thresh_scale = 1.f;
+        ChessBoardDetector& detector;
+        std::vector<int> neighbors_indices;
+        std::vector<float> neighbors_dists;
+        std::vector<Point2f> all_quads_pts;
```

Review comment:
I propose to set default value for `thresh_scale` or even make it local constant. It's constant equal to 1.0 on caller side.
**File:** modules/calib3d/src/calibinit.cpp
**Change Type:** modified
**Context:** PR #25427: Make finding corner neighbor symmetrical in ChessBoardDetector::findQuadNeighbors

**Code Changes:**
```diff
@@ -221,6 +221,26 @@ class ChessBoardDetector
 
     int all_quads_count;
 
+    struct NeighborsFinder {
+        const float thresh_scale = 1.f;
+        ChessBoardDetector& detector;
+        std::vector<int> neighbors_indices;
+        std::vector<float> neighbors_dists;
+        std::vector<Point2f> all_quads_pts;
```

Review comment:
`closest_quad= all_quads[closest_quad_idx]`. No need to pass it with parameters.
**File:** modules/calib3d/src/calibinit.cpp
**Change Type:** modified
**Context:** PR #25427: Make finding corner neighbor symmetrical in ChessBoardDetector::findQuadNeighbors

**Code Changes:**
```diff
@@ -221,6 +221,26 @@ class ChessBoardDetector
 
     int all_quads_count;
 
+    struct NeighborsFinder {
+        const float thresh_scale = 1.f;
+        ChessBoardDetector& detector;
+        std::vector<int> neighbors_indices;
+        std::vector<float> neighbors_dists;
+        std::vector<Point2f> all_quads_pts;
```

Review comment:
The values are not used outside the function. I propose to make it local.
**File:** modules/calib3d/src/calibinit.cpp
**Change Type:** modified
**Context:** PR #25427: Make finding corner neighbor symmetrical in ChessBoardDetector::findQuadNeighbors

**Code Changes:**
```diff
@@ -221,6 +221,26 @@ class ChessBoardDetector
 
     int all_quads_count;
 
+    struct NeighborsFinder {
+        const float thresh_scale = 1.f;
+        ChessBoardDetector& detector;
+        std::vector<int> neighbors_indices;
+        std::vector<float> neighbors_dists;
+        std::vector<Point2f> all_quads_pts;
```

Review comment:
It is also used outside function ``` float radius = cur_quad.edge_len * thresh_scale + 1; ``` So, do you propose to set it twice with same value?
**File:** modules/calib3d/src/calibinit.cpp
**Change Type:** modified
**Context:** PR #25427: Make finding corner neighbor symmetrical in ChessBoardDetector::findQuadNeighbors

**Code Changes:**
```diff
@@ -221,6 +221,26 @@ class ChessBoardDetector
 
     int all_quads_count;
 
+    struct NeighborsFinder {
+        const float thresh_scale = 1.f;
+        ChessBoardDetector& detector;
+        std::vector<int> neighbors_indices;
+        std::vector<float> neighbors_dists;
+        std::vector<Point2f> all_quads_pts;
```

Review comment:
Their lengths are equal to `all_corners_count` which can be quite large. So, it's better to avoid such frequent allocations on every function call
**File:** modules/calib3d/src/calibinit.cpp
**Change Type:** modified
**Context:** PR #25427: Make finding corner neighbor symmetrical in ChessBoardDetector::findQuadNeighbors

**Code Changes:**
```diff
@@ -221,6 +221,26 @@ class ChessBoardDetector
 
     int all_quads_count;
 
+    struct NeighborsFinder {
+        const float thresh_scale = 1.f;
+        ChessBoardDetector& detector;
+        std::vector<int> neighbors_indices;
+        std::vector<float> neighbors_dists;
+        std::vector<Point2f> all_quads_pts;
```

Review comment:
You can get rid of smart pointer, convert `p_all_quads_pts_index` to regular field and use initializer list for it.
**File:** modules/calib3d/src/calibinit.cpp
**Change Type:** modified
**Context:** PR #25427: Make finding corner neighbor symmetrical in ChessBoardDetector::findQuadNeighbors

**Code Changes:**
```diff
@@ -221,6 +221,26 @@ class ChessBoardDetector
 
     int all_quads_count;
 
+    struct NeighborsFinder {
+        const float thresh_scale = 1.f;
+        ChessBoardDetector& detector;
+        std::vector<int> neighbors_indices;
+        std::vector<float> neighbors_dists;
+        std::vector<Point2f> all_quads_pts;
```

Review comment:
`const std::vector<float> query ={ pt.x, pt.y };`
**File:** modules/imgcodecs/src/loadsave.cpp
**Change Type:** modified
**Context:** PR #25703: imgproc: fixed imread with output image argument - Resolves #25694 Replaces #25695 * Moved `OutputArray` down the call stack * Allow output...
**Review Line:** 460

**Code Changes:**
```diff
+imread_( const String& filename, int flags, OutputArray mat )
 {
     /// Search for the relevant decoder to handle the imagery
     ImageDecoder decoder;
@@ -444,18 +460,7 @@ imread_( const String& filename, int flags, Mat& mat )
     Size size = validateInputImageSize(Size(decoder->width(), decoder->height()));
 
     // grab the decoded type
-    int type = decoder->type();
-    if( (flags & IMREAD_LOAD_GDAL) != IMREAD_LOAD_GDAL && flags != IMREAD_UNCHANGED )
-    {
```

Review comment:
this change seems wrong to me. we should keep ``` if (mat.empty()) { mat.create( size.height, size.width, type ); } else { CV_CheckEQ(size, mat.size(), ""); CV_CheckTypeEQ(type, mat.type(), ""); CV_Assert(mat.isContinuous()); } ```