nareshmlx/opencv-pr huggingface dataset:
**File:** modules/3d/src/rgbd/odometry_functions.cpp
**Change Type:** modified
**Context:** PR #22598: OdometryFrame made RAII and UMat-based

**Code Changes:**
```diff
@@ -14,639 +14,477 @@
 namespace cv
 {
 
-static const int normalWinSize = 5;
-static const RgbdNormals::RgbdNormalsMethod normalMethod = RgbdNormals::RGBD_NORMALS_METHOD_FALS;
-
-enum
+static void randomSubsetOfMask(InputOutputArray _mask, float part)
 {
```

Review comment:
There is no need in TMat here. `validMask`, `levelDepth` and other masks may be just UMat.
**File:** modules/3d/include/opencv2/3d/odometry_frame.hpp
**Change Type:** modified
**Context:** PR #22598: OdometryFrame made RAII and UMat-based
**Review Line:** 61

**Code Changes:**
```diff
@@ -9,62 +9,45 @@
 
 namespace cv
 {
-/** Indicates what pyramid is to access using get/setPyramid... methods:
-* @param PYR_IMAGE The pyramid of RGB images
-* @param PYR_DEPTH The pyramid of depth images
-* @param PYR_MASK  The pyramid of masks
-* @param PYR_CLOUD The pyramid of point clouds, produced from the pyramid of depths
-* @param PYR_DIX   The pyramid of dI/dx derivative images
-* @param PYR_DIY   The pyramid of dI/dy derivative images
-* @param PYR_TEXMASK The pyramid of textured masks
-* @param PYR_NORM  The pyramid of normals
-* @param PYR_NORMMASK The pyramid of normals masks
+/** Indicates what pyramid is to access using getPyramidAt() method:
```

Review comment:
The implementations are still there.
**File:** modules/3d/src/rgbd/odometry_functions.hpp
**Change Type:** modified
**Context:** PR #22598: OdometryFrame made RAII and UMat-based
**Review Line:** 63

**Code Changes:**
```diff
@@ -30,37 +30,6 @@ static inline int getTransformDim(OdometryTransformType transformType)
     }
 }
 
-static inline
-void checkImage(InputArray image)
-{
-    if (image.empty())
-        CV_Error(Error::StsBadSize, "Image is empty.");
-    if (image.type() != CV_8UC1)
-        CV_Error(Error::StsBadSize, "Image type has to be CV_8UC1.");
-}
-
-static inline
-void checkDepth(InputArray depth, const Size& imageSize)
```

Review comment:
`checkNormals` function is not used too.
**File:** modules/ts/misc/chart.py
**Change Type:** modified
**Context:** PR #22651: ts: basic documentation for utility scripts - * Added documentation strings for all scripts in `modules/ts/misc` * Changed executable bit f...

**Code Changes:**
```diff
@@ -1,4 +1,46 @@
 #!/usr/bin/env python
+""" OpenCV performance test results charts generator.
+
+This script formats results of a performance test as a table or a series of tables according to test
+parameters.
+
+### Description
+
+Performance data is stored in the GTest log file created by performance tests. Default name is
```

Review comment:
I propose to wrap the long phrases to make it readable from console.
**File:** modules/ts/misc/perf_tests_timing.py
**Change Type:** modified
**Context:** PR #22651: ts: basic documentation for utility scripts - * Added documentation strings for all scripts in `modules/ts/misc` * Changed executable bit f...
**Review Line:** 8

**Code Changes:**
```diff
+
+Performance data is stored in the GTest log file created by performance tests. Default name is
+`test_details.xml`. It can be changed with the `--gtest_output=xml:<location>/<filename>.xml` test
+option. See https://github.com/opencv/opencv/wiki/HowToUsePerfTests for more details.
+
+This script uses XML test log to produce basic runtime statistics in a text or HTML table.
+
+### Example:
+
+./perf_tests_timing.py  opencv_perf_core.xml
+
```

