nareshmlx/opencv-pr huggingface dataset:
**File:** 3rdparty/fastcv/src/fastcv_hal_imgproc.cpp
**Change Type:** modified
**Context:** PR #27182: Parallel_for in box Filter and support for 32f box filter in Fastcv hal

**Code Changes:**
```diff
@@ -314,6 +314,69 @@ int fastcv_hal_sobel(
     CV_HAL_RETURN(status, hal_sobel);
 }
 
+class FcvBoxLoop_Invoker : public cv::ParallelLoopBody
+{
+public:
+
+    FcvBoxLoop_Invoker(cv::Mat src_, int width_, int height_, cv::Mat dst_, int bdr_, int knl_, int normalize_, int stripeHeight_, int nStripes_, int depth_) :
+        cv::ParallelLoopBody(), src(src_), width(width_), height(height_), dst(dst_), bdr(bdr_), knl(knl_), normalize(normalize_), stripeHeight(stripeHeight_), nStripes(nStripes_), depth(depth_)
```

Review comment:
threads are 8. It's not true: - Android build uses 2 threads by default. It's done to prevent overheating, but may be changed in future. - Linux builds use all available cores. - parallel_for_ serializes nested parallel_for_ calls. So you can easily get 1 here.
**File:** 3rdparty/fastcv/src/fastcv_hal_imgproc.cpp
**Change Type:** modified
**Context:** PR #27182: Parallel_for in box Filter and support for 32f box filter in Fastcv hal

**Code Changes:**
```diff
@@ -314,6 +314,69 @@ int fastcv_hal_sobel(
     CV_HAL_RETURN(status, hal_sobel);
 }
 
+class FcvBoxLoop_Invoker : public cv::ParallelLoopBody
+{
+public:
+
+    FcvBoxLoop_Invoker(cv::Mat src_, int width_, int height_, cv::Mat dst_, int bdr_, int knl_, int normalize_, int stripeHeight_, int nStripes_, int depth_) :
+        cv::ParallelLoopBody(), src(src_), width(width_), height(height_), dst(dst_), bdr(bdr_), knl(knl_), normalize(normalize_), stripeHeight(stripeHeight_), nStripes(nStripes_), depth(depth_)
```

Review comment:
We usually set granularity to some reasonable size for single thread. OpenCV uses dynamic scheduling, so all other steps are done automatically.
**File:** modules/core/include/opencv2/core/mat.hpp
**Change Type:** modified
**Context:** PR #27265: 5.x merge 4.x - OpenCV Contrib: https://github.com/opencv/opencv_contrib/pull/3928 OpenCV Extra: https://github.com/opencv/opencv_extra/pul...

**Code Changes:**
```diff
@@ -494,6 +494,7 @@ class CV_EXPORTS _OutputArray : public _InputArray
     void clear() const;
     void setTo(const _InputArray& value, const _InputArray & mask = _InputArray()) const;
     void setZero() const;
+    Mat reinterpret( int type ) const;
 
     void assign(const UMat& u) const;
     void assign(const Mat& m) const;
@@ -1540,6 +1541,15 @@ class CV_EXPORTS Mat
      */
```

Review comment:
Looks like this change is wrong.
**File:** modules/highgui/src/window_QT.cpp
**Change Type:** modified
**Context:** PR #27265: 5.x merge 4.x - OpenCV Contrib: https://github.com/opencv/opencv_contrib/pull/3928 OpenCV Extra: https://github.com/opencv/opencv_extra/pul...
**Review Line:** 1668

**Code Changes:**
```diff
-    if (guiMainThread)
-        guiMainThread->isLastWindow();
-}
-
-
 void CvWindow::setMouseCallBack(CvMouseCallback callback, void* param)
 {
     myView->setMouseCallBack(callback, param);
@@ -2185,6 +2178,15 @@ void CvWindow::keyPressEvent(QKeyEvent *evnt)
 }
 
```