Review comment:
I propose to add some words on `--gtest_ouput` usage to highlight the source of xml and statistics.
**File:** modules/ts/misc/report.py
**Change Type:** modified
**Context:** PR #22651: ts: basic documentation for utility scripts - * Added documentation strings for all scripts in `modules/ts/misc` * Changed executable bit f...

**Code Changes:**
```diff
@@ -1,4 +1,38 @@
 #!/usr/bin/env python
+""" Print performance test run statistics.
+
+Performance data is stored in the GTest log file created by performance tests. Default name is
+`test_details.xml`. It can be changed with the `--gtest_output=xml:<location>/<filename>.xml` test
+option. See https://github.com/opencv/opencv/wiki/HowToUsePerfTests for more details.
+
+This script produces configurable performance report tables in text and HTML formats. It allows to
+filter test cases by name and parameter string and select specific performance metrics columns. One
```

Review comment:
The same on `--gtest_output`.
**File:** modules/ts/misc/summary.py
**Change Type:** modified
**Context:** PR #22651: ts: basic documentation for utility scripts - * Added documentation strings for all scripts in `modules/ts/misc` * Changed executable bit f...

**Code Changes:**
```diff
@@ -1,4 +1,36 @@
 #!/usr/bin/env python
+""" Format performance test results and compare metrics between test runs
+
+Performance data is stored in the GTest log file created by performance tests. Default name is
+`test_details.xml`. It can be changed with the `--gtest_output=xml:<location>/<filename>.xml` test
+option. See https://github.com/opencv/opencv/wiki/HowToUsePerfTests for more details.
+
+This script allows to compare performance data collected during separate test runs and present it in
+a text, Markdown or HTML table.
```

Review comment:
Need some reference to OpenCV perf tests and `--gtest_output` option.
**File:** modules/ts/misc/trace_profiler.py
**Change Type:** modified
**Context:** PR #22651: ts: basic documentation for utility scripts - * Added documentation strings for all scripts in `modules/ts/misc` * Changed executable bit f...
**Review Line:** 13

**Code Changes:**
```diff
+
+### Options
+
+./trace_profiler.py <TraceLogFile> <num>
+
+<TraceLogFile>  - usually OpenCVTrace.txt
+<num>           - number of functions to show (depth)
+
+### Example
+
+./trace_profiler.py OpenCVTrace.txt 2
```

Review comment:
Some instructions to get OpenCVTrace.txt are required or link to wiki, if it's not trivial.
**File:** modules/ts/misc/chart.py
**Change Type:** modified
**Context:** PR #22651: ts: basic documentation for utility scripts - * Added documentation strings for all scripts in `modules/ts/misc` * Changed executable bit f...

**Code Changes:**
```diff
@@ -1,4 +1,46 @@
 #!/usr/bin/env python
+""" OpenCV performance test results charts generator.
+
+This script formats results of a performance test as a table or a series of tables according to test
+parameters.
+
+### Description
+
+Performance data is stored in the GTest log file created by performance tests. Default name is
```

Review comment:
Wrapped to the width of 100.
**File:** modules/ts/misc/perf_tests_timing.py
**Change Type:** modified
**Context:** PR #22651: ts: basic documentation for utility scripts - * Added documentation strings for all scripts in `modules/ts/misc` * Changed executable bit f...

**Code Changes:**
```diff
@@ -1,4 +1,26 @@
 #!/usr/bin/env python
+""" Prints total execution time and number of total/failed tests.
+
+Performance data is stored in the GTest log file created by performance tests. Default name is
+`test_details.xml`. It can be changed with the `--gtest_output=xml:<location>/<filename>.xml` test
+option. See https://github.com/opencv/opencv/wiki/HowToUsePerfTests for more details.
+
+This script uses XML test log to produce basic runtime statistics in a text or HTML table.
+
```

Review comment:
With Python 2 it does not crash, but produce broken report. For 3.4 it's important to presume 2.7 support. ``` python2 ../opencv-3.4/modules/ts/misc/perf_tests_timing.py ./imgproc_perf.xml Overall time: 0.79 min Module Testsuit Time (min) Num of tests Failed r e s i z e D o w n L i n e a r N o n E imgproc x 0.304 60 a c t : : M a t I n f o _ S i z e P a i r r e s i z e U p L i n e a r N o n E x imgproc a 0.285 24 c t : : M a t I n f o _ S i z e P a i r r e s i z e D o w n L i n e a r : imgproc : 0.108 20 M a t I n f o _ S i z e _ S i z e r e s i z e U p L i n e a r : : imgproc M 0.096 8 a t I n f o _ S i z e _ S i z e ```
**File:** modules/ts/misc/perf_tests_timing.py
**Change Type:** modified
**Context:** PR #22651: ts: basic documentation for utility scripts - * Added documentation strings for all scripts in `modules/ts/misc` * Changed executable bit f...

**Code Changes:**
```diff
@@ -1,4 +1,26 @@
 #!/usr/bin/env python
+""" Prints total execution time and number of total/failed tests.
+
+Performance data is stored in the GTest log file created by performance tests. Default name is
+`test_details.xml`. It can be changed with the `--gtest_output=xml:<location>/<filename>.xml` test
+option. See https://github.com/opencv/opencv/wiki/HowToUsePerfTests for more details.
+
+This script uses XML test log to produce basic runtime statistics in a text or HTML table.
+
```

Review comment:
Updated. Looks like `.keys()` works for both python versions.
**File:** modules/ts/misc/perf_tests_timing.py
**Change Type:** modified
**Context:** PR #22651: ts: basic documentation for utility scripts - * Added documentation strings for all scripts in `modules/ts/misc` * Changed executable bit f...

**Code Changes:**
```diff
@@ -1,4 +1,26 @@
 #!/usr/bin/env python
+""" Prints total execution time and number of total/failed tests.
+
+Performance data is stored in the GTest log file created by performance tests. Default name is
+`test_details.xml`. It can be changed with the `--gtest_output=xml:<location>/<filename>.xml` test
+option. See https://github.com/opencv/opencv/wiki/HowToUsePerfTests for more details.
+
+This script uses XML test log to produce basic runtime statistics in a text or HTML table.
+
```

Review comment:
Apparently the problem was not with `.iterkeys()`, it is the script `perf_tests_timing.py`. It does not work in _python2_ with current _3.4_ branch as well.
**File:** modules/dnn/test/test_onnx_importer.cpp
**Change Type:** modified
**Context:** PR #22652: Address CUDA-related errors

**Code Changes:**
```diff
@@ -221,11 +221,21 @@ TEST_P(Test_ONNX_layers, GatherMulti)
 
 TEST_P(Test_ONNX_layers, Convolution3D)
 {
+    if (backend == DNN_BACKEND_CUDA && target == DNN_TARGET_CUDA_FP16)
+    {
+        // CUDA_FP16: cuDNN did not return a suitable algorithm for convolution.
+        applyTestTag(CV_TEST_TAG_DNN_SKIP_CUDA_FP16);
+    }
     testONNXModels("conv3d");
```

Review comment:
Do we need to support such cases?
**File:** modules/dnn/test/test_onnx_importer.cpp
**Change Type:** modified
**Context:** PR #22652: Address CUDA-related errors

**Code Changes:**
```diff
@@ -221,11 +221,21 @@ TEST_P(Test_ONNX_layers, GatherMulti)
 
 TEST_P(Test_ONNX_layers, Convolution3D)
 {
+    if (backend == DNN_BACKEND_CUDA && target == DNN_TARGET_CUDA_FP16)
+    {
+        // CUDA_FP16: cuDNN did not return a suitable algorithm for convolution.
+        applyTestTag(CV_TEST_TAG_DNN_SKIP_CUDA_FP16);
+    }
     testONNXModels("conv3d");
```