Review comment:
Destructor has not been removed in header file (#27170).
**File:** hal/riscv-rvv/hal_rvv_1p0/norm.hpp
**Change Type:** renamed
**Context:** PR #27265: 5.x merge 4.x - OpenCV Contrib: https://github.com/opencv/opencv_contrib/pull/3928 OpenCV Extra: https://github.com/opencv/opencv_extra/pul...
**Review Line:** 1

**Code Changes:**
```diff
@@ -1016,7 +1016,7 @@ inline int norm(const uchar* src, size_t src_step, const uchar* mask, size_t mas
     CV_Assert(elem_size_tab[depth]);
 
     bool src_continuous = (src_step == width * elem_size_tab[depth] * cn || (src_step != width * elem_size_tab[depth] * cn && height == 1));
-    bool mask_continuous = (mask_step == width);
+    bool mask_continuous = (mask_step == static_cast<size_t>(width));
     size_t nplanes = 1;
     size_t size = width * height;
     if ((mask && (!src_continuous || !mask_continuous)) || !src_continuous) {
```

Review comment:
Changes in this file needs to be reverted except line 1014.
**File:** hal/riscv-rvv/hal_rvv_1p0/norm_diff.hpp
**Change Type:** renamed
**Context:** PR #27265: 5.x merge 4.x - OpenCV Contrib: https://github.com/opencv/opencv_contrib/pull/3928 OpenCV Extra: https://github.com/opencv/opencv_extra/pul...
**Review Line:** 1

**Code Changes:**
```diff
@@ -1128,7 +1128,7 @@ inline int normDiff(const uchar* src1, size_t src1_step, const uchar* src2, size
 
     bool src_continuous = (src1_step == width * elem_size_tab[depth] * cn || (src1_step != width * elem_size_tab[depth] * cn && height == 1));
     src_continuous &= (src2_step == width * elem_size_tab[depth] * cn || (src2_step != width * elem_size_tab[depth] * cn && height == 1));
-    bool mask_continuous = (mask_step == width);
+    bool mask_continuous = (mask_step == static_cast<size_t>(width));
     size_t nplanes = 1;
     size_t size = width * height;
     if ((mask && (!src_continuous || !mask_continuous)) || !src_continuous) {
```

Review comment:
Changes in this file needs to be reverted except line 1128.
**File:** 3rdparty/ipphal/CMakeLists.txt
**Change Type:** modified
**Context:** PR #27194: Migrated IPP impl for flip and transpose to HAL
**Review Line:** 27

**Code Changes:**
```diff
 if(HAVE_IPP_ICV)
   target_compile_definitions(ipphal PRIVATE HAVE_IPP_ICV)
 endif()
 
+if(HAVE_IPP_IW)
+  target_compile_definitions(ipphal PRIVATE HAVE_IPP_IW)
+endif()
+
 target_include_directories(ipphal PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/include")
+ocv_warnings_disable(CMAKE_CXX_FLAGS -Wno-suggest-override)
 
```

Review comment:
PRIVATE? This macro is used in "interface" headers.
**File:** 3rdparty/ipphal/CMakeLists.txt
**Change Type:** modified
**Context:** PR #27194: Migrated IPP impl for flip and transpose to HAL
**Review Line:** 27

**Code Changes:**
```diff
 if(HAVE_IPP_ICV)
   target_compile_definitions(ipphal PRIVATE HAVE_IPP_ICV)
 endif()
 
+if(HAVE_IPP_IW)
+  target_compile_definitions(ipphal PRIVATE HAVE_IPP_IW)
+endif()
+
 target_include_directories(ipphal PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/include")
+ocv_warnings_disable(CMAKE_CXX_FLAGS -Wno-suggest-override)
 
```

Review comment:
Good point. Fixed.
**File:** 3rdparty/ipphal/CMakeLists.txt
**Change Type:** modified
**Context:** PR #27194: Migrated IPP impl for flip and transpose to HAL
**Review Line:** 27

**Code Changes:**
```diff
 if(HAVE_IPP_ICV)
   target_compile_definitions(ipphal PRIVATE HAVE_IPP_ICV)
 endif()
 
+if(HAVE_IPP_IW)
+  target_compile_definitions(ipphal PRIVATE HAVE_IPP_IW)
+endif()
+
 target_include_directories(ipphal PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/include")
+ocv_warnings_disable(CMAKE_CXX_FLAGS -Wno-suggest-override)
 
```

Review comment:
Looks like I cannot make it public for now. We get redefinition issue. The macros are defined by both HAL and IPP core. I made it private for now to exclude the redefinition issue and added note to CMake.
**File:** samples/dnn/yolo_detector.cpp
**Change Type:** modified
**Context:** PR #25794: Add sample support of `YOLOv9` and `YOLOv10` in OpenCV
**Review Line:** 143

**Code Changes:**
```diff
+        outs[0] = outs[0].reshape(0, std::vector<int>{1, 8400, nc + 4});
     }
 
+    // assert if last dim is 85 or 84
+    CV_CheckEQ(outs[0].dims, 3, "Invalid output shape. The shape should be [1, #anchors, 85 or 84]");
+    CV_CheckEQ((outs[0].size[2] == nc + 5 || outs[0].size[2] == 80 + 4), true, "Invalid output shape: ");
+
     for (auto preds : outs)
     {
         preds = preds.reshape(1, preds.size[1]); // [1, 8400, 85] -> [8400, 85]
         for (int i = 0; i < preds.rows; ++i)
```

Review comment:
Check also that `outs[0].dims == 2` before.
**File:** samples/dnn/yolo_detector.cpp
**Change Type:** modified
**Context:** PR #25794: Add sample support of `YOLOv9` and `YOLOv10` in OpenCV
**Review Line:** 138

**Code Changes:**
```diff
@@ -131,25 +135,30 @@ void yoloPostProcessing(
         // remove the second element
         outs.pop_back();
         // unsqueeze the first dimension
-        outs[0] = outs[0].reshape(0, std::vector<int>{1, 8400, 84});
+        outs[0] = outs[0].reshape(0, std::vector<int>{1, 8400, nc + 4});
     }
 
+    // assert if last dim is 85 or 84
+    CV_CheckEQ(outs[0].dims, 3, "Invalid output shape. The shape should be [1, #anchors, 85 or 84]");
+    CV_CheckEQ((outs[0].size[2] == nc + 5 || outs[0].size[2] == 80 + 4), true, "Invalid output shape: ");
```

Review comment:
8400 is also depends on number of classes? So should it be `(nc + 4) * 100` or not?
**File:** samples/dnn/yolo_detector.cpp
**Change Type:** modified
**Context:** PR #25794: Add sample support of `YOLOv9` and `YOLOv10` in OpenCV
**Review Line:** 138

**Code Changes:**
```diff
@@ -131,25 +135,30 @@ void yoloPostProcessing(
         // remove the second element
         outs.pop_back();
         // unsqueeze the first dimension
-        outs[0] = outs[0].reshape(0, std::vector<int>{1, 8400, 84});
+        outs[0] = outs[0].reshape(0, std::vector<int>{1, 8400, nc + 4});
     }
 
+    // assert if last dim is 85 or 84
+    CV_CheckEQ(outs[0].dims, 3, "Invalid output shape. The shape should be [1, #anchors, 85 or 84]");
+    CV_CheckEQ((outs[0].size[2] == nc + 5 || outs[0].size[2] == 80 + 4), true, "Invalid output shape: ");
```

Review comment:
`nc` seems redundant as it can be computed from original shape: ```cpp int nc = outs[0].total() / 8400 - 4; ``` or, if 8400 is also depends on `nc`: ```cpp int nc = sqrt(outs[0].total() / 100) - 4; ```
**File:** samples/dnn/yolo_detector.cpp
**Change Type:** modified
**Context:** PR #25794: Add sample support of `YOLOv9` and `YOLOv10` in OpenCV
**Review Line:** 138

**Code Changes:**
```diff
@@ -131,25 +135,30 @@ void yoloPostProcessing(
         // remove the second element
         outs.pop_back();
         // unsqueeze the first dimension
-        outs[0] = outs[0].reshape(0, std::vector<int>{1, 8400, 84});
+        outs[0] = outs[0].reshape(0, std::vector<int>{1, 8400, nc + 4});
     }
 
+    // assert if last dim is 85 or 84
+    CV_CheckEQ(outs[0].dims, 3, "Invalid output shape. The shape should be [1, #anchors, 85 or 84]");
+    CV_CheckEQ((outs[0].size[2] == nc + 5 || outs[0].size[2] == 80 + 4), true, "Invalid output shape: ");
```

Review comment:
> 8400 is also depends on number of classes? So should it be `(nc + 4) * 100` or not? 8400 depends on number of anchors only and has nothing to do with `nc`. `nc` depends on which dataset detector what trained. On `COCO` dataset `nc = 80`. For other datasets it might be different.
**File:** samples/dnn/yolo_detector.cpp
**Change Type:** modified
**Context:** PR #25794: Add sample support of `YOLOv9` and `YOLOv10` in OpenCV
**Review Line:** 138

**Code Changes:**
```diff
@@ -131,25 +135,30 @@ void yoloPostProcessing(
         // remove the second element
         outs.pop_back();
         // unsqueeze the first dimension
-        outs[0] = outs[0].reshape(0, std::vector<int>{1, 8400, 84});
+        outs[0] = outs[0].reshape(0, std::vector<int>{1, 8400, nc + 4});
     }
 
+    // assert if last dim is 85 or 84
+    CV_CheckEQ(outs[0].dims, 3, "Invalid output shape. The shape should be [1, #anchors, 85 or 84]");
+    CV_CheckEQ((outs[0].size[2] == nc + 5 || outs[0].size[2] == 80 + 4), true, "Invalid output shape: ");
```

Review comment:
I strongly believe that it should stay as a papermeter. As this is a parameter during traning. Computing it via `outs[0]` is kind of hack.
**File:** samples/dnn/yolo_detector.cpp
**Change Type:** modified
**Context:** PR #25794: Add sample support of `YOLOv9` and `YOLOv10` in OpenCV
**Review Line:** 138

**Code Changes:**
```diff
@@ -131,25 +135,30 @@ void yoloPostProcessing(
         // remove the second element
         outs.pop_back();
         // unsqueeze the first dimension
-        outs[0] = outs[0].reshape(0, std::vector<int>{1, 8400, 84});
+        outs[0] = outs[0].reshape(0, std::vector<int>{1, 8400, nc + 4});
     }
 
+    // assert if last dim is 85 or 84
+    CV_CheckEQ(outs[0].dims, 3, "Invalid output shape. The shape should be [1, #anchors, 85 or 84]");
+    CV_CheckEQ((outs[0].size[2] == nc + 5 || outs[0].size[2] == 80 + 4), true, "Invalid output shape: ");
```

Review comment:
The corner case is a background class. Some training utils may include this as a separate class - some not. So even if you trained model for 80 real classes, there is a variation nc=80 nc=81 and it may confuse even more.
**File:** samples/dnn/yolo_detector.cpp
**Change Type:** modified
**Context:** PR #25794: Add sample support of `YOLOv9` and `YOLOv10` in OpenCV
**Review Line:** 138

**Code Changes:**
```diff
@@ -131,25 +135,30 @@ void yoloPostProcessing(
         // remove the second element
         outs.pop_back();
         // unsqueeze the first dimension
-        outs[0] = outs[0].reshape(0, std::vector<int>{1, 8400, 84});
+        outs[0] = outs[0].reshape(0, std::vector<int>{1, 8400, nc + 4});
     }
 
+    // assert if last dim is 85 or 84
+    CV_CheckEQ(outs[0].dims, 3, "Invalid output shape. The shape should be [1, #anchors, 85 or 84]");
+    CV_CheckEQ((outs[0].size[2] == nc + 5 || outs[0].size[2] == 80 + 4), true, "Invalid output shape: ");
```

Review comment:
Computing `nc` using number of anchor points is not good since number of anchors depens on the image size. Inference can happen on different image resolutons, depending on use case.
**File:** 3rdparty/fastcv/src/fastcv_hal_imgproc.cpp
**Change Type:** modified
**Context:** PR #27036: Fix gaussianBlur5x5 performance regression in FastCV HAL
**Review Line:** 562

**Code Changes:**
```diff
+            cv::Mat dst = cv::Mat(height, width, CV_8UC1, (void *)dst_data, dst_step);
+            cv::Mat src_tmp = cv::Mat(height + ksize - 1, width + ksize - 1, CV_8UC1);
+            cv::Mat dst_tmp = cv::Mat(height + ksize - 1, width + ksize - 1, CV_8UC1);
+            cv::copyMakeBorder(src, src_tmp, ksize / 2, ksize / 2, ksize / 2, ksize / 2, border_type);
+            cv::parallel_for_(cv::Range(0, height), FcvGaussianBlurLoop_Invoker(src_tmp, dst_tmp, ksize, border_type, 0), nStripes);
+            dst_tmp(cv::Rect(ksize / 2, ksize / 2, width, height)).copyTo(dst);
             break;
         }
         default:
```

Review comment:
The patch adds 2 memory copies: - src + bodrder - dst_tmp -> dst. It should significantly affect performance.
**File:** 3rdparty/fastcv/src/fastcv_hal_imgproc.cpp
**Change Type:** modified
**Context:** PR #27036: Fix gaussianBlur5x5 performance regression in FastCV HAL
**Review Line:** 562

**Code Changes:**
```diff
+            cv::Mat dst = cv::Mat(height, width, CV_8UC1, (void *)dst_data, dst_step);
+            cv::Mat src_tmp = cv::Mat(height + ksize - 1, width + ksize - 1, CV_8UC1);
+            cv::Mat dst_tmp = cv::Mat(height + ksize - 1, width + ksize - 1, CV_8UC1);
+            cv::copyMakeBorder(src, src_tmp, ksize / 2, ksize / 2, ksize / 2, ksize / 2, border_type);
+            cv::parallel_for_(cv::Range(0, height), FcvGaussianBlurLoop_Invoker(src_tmp, dst_tmp, ksize, border_type, 0), nStripes);
+            dst_tmp(cv::Rect(ksize / 2, ksize / 2, width, height)).copyTo(dst);
             break;
         }
         default:
```

Review comment:
Checked perf numbers. Looks good.
**File:** cmake/OpenCVDetectCXXCompiler.cmake
**Change Type:** modified
**Context:** PR #27107: build: Check supported C++ standard features and user setting

**Code Changes:**
```diff
@@ -207,30 +207,35 @@ if(CMAKE_VERSION VERSION_LESS "3.1")
   endforeach()
 endif()
 
+# See https://github.com/opencv/opencv/issues/27105
+# - CMAKE_COMPILE_FEATURES is used to detect what features are available by the compiler.
+# - CMAKE_CXX_STANDARD is used to detect what features are available in this configuration.
 if(NOT OPENCV_SKIP_CMAKE_CXX_STANDARD)
+  if(DEFINED CMAKE_CXX_STANDARD AND ((CMAKE_CXX_STANDARD EQUAL 98) OR (CMAKE_CXX_STANDARD LESS 11)))
+    message(FATAL_ERROR "OpenCV 4.x requires C++11, but your configuration does not enable(CMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD}).")
```

Review comment:
Could we eliminate handling of C++98 in our scripts? (which we don't need actually) Using checks for C++11 and C++17 is more relevant.
**File:** modules/calib3d/test/test_solvepnp_ransac.cpp
**Change Type:** modified
**Context:** PR #27185: Specify DLS and UPnP mappings to EPnP in all places for solvePnP* tests

**Code Changes:**
```diff
@@ -182,9 +182,9 @@ static std::string printMethod(int method)
     case 2:
         return "SOLVEPNP_P3P";
     case 3:
-        return "SOLVEPNP_DLS (remaped to SOLVEPNP_EPNP)";
+        return "SOLVEPNP_DLS (remapped to SOLVEPNP_EPNP)";
     case 4:
-        return "SOLVEPNP_UPNP (remaped to SOLVEPNP_EPNP)";
+        return "SOLVEPNP_UPNP (remapped to SOLVEPNP_EPNP)";
     case 5:
```

Review comment:
Please do not touch not related code or just removed the dead part.
**File:** modules/calib3d/test/test_solvepnp_ransac.cpp
**Change Type:** modified
**Context:** PR #27185: Specify DLS and UPnP mappings to EPnP in all places for solvePnP* tests

**Code Changes:**
```diff
@@ -182,9 +182,9 @@ static std::string printMethod(int method)
     case 2:
         return "SOLVEPNP_P3P";
     case 3:
-        return "SOLVEPNP_DLS (remaped to SOLVEPNP_EPNP)";
+        return "SOLVEPNP_DLS (remapped to SOLVEPNP_EPNP)";
     case 4:
-        return "SOLVEPNP_UPNP (remaped to SOLVEPNP_EPNP)";
+        return "SOLVEPNP_UPNP (remapped to SOLVEPNP_EPNP)";
     case 5:
```

Review comment:
The same here and above.
**File:** modules/core/test/test_mat.cpp
**Change Type:** modified
**Context:** PR #25394: Added reinterpret() method to Mat to convert meta-data without actual data conversion
**Review Line:** 1340

**Code Changes:**
```diff
+    cv::OutputArray C(A);
+    cv::Mat B = C.reinterpret(CV_32FC1);
+
+    EXPECT_EQ(A.data, B.data);
+    EXPECT_EQ(B.type(), CV_32FC1);
+}
+
 TEST(Core_Mat, push_back)
 {
     Mat a = (Mat_<float>(1,2) << 3.4884074f, 1.4159607f);
```

Review comment:
Please also check the following case with existing reference ```cpp cv::Mat A(8, 16, CV_8UC3, cv::Scalar(1, 2, 3)); cv::Mat B = A; A.convertTo(A, CV_8SC3); ```
**File:** modules/core/test/test_mat.cpp
**Change Type:** modified
**Context:** PR #25394: Added reinterpret() method to Mat to convert meta-data without actual data conversion
**Review Line:** 1340

**Code Changes:**
```diff
+    cv::OutputArray C(A);
+    cv::Mat B = C.reinterpret(CV_32FC1);
+
+    EXPECT_EQ(A.data, B.data);
+    EXPECT_EQ(B.type(), CV_32FC1);
+}
+
 TEST(Core_Mat, push_back)
 {
     Mat a = (Mat_<float>(1,2) << 3.4884074f, 1.4159607f);
```

Review comment:
I have got your idea, in this case, A still need to allocate new memory.
**File:** modules/core/test/test_mat.cpp
**Change Type:** modified
**Context:** PR #25394: Added reinterpret() method to Mat to convert meta-data without actual data conversion
**Review Line:** 1340

**Code Changes:**
```diff
+    cv::OutputArray C(A);
+    cv::Mat B = C.reinterpret(CV_32FC1);
+
+    EXPECT_EQ(A.data, B.data);
+    EXPECT_EQ(B.type(), CV_32FC1);
+}
+
 TEST(Core_Mat, push_back)
 {
     Mat a = (Mat_<float>(1,2) << 3.4884074f, 1.4159607f);
```

Review comment:
Agree. So let's add a test case too.
**File:** modules/core/test/test_mat.cpp
**Change Type:** modified
**Context:** PR #25394: Added reinterpret() method to Mat to convert meta-data without actual data conversion
**Review Line:** 1340

**Code Changes:**
```diff
+    cv::OutputArray C(A);
+    cv::Mat B = C.reinterpret(CV_32FC1);
+
+    EXPECT_EQ(A.data, B.data);
+    EXPECT_EQ(B.type(), CV_32FC1);
+}
+
 TEST(Core_Mat, push_back)
 {
     Mat a = (Mat_<float>(1,2) << 3.4884074f, 1.4159607f);
```

Review comment:
OK, I added a check for the reference count in the convertTo function.
**File:** modules/core/test/test_mat.cpp
**Change Type:** modified
**Context:** PR #25394: Added reinterpret() method to Mat to convert meta-data without actual data conversion
**Review Line:** 1340

**Code Changes:**
```diff
+    cv::OutputArray C(A);
+    cv::Mat B = C.reinterpret(CV_32FC1);
+
+    EXPECT_EQ(A.data, B.data);
+    EXPECT_EQ(B.type(), CV_32FC1);
+}
+
 TEST(Core_Mat, push_back)
 {
     Mat a = (Mat_<float>(1,2) << 3.4884074f, 1.4159607f);
```

Review comment:
I think just better to highlight final types and data ptrs: ``` A.type == new_type B.type == old_type A.data_ptr != B.data_ptr ```
**File:** modules/core/test/test_mat.cpp
**Change Type:** modified
**Context:** PR #25394: Added reinterpret() method to Mat to convert meta-data without actual data conversion

**Code Changes:**
```diff
@@ -1303,6 +1303,42 @@ TEST(Core_Mat, reshape_ndims_4)
     }
 }
 
+TEST(Core_Mat, reinterpret_Mat_8UC3_8SC3)
+{
+    cv::Mat A(8, 16, CV_8UC3, cv::Scalar(1, 2, 3));
+    cv::Mat B = A.reinterpret(CV_8SC3);
+
+    EXPECT_EQ(A.data, B.data);
```

Review comment:
`int cn = A.channels();`
**File:** modules/core/test/test_mat.cpp
**Change Type:** modified
**Context:** PR #25394: Added reinterpret() method to Mat to convert meta-data without actual data conversion

**Code Changes:**
```diff
@@ -1303,6 +1303,42 @@ TEST(Core_Mat, reshape_ndims_4)
     }
 }
 
+TEST(Core_Mat, reinterpret_Mat_8UC3_8SC3)
+{
+    cv::Mat A(8, 16, CV_8UC3, cv::Scalar(1, 2, 3));
+    cv::Mat B = A.reinterpret(CV_8SC3);
+
+    EXPECT_EQ(A.data, B.data);
```

Review comment:
Split test cases to different with proper naming: ``` TEST(Core_Mat, convertTo_inplace_8UC3_8SC3) ``` ``` TEST(Core_Mat, convertTo_inplace_8UC3_32FC3) ```
**File:** modules/core/test/test_mat.cpp
**Change Type:** modified
**Context:** PR #25394: Added reinterpret() method to Mat to convert meta-data without actual data conversion
**Review Line:** 1341

**Code Changes:**
```diff
+    cv::Mat B = C.reinterpret(CV_32FC1);
+
+    EXPECT_EQ(A.data, B.data);
+    EXPECT_EQ(B.type(), CV_32FC1);
+}
+
 TEST(Core_Mat, push_back)
 {
     Mat a = (Mat_<float>(1,2) << 3.4884074f, 1.4159607f);
```

Review comment:
Can you please also add a test for `CV_8UC4->CV_32FC1` inplace conversion expecting that it will keep memory?
**File:** modules/core/test/test_mat.cpp
**Change Type:** modified
**Context:** PR #25394: Added reinterpret() method to Mat to convert meta-data without actual data conversion
**Review Line:** 1341

**Code Changes:**
```diff
+    cv::Mat B = C.reinterpret(CV_32FC1);
+
+    EXPECT_EQ(A.data, B.data);
+    EXPECT_EQ(B.type(), CV_32FC1);
+}
+
 TEST(Core_Mat, push_back)
 {
     Mat a = (Mat_<float>(1,2) << 3.4884074f, 1.4159607f);
```

Review comment:
Yes, I can. But convertTo only supports cases where the number of channels in the (src) and (dst) are the same. Currently, I'm unable to think of any function supporting the conversion from CV_8UC4 to CV_32FC1.
**File:** modules/core/test/test_mat.cpp
**Change Type:** modified
**Context:** PR #25394: Added reinterpret() method to Mat to convert meta-data without actual data conversion

**Code Changes:**
```diff
@@ -1303,6 +1303,42 @@ TEST(Core_Mat, reshape_ndims_4)
     }
 }
 
+TEST(Core_Mat, reinterpret_Mat_8UC3_8SC3)
+{
+    cv::Mat A(8, 16, CV_8UC3, cv::Scalar(1, 2, 3));
+    cv::Mat B = A.reinterpret(CV_8SC3);
+
+    EXPECT_EQ(A.data, B.data);
```

Review comment:
Add a check for resulting values: ```cpp EXPECT_EQ(0, countNonZero(A != cv::Scalar(1, 2, 3))); ```
**File:** modules/core/test/test_mat.cpp
**Change Type:** modified
**Context:** PR #25394: Added reinterpret() method to Mat to convert meta-data without actual data conversion

**Code Changes:**
```diff
@@ -1303,6 +1303,42 @@ TEST(Core_Mat, reshape_ndims_4)
     }
 }
 
+TEST(Core_Mat, reinterpret_Mat_8UC3_8SC3)
+{
+    cv::Mat A(8, 16, CV_8UC3, cv::Scalar(1, 2, 3));
+    cv::Mat B = A.reinterpret(CV_8SC3);
+
+    EXPECT_EQ(A.data, B.data);
```

Review comment:
I had add a function to replace countNonZero, because countNonZero only support cn == 1.