Review comment:
Does it work for IE? If so, please remove the dead code.
**File:** modules/dnn/test/test_onnx_importer.cpp
**Change Type:** modified
**Context:** PR #22652: Address CUDA-related errors
**Review Line:** 1144

**Code Changes:**
```diff
-    testONNXModels("split_sizes");
     testONNXModels("split_neg_axis");
 }
 
+// Mul inside with 0-d tensor, output should be A x 1, but is 1 x A. PR #22652
+TEST_P(Test_ONNX_layers, DISABLED_Split_sizes_0d)
+{
+    if (backend == DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019)
+        applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_NN_BUILDER);
+    if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH)
+        applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_NGRAPH);
```

Review comment:
I propose to add comment with a reference to issue why the test is disabled.
**File:** modules/dnn/src/layers/elementwise_layers.cpp
**Change Type:** modified
**Context:** PR #22652: Address CUDA-related errors

**Code Changes:**
```diff
@@ -1108,7 +1108,7 @@ struct CeilFunctor : public BaseDefaultFunctor<CeilFunctor>
 
     bool supportBackend(int backendId, int)
     {
-        return backendId == DNN_BACKEND_OPENCV || backendId == DNN_BACKEND_HALIDE;
+        return backendId == DNN_BACKEND_OPENCV || backendId == DNN_BACKEND_CUDA || backendId == DNN_BACKEND_HALIDE;
     }
 
     inline float calculate(float x) const
@@ -1143,7 +1143,7 @@ struct FloorFunctor : public BaseDefaultFunctor<FloorFunctor>
```

Review comment:
Why there are two `backendId == DNN_BACKEND_CUDA`? Same for the functors below.
**File:** apps/interactive-calibration/calibPipeline.cpp
**Change Type:** modified
**Context:** PR #22147: Add zoom factor to interactive calibration tool

**Code Changes:**
```diff
@@ -5,6 +5,7 @@
 #include "calibPipeline.hpp"
 
 #include <opencv2/highgui.hpp>
+#include <opencv2/imgproc.hpp>
 
 #include <stdexcept>
 
@@ -58,7 +59,7 @@ PipelineExitStatus CalibPipeline::start(std::vector<cv::Ptr<FrameProcessor> > pr
     if(!mCapture.isOpened())
```

Review comment:
> processedFrame, processedFrame Don't use inplace parameters for non-inplace processing. This cause performance penalty of src buffer clone. ``` Mat resizedFrame; cv::resize(processedFrame, resizedFrame, ...) processedFrame = resizedFrame; // or std::swap(processedFrame, resizedFrame); or with std::move ```
**File:** apps/interactive-calibration/frameProcessor.cpp
**Change Type:** modified
**Context:** PR #22147: Add zoom factor to interactive calibration tool

**Code Changes:**
```diff
@@ -201,7 +201,16 @@ void CalibProcessor::showCaptureMessage(const cv::Mat& frame, const std::string
     double textSize = VIDEO_TEXT_SIZE * frame.cols / (double) IMAGE_MAX_WIDTH;
     cv::bitwise_not(frame, frame);
     cv::putText(frame, message, textOrigin, 1, textSize, cv::Scalar(0,0,255), 2, cv::LINE_AA);
-    cv::imshow(mainWindowName, frame);
+    cv::Mat resized;
+    if (std::fabs(mZoom - 1.) > 0.001f)
+    {
+        cv::resize(frame, resized, cv::Size(), mZoom, mZoom);
+    }
```

Review comment:
It is better to avoid such trick with assignment. Use `std::abs(mZoom - 1) > 0.001f` pre-check for resize call here and above.
**File:** modules/core/src/system.cpp
**Change Type:** modified
**Context:** PR #21833: Add Loongson Advanced SIMD Extension support: -DCPU_BASELINE=LASX
**Review Line:** 674

**Code Changes:**
```diff
         have[CV_CPU_RVV] = true;
     #endif
 
+    #if defined __loongarch_asx
+        have[CV_CPU_LASX] = true;
+    #endif
+
         bool skip_baseline_check = false;
 #ifndef NO_GETENV
         if (getenv("OPENCV_SKIP_CPU_BASELINE_CHECK"))
```

Review comment:
You are best to enable these SIMD features by reading the CPUID like ARM and x86.
**File:** modules/core/src/system.cpp
**Change Type:** modified
**Context:** PR #21833: Add Loongson Advanced SIMD Extension support: -DCPU_BASELINE=LASX
**Review Line:** 674

**Code Changes:**
```diff
         have[CV_CPU_RVV] = true;
     #endif
 
+    #if defined __loongarch_asx
+        have[CV_CPU_LASX] = true;
+    #endif
+
         bool skip_baseline_check = false;
 #ifndef NO_GETENV
         if (getenv("OPENCV_SKIP_CPU_BASELINE_CHECK"))
```

Review comment:
After I copied the first patch to my local opencv repository (Tag: 4.5.4), the Calib3d_StereoBM.regression test failed. Note that the cmake option I used on 3A5000 platform is " -DBUILD_PNG=ON -D WITH_OPENCL=OFF -DBUILD_WITH_DEBUG_INFO=ON -DCPU_BASELINE=LASX ".
**File:** modules/core/src/system.cpp
**Change Type:** modified
**Context:** PR #21833: Add Loongson Advanced SIMD Extension support: -DCPU_BASELINE=LASX
**Review Line:** 674

**Code Changes:**
```diff
         have[CV_CPU_RVV] = true;
     #endif
 
+    #if defined __loongarch_asx
+        have[CV_CPU_LASX] = true;
+    #endif
+
         bool skip_baseline_check = false;
 #ifndef NO_GETENV
         if (getenv("OPENCV_SKIP_CPU_BASELINE_CHECK"))
```

Review comment:
I‘m so sorry that I didn't get the message or emails. I'm very glad you have a 3a5000 environment as We are considering providing 3a5000 remote environment. YES, the Calib3d_StereoBM.regression test is currently failed. We suspect that compiler optimization is the reason as DEBUG version is OK. We will follow up and fix the bug.
**File:** cmake/OpenCVCompilerOptimizations.cmake
**Change Type:** modified
**Context:** PR #21833: Add Loongson Advanced SIMD Extension support: -DCPU_BASELINE=LASX

**Code Changes:**
```diff
@@ -50,6 +50,7 @@ list(APPEND CPU_ALL_OPTIMIZATIONS NEON VFPV3 FP16)
 list(APPEND CPU_ALL_OPTIMIZATIONS MSA)
 list(APPEND CPU_ALL_OPTIMIZATIONS VSX VSX3)
 list(APPEND CPU_ALL_OPTIMIZATIONS RVV)
+list(APPEND CPU_ALL_OPTIMIZATIONS LASX)
 list(REMOVE_DUPLICATES CPU_ALL_OPTIMIZATIONS)
 
 ocv_update(CPU_VFPV3_FEATURE_ALIAS "")
@@ -377,6 +378,12 @@ elseif(RISCV)
   set(CPU_DISPATCH "RVV" CACHE STRING "${HELP_CPU_DISPATCH}")
```

Review comment:
Can it be set as `LASX` by default? According to my tests, if I do not set `-DCPU_BASELINE=LASX`, the check `cpu_lasx.cpp` on the remote LoongArch PC would fail and LASX optimization would be turned off unless that flag is set explicitly.
**File:** cmake/checks/cpu_lasx.cpp
**Change Type:** added
**Context:** PR #21833: Add Loongson Advanced SIMD Extension support: -DCPU_BASELINE=LASX
**Review Line:** 4

**Code Changes:**
```diff
@@ -0,0 +1,23 @@
+#include <stdio.h>
+
+#if defined(__loongarch_asx)
+#  include <lasxintrin.h>
+#  define CV_LASX 1
+#endif
+
+#if defined CV_LASX
+int test()
```

Review comment:
Is there any open documents on the LoongArch intrinsics?
**File:** cmake/checks/cpu_lasx.cpp
**Change Type:** added
**Context:** PR #21833: Add Loongson Advanced SIMD Extension support: -DCPU_BASELINE=LASX
**Review Line:** 4

**Code Changes:**
```diff
@@ -0,0 +1,23 @@
+#include <stdio.h>
+
+#if defined(__loongarch_asx)
+#  include <lasxintrin.h>
+#  define CV_LASX 1
+#endif
+
+#if defined CV_LASX
+int test()
```

Review comment:
There is no open documents on the LoongArch intrinsics now. One intrinsic corresponds to one SIMD instruction. But LoongArch SIMD hasn't been released yet.
**File:** cmake/OpenCVCompilerOptimizations.cmake
**Change Type:** modified
**Context:** PR #21833: Add Loongson Advanced SIMD Extension support: -DCPU_BASELINE=LASX

**Code Changes:**
```diff
@@ -50,6 +50,7 @@ list(APPEND CPU_ALL_OPTIMIZATIONS NEON VFPV3 FP16)
 list(APPEND CPU_ALL_OPTIMIZATIONS MSA)
 list(APPEND CPU_ALL_OPTIMIZATIONS VSX VSX3)
 list(APPEND CPU_ALL_OPTIMIZATIONS RVV)
+list(APPEND CPU_ALL_OPTIMIZATIONS LASX)
 list(REMOVE_DUPLICATES CPU_ALL_OPTIMIZATIONS)
 
 ocv_update(CPU_VFPV3_FEATURE_ALIAS "")
@@ -377,6 +378,12 @@ elseif(RISCV)
   set(CPU_DISPATCH "RVV" CACHE STRING "${HELP_CPU_DISPATCH}")
```

Review comment:
Yes, I noticed it. The reason of checking failure is no -mlasx flag. May be there is a bug in DETECT mode. The check is done as follow: `ocv_check_compiler_flag(CXX "${CPU_BASELINE_FLAGS}" "${_varname}" "${CPU_${OPT}_TEST_FILE}")`, I think `CPU_BASELINE_FLAGS` should be `CPU_${OPT}_FLAGS_ON`, right ?
**File:** cmake/OpenCVCompilerOptimizations.cmake
**Change Type:** modified
**Context:** PR #21833: Add Loongson Advanced SIMD Extension support: -DCPU_BASELINE=LASX

**Code Changes:**
```diff
@@ -50,6 +50,7 @@ list(APPEND CPU_ALL_OPTIMIZATIONS NEON VFPV3 FP16)
 list(APPEND CPU_ALL_OPTIMIZATIONS MSA)
 list(APPEND CPU_ALL_OPTIMIZATIONS VSX VSX3)
 list(APPEND CPU_ALL_OPTIMIZATIONS RVV)
+list(APPEND CPU_ALL_OPTIMIZATIONS LASX)
 list(REMOVE_DUPLICATES CPU_ALL_OPTIMIZATIONS)
 
 ocv_update(CPU_VFPV3_FEATURE_ALIAS "")
@@ -377,6 +378,12 @@ elseif(RISCV)
   set(CPU_DISPATCH "RVV" CACHE STRING "${HELP_CPU_DISPATCH}")
```

Review comment:
`DETECT` is used for detection of current compiler flags (without any extra flags, but it could properly handle `-march=native` case). `DETECT` is similar to empty (default) baseline. To learn more how it works please take a look on x86 part. Also there is Wiki page about that: https://github.com/opencv/opencv/wiki/CPU-optimizations-build-options
**File:** modules/core/src/system.cpp
**Change Type:** modified
**Context:** PR #21833: Add Loongson Advanced SIMD Extension support: -DCPU_BASELINE=LASX
**Review Line:** 674

**Code Changes:**
```diff
         have[CV_CPU_RVV] = true;
     #endif
 
+    #if defined __loongarch_asx
+        have[CV_CPU_LASX] = true;
+    #endif
+
         bool skip_baseline_check = false;
 #ifndef NO_GETENV
         if (getenv("OPENCV_SKIP_CPU_BASELINE_CHECK"))
```

Review comment:
We haven't found the cause of the problem yet. Our colleagues are still working on it.
**File:** modules/core/include/opencv2/core/types.hpp
**Change Type:** modified
**Context:** PR #22526: core: expose rectangle intersection to bindings

**Code Changes:**
```diff
@@ -2017,6 +2017,15 @@ double jaccardDistance(const Rect_<_Tp>& a, const Rect_<_Tp>& b) {
     return 1.0 - Aab / (Aa + Ab - Aab);
 }
 
+/** @brief Finds out if there is any intersection between two rectangles
+ *
+ * mainly useful for language bindings
+ * @param rect1 First rectangle
+ * @param rect2 Second rectangle
+ * @return the area of the intersection
```

Review comment:
Shouldn't we also add this function for `cv::Rect`? Will there be a conflict if the have the same name?
**File:** modules/core/include/opencv2/core/types.hpp
**Change Type:** modified
**Context:** PR #22526: core: expose rectangle intersection to bindings

**Code Changes:**
```diff
@@ -2017,6 +2017,15 @@ double jaccardDistance(const Rect_<_Tp>& a, const Rect_<_Tp>& b) {
     return 1.0 - Aab / (Aa + Ab - Aab);
 }
 
+/** @brief Finds out if there is any intersection between two rectangles
+ *
+ * mainly useful for language bindings
+ * @param rect1 First rectangle
+ * @param rect2 Second rectangle
+ * @return the area of the intersection
```

Review comment:
> rectangleIntersection Name is not accurate. It returns "area". --- There is no `cv::Rect` automatic wrapper in bindings. We could add helper Python class for Rect support here: https://github.com/opencv/opencv/tree/4.x/modules/core/misc/python/package
**File:** modules/core/include/opencv2/core/types.hpp
**Change Type:** modified
**Context:** PR #22526: core: expose rectangle intersection to bindings

**Code Changes:**
```diff
@@ -2017,6 +2017,15 @@ double jaccardDistance(const Rect_<_Tp>& a, const Rect_<_Tp>& b) {
     return 1.0 - Aab / (Aa + Ab - Aab);
 }
 
+/** @brief Finds out if there is any intersection between two rectangles
+ *
+ * mainly useful for language bindings
+ * @param rect1 First rectangle
+ * @param rect2 Second rectangle
+ * @return the area of the intersection
```

Review comment:
There is a wrapper for `cv::Rect` in common code: https://github.com/opencv/opencv/blob/0ac67ee8d92e3fef8bb78e774cc004b8cdba180e/modules/python/src2/cv2_convert.cpp#L674-L687
**File:** modules/core/include/opencv2/core/types.hpp
**Change Type:** modified
**Context:** PR #22526: core: expose rectangle intersection to bindings

**Code Changes:**
```diff
@@ -2017,6 +2017,15 @@ double jaccardDistance(const Rect_<_Tp>& a, const Rect_<_Tp>& b) {
     return 1.0 - Aab / (Aa + Ab - Aab);
 }
 
+/** @brief Finds out if there is any intersection between two rectangles
+ *
+ * mainly useful for language bindings
+ * @param rect1 First rectangle
+ * @param rect2 Second rectangle
+ * @return the area of the intersection
```

Review comment:
> Shouldn't we also add this function for cv::Rect? Will there be a conflict if the have the same name? currently int rects will be converted to double by parseSequence, so they do work. An int overload would be handled by the wrapper just fine, but I doubt there would be any performance benefits (using python) > Name is not accurate. It returns "area". tried to follow rotatedRectangleIntersection here, which also returns the intersection area. Then there is intersectConvexConvex. What name would you suggest? rectangleIntersectionArea sounds rather verbose..