nareshmlx/opencv-pr huggingface dataset:
**File:** modules/imgcodecs/src/grfmt_hdr.cpp
**Change Type:** modified
**Context:** PR #22830: imgcodecs: ensure parameters are key-value pairs, fix HDR encoder

**Code Changes:**
```diff
@@ -141,14 +141,28 @@ bool HdrEncoder::write( const Mat& input_img, const std::vector<int>& params )
     if(img.depth() != CV_32F) {
         img.convertTo(img, CV_32FC3, 1/255.0f);
     }
-    CV_Assert(params.empty() || params[0] == HDR_NONE || params[0] == HDR_RLE);
+
+    int compression = IMWRITE_HDR_COMPRESSION_RLE;
+    for (size_t i = 0; i + 1 < params.size(); i += 2)
+    {
+        switch (params[i])
```

Review comment:
I feel that it is need to fix the conditional here. ``` - case CV_IMWRITE_JPEG_QUALITY: + case IMWRITE_HDR_COMPRESSION: ``` Test code is following. ```c $ git --no-pager diff diff --git a/modules/imgcodecs/src/grfmt_hdr.cpp b/modules/imgcodecs/src/grfmt_hdr.cpp index 4c37549..6e2f565 100644 --- a/modules/imgcodecs/src/grfmt_hdr.cpp +++ b/modules/imgcodecs/src/grfmt_hdr.cpp @@ -147,7 +147,7 @@ bool HdrEncoder::write( const Mat& input_img, const std::vector<int>& params ) { switch (params[i]) { - case CV_IMWRITE_JPEG_QUALITY: + case IMWRITE_HDR_COMPRESSION: compression = params[i + 1]; break; default: diff --git a/modules/imgcodecs/test/test_grfmt.cpp b/modules/imgcodecs/test/test_grfmt.cpp index 520ba4a..2e4130c 100644 --- a/modules/imgcodecs/test/test_grfmt.cpp +++ b/modules/imgcodecs/test/test_grfmt.cpp @@ -316,6 +316,27 @@ TEST(Imgcodecs_Hdr, regression) ASSERT_FALSE(max > DBL_EPSILON); } remove(tmp_file_name.c_str()); + + { + // Default + vector<uchar> buf_noparams; + imencode(".hdr", img_no_rle, buf_noparams); + + // IMWRITE_HDR_COMPRESSION_NONE + param[0] = IMWRITE_HDR_COMPRESSION; + param[1] = IMWRITE_HDR_COMPRESSION_NONE; + vector<uchar> buf_comp_none; + imencode(".hdr", img_no_rle, buf_comp_none, param); + + // IMWRITE_HDR_COMPRESSION_RLE + param[0] = IMWRITE_HDR_COMPRESSION; + param[1] = IMWRITE_HDR_COMPRESSION_RLE; + vector<uchar> buf_comp_rle; + imencode(".hdr", img_no_rle, buf_comp_rle, param); + + ASSERT_EQ( buf_noparams, buf_comp_rle); + ASSERT_TRUE( buf_comp_rle.size() < buf_comp_none.size()); + } } #endif ```
**File:** modules/3d/test/test_tsdf.cpp
**Change Type:** modified
**Context:** PR #22741: HashTSDF: fix for volume pose
**Review Line:** 1216

**Code Changes:**
```diff
 
+TEST(HashTSDF_CPU, reproduce_volPoseRot)
+{
+    cv::ocl::setUseOpenCL(false);
+    regressionVolPoseRot();
+    cv::ocl::setUseOpenCL(true);
+}
+
 TEST(ColorTSDF_CPU, raycast_custom_framesize_normals_mat)
 {
     cv::ocl::setUseOpenCL(false);
```

Review comment:
The `regressionVolPoseRot` in this unit uses `cv::Mat`, so it's always CPU only, right?
**File:** modules/3d/test/test_tsdf.cpp
**Change Type:** modified
**Context:** PR #22741: HashTSDF: fix for volume pose
**Review Line:** 1216

**Code Changes:**
```diff
 
+TEST(HashTSDF_CPU, reproduce_volPoseRot)
+{
+    cv::ocl::setUseOpenCL(false);
+    regressionVolPoseRot();
+    cv::ocl::setUseOpenCL(true);
+}
+
 TEST(ColorTSDF_CPU, raycast_custom_framesize_normals_mat)
 {
     cv::ocl::setUseOpenCL(false);
```

Review comment:
No, a `Volume` class behaves differently. If OpenCL is available and enabled then the `Volume` is created with GPU version used. Otherwise the CPU version is used. Once created, the type of `Volume` object cannot be changed. Then a data is obtained from `InputArray` or `OutputArray` using `getMat()` or `getUMat()` methods regarding what `Volume` version is used.
**File:** modules/dnn/src/tensorflow/tf_graph_simplifier.cpp
**Change Type:** modified
**Context:** PR #22725: DNN: report an error at the infinite loop of tensorflow importer

**Code Changes:**
```diff
@@ -829,12 +829,19 @@ void RemoveIdentityOps(tensorflow::GraphDef& net)
             IdentityOpsMap::iterator it = identity_ops.find(input_op_name);
 
             if (it != identity_ops.end()) {
+                std::set<String> loopCheckSet;
                 // In case of Identity after Identity
                 while (true)
                 {
                     IdentityOpsMap::iterator nextIt = identity_ops.find(it->second);
                     if (nextIt != identity_ops.end())
```

Review comment:
What is observed size of this container for valid models? If it is a large (>50 items) then we should try `std::set` here. --- itVec -> loopCheck / duplicateCheck / other descriptive name.
**File:** modules/3d/include/opencv2/3d/odometry_frame.hpp
**Change Type:** modified
**Context:** PR #22691: Docs added for Odometry and OdometryFrame

**Code Changes:**
```diff
@@ -26,25 +26,79 @@ enum OdometryFramePyramidType
     N_PYRAMIDS
 };
 
+/**
+ * @brief An object that keeps per-frame data for Odometry algorithms from user-provided images to algorithm-specific precalculated data.
+ * When not empty, it contains a depth image, a mask of valid pixels and a set of pyramids generated from that data.
+ * An BGR/Gray image and normals are optional.
+ * OdometryFrame is made to be used together with Odometry class to reuse precalculated data between Rt data calculations.
+ * A proper way to do that is to call Odometry::prepareFrames() on prev and next frames and then pass them to Odometry::compute() method.
```

Review comment:
BGR most probably.
**File:** modules/3d/include/opencv2/3d/odometry_frame.hpp
**Change Type:** modified
**Context:** PR #22691: Docs added for Odometry and OdometryFrame

**Code Changes:**
```diff
@@ -26,25 +26,79 @@ enum OdometryFramePyramidType
     N_PYRAMIDS
 };
 
+/**
+ * @brief An object that keeps per-frame data for Odometry algorithms from user-provided images to algorithm-specific precalculated data.
+ * When not empty, it contains a depth image, a mask of valid pixels and a set of pyramids generated from that data.
+ * An BGR/Gray image and normals are optional.
+ * OdometryFrame is made to be used together with Odometry class to reuse precalculated data between Rt data calculations.
+ * A proper way to do that is to call Odometry::prepareFrames() on prev and next frames and then pass them to Odometry::compute() method.
```

Review comment:
`3 or 4 uchar channels` - please replace by OpenCV cv::Mat types.
**File:** modules/3d/include/opencv2/3d/odometry_frame.hpp
**Change Type:** modified
**Context:** PR #22691: Docs added for Odometry and OdometryFrame

**Code Changes:**
```diff
@@ -26,25 +26,79 @@ enum OdometryFramePyramidType
     N_PYRAMIDS
 };
 
+/**
+ * @brief An object that keeps per-frame data for Odometry algorithms from user-provided images to algorithm-specific precalculated data.
+ * When not empty, it contains a depth image, a mask of valid pixels and a set of pyramids generated from that data.
+ * An BGR/Gray image and normals are optional.
+ * OdometryFrame is made to be used together with Odometry class to reuse precalculated data between Rt data calculations.
+ * A proper way to do that is to call Odometry::prepareFrames() on prev and next frames and then pass them to Odometry::compute() method.
```

Review comment:
Please add supported types
**File:** modules/gapi/include/opencv2/gapi/imgproc.hpp
**Change Type:** modified
**Context:** PR #22494: G-API Expose all core operations to python
**Review Line:** 657

**Code Changes:**
```diff
 @param borderValue border value in case of constant border type
 @sa  boxFilter, bilateralFilter, GaussianBlur, medianBlur
  */
-GAPI_EXPORTS GMat blur(const GMat& src, const Size& ksize, const Point& anchor = Point(-1,-1),
-                       int borderType = BORDER_DEFAULT, const Scalar& borderValue = Scalar(0));
+GAPI_EXPORTS_W GMat blur(const GMat& src, const Size& ksize, const Point& anchor = Point(-1,-1),
+                         int borderType = BORDER_DEFAULT, const Scalar& borderValue = Scalar(0));
 
 
 //GAPI_EXPORTS_W void blur( InputArray src, OutputArray dst,
```

Review comment:
Exception from `core` operations, just want it to be exposed asap :)
**File:** modules/gapi/include/opencv2/gapi/core.hpp
**Change Type:** modified
**Context:** PR #22494: G-API Expose all core operations to python
**Review Line:** 1860

**Code Changes:**
```diff
@@ -1857,7 +1857,7 @@ kmeans(const GArray<Point2f>& data, const int K, const GArray<int>& bestLabels,
 /** @overload
 @note Function textual ID is "org.opencv.core.kmeans3D"
  */
-GAPI_EXPORTS std::tuple<GOpaque<double>,GArray<int>,GArray<Point3f>>
+GAPI_EXPORTS_W std::tuple<GOpaque<double>,GArray<int>,GArray<Point3f>>
 kmeans(const GArray<Point3f>& data, const int K, const GArray<int>& bestLabels,
        const TermCriteria& criteria, const int attempts, const KmeansFlags flags);
 
@@ -1873,7 +1873,7 @@ The function transposes the matrix:
 
```

Review comment:
Make sense to add test for this one because it touches a lot of existing functionality.
**File:** modules/gapi/include/opencv2/gapi/core.hpp
**Change Type:** modified
**Context:** PR #22494: G-API Expose all core operations to python
**Review Line:** 1860

**Code Changes:**
```diff
@@ -1857,7 +1857,7 @@ kmeans(const GArray<Point2f>& data, const int K, const GArray<int>& bestLabels,
 /** @overload
 @note Function textual ID is "org.opencv.core.kmeans3D"
  */
-GAPI_EXPORTS std::tuple<GOpaque<double>,GArray<int>,GArray<Point3f>>
+GAPI_EXPORTS_W std::tuple<GOpaque<double>,GArray<int>,GArray<Point3f>>
 kmeans(const GArray<Point3f>& data, const int K, const GArray<int>& bestLabels,
        const TermCriteria& criteria, const int attempts, const KmeansFlags flags);
 
@@ -1873,7 +1873,7 @@ The function transposes the matrix:
 
```

Review comment:
kmeans or what?
**File:** modules/gapi/include/opencv2/gapi/gcommon.hpp
**Change Type:** modified
**Context:** PR #22494: G-API Expose all core operations to python
**Review Line:** 54

**Code Changes:**
```diff
@@ -51,6 +51,7 @@ namespace detail
         CV_STRING,     // std::string user G-API data
         CV_POINT,      // cv::Point user G-API data
         CV_POINT2F,    // cv::Point2f user G-API data
+        CV_POINT3F,    // cv::Point3f user G-API data
         CV_SIZE,       // cv::Size user G-API data
         CV_RECT,       // cv::Rect user G-API data
         CV_SCALAR,     // cv::Scalar user G-API data
@@ -72,16 +73,17 @@ namespace detail
     template<> struct GOpaqueTraits<cv::Scalar>  { static constexpr const OpaqueKind kind = OpaqueKind::CV_SCALAR; };
```

Review comment:
Missed the below type? See GOpaqueTraits
**File:** modules/gapi/include/opencv2/gapi/core.hpp
**Change Type:** modified
**Context:** PR #22494: G-API Expose all core operations to python
**Review Line:** 1860

**Code Changes:**
```diff
@@ -1857,7 +1857,7 @@ kmeans(const GArray<Point2f>& data, const int K, const GArray<int>& bestLabels,
 /** @overload
 @note Function textual ID is "org.opencv.core.kmeans3D"
  */
-GAPI_EXPORTS std::tuple<GOpaque<double>,GArray<int>,GArray<Point3f>>
+GAPI_EXPORTS_W std::tuple<GOpaque<double>,GArray<int>,GArray<Point3f>>
 kmeans(const GArray<Point3f>& data, const int K, const GArray<int>& bestLabels,
        const TermCriteria& criteria, const int attempts, const KmeansFlags flags);
 
@@ -1873,7 +1873,7 @@ The function transposes the matrix:
 
```

Review comment:
Yes, add test for `kmeans` because it returns `Point3f` which wasn't supported before
**File:** modules/gapi/include/opencv2/gapi/gcommon.hpp
**Change Type:** modified
**Context:** PR #22494: G-API Expose all core operations to python
**Review Line:** 54

**Code Changes:**
```diff
@@ -51,6 +51,7 @@ namespace detail
         CV_STRING,     // std::string user G-API data
         CV_POINT,      // cv::Point user G-API data
         CV_POINT2F,    // cv::Point2f user G-API data
+        CV_POINT3F,    // cv::Point3f user G-API data
         CV_SIZE,       // cv::Size user G-API data
         CV_RECT,       // cv::Rect user G-API data
         CV_SCALAR,     // cv::Scalar user G-API data
@@ -72,16 +73,17 @@ namespace detail
     template<> struct GOpaqueTraits<cv::Scalar>  { static constexpr const OpaqueKind kind = OpaqueKind::CV_SCALAR; };
```

Review comment:
I didn't exposed it for purpose, because there weren't such cases
**File:** modules/gapi/include/opencv2/gapi/gcommon.hpp
**Change Type:** modified
**Context:** PR #22494: G-API Expose all core operations to python
**Review Line:** 54

**Code Changes:**
```diff
@@ -51,6 +51,7 @@ namespace detail
         CV_STRING,     // std::string user G-API data
         CV_POINT,      // cv::Point user G-API data
         CV_POINT2F,    // cv::Point2f user G-API data
+        CV_POINT3F,    // cv::Point3f user G-API data
         CV_SIZE,       // cv::Size user G-API data
         CV_RECT,       // cv::Rect user G-API data
         CV_SCALAR,     // cv::Scalar user G-API data
@@ -72,16 +73,17 @@ namespace detail
     template<> struct GOpaqueTraits<cv::Scalar>  { static constexpr const OpaqueKind kind = OpaqueKind::CV_SCALAR; };
```

Review comment:
But it is an inconsistency now, isnt it? And now its only you who knows the reason for it (ok, and me)
**File:** modules/gapi/misc/python/test/test_gapi_core.py
**Change Type:** modified
**Context:** PR #22494: G-API Expose all core operations to python
**Review Line:** 197

**Code Changes:**
```diff
         def test_kmeans_2d(self):
@@ -194,6 +194,33 @@ def test_kmeans_2d(self):
             self.assertEqual(K, len(centers))
 
 
+        def test_kmeans_3d(self):
+            # K-means 3D params
+            count     = 100
+            sz        = (count, 3)
+            amount    = sz[0]
+            K         = 5
```

Review comment:
Actually tests only functionality without accuracy checking with `ocv`
**File:** cmake/templates/OpenCVConfig-CUDA.cmake.in
**Change Type:** modified
**Context:** PR #22615: Update CMake rules to include Nvidia Video Codec SDK encoding libs

**Code Changes:**
```diff
@@ -5,7 +5,7 @@ set(OpenCV_CUDA_VERSION "@CUDA_VERSION_STRING@")
 set(OpenCV_USE_CUBLAS   "@HAVE_CUBLAS@")
 set(OpenCV_USE_CUFFT    "@HAVE_CUFFT@")
 set(OpenCV_USE_NVCUVID  "@HAVE_NVCUVID@")
-
+set(OpenCV_USE_NVCUVENC "@HAVE_NVCUVENC@")
 set(OpenCV_CUDNN_VERSION    "@CUDNN_VERSION@")
 set(OpenCV_USE_CUDNN        "@HAVE_CUDNN@")
 
@@ -36,14 +36,6 @@ if(OpenCV_USE_CUFFT)
```

Review comment:
I think it redundant as soon as you link CUDA_nvencodeapi_LIBRARIES to cudacodec module.
**File:** cmake/OpenCVDetectCUDA.cmake
**Change Type:** modified
**Context:** PR #22615: Update CMake rules to include Nvidia Video Codec SDK encoding libs

**Code Changes:**
```diff
@@ -28,6 +28,7 @@ else()
 endif()
 
 if(CUDA_FOUND)
+  unset(CUDA_nvcuvenc_LIBRARY CACHE)
   set(HAVE_CUDA 1)
   if(NOT CUDA_VERSION VERSION_LESS 11.0)
     # CUDA 11.0 removes nppicom
@@ -53,7 +54,7 @@ if(CUDA_FOUND)
       endif()
```

Review comment:
It does not work for Linux. Linux version is named differently: https://docs.nvidia.com/video-technologies/video-codec-sdk/release-notes/
**File:** cmake/templates/OpenCVConfig-CUDA.cmake.in
**Change Type:** modified
**Context:** PR #22615: Update CMake rules to include Nvidia Video Codec SDK encoding libs

**Code Changes:**
```diff
@@ -5,7 +5,7 @@ set(OpenCV_CUDA_VERSION "@CUDA_VERSION_STRING@")
 set(OpenCV_USE_CUBLAS   "@HAVE_CUBLAS@")
 set(OpenCV_USE_CUFFT    "@HAVE_CUFFT@")
 set(OpenCV_USE_NVCUVID  "@HAVE_NVCUVID@")
-
+set(OpenCV_USE_NVCUVENC "@HAVE_NVCUVENC@")
 set(OpenCV_CUDNN_VERSION    "@CUDNN_VERSION@")
 set(OpenCV_USE_CUDNN        "@HAVE_CUDNN@")
 
@@ -36,14 +36,6 @@ if(OpenCV_USE_CUFFT)
```

Review comment:
Correct removed and now only referenced inside cudacodec.
**File:** cmake/OpenCVDetectCUDA.cmake
**Change Type:** modified
**Context:** PR #22615: Update CMake rules to include Nvidia Video Codec SDK encoding libs

**Code Changes:**
```diff
@@ -28,6 +28,7 @@ else()
 endif()
 
 if(CUDA_FOUND)
+  unset(CUDA_nvcuvenc_LIBRARY CACHE)
   set(HAVE_CUDA 1)
   if(NOT CUDA_VERSION VERSION_LESS 11.0)
     # CUDA 11.0 removes nppicom
@@ -53,7 +54,7 @@ if(CUDA_FOUND)
       endif()
```

Review comment:
Updated and tested on Ubuntu 20.04 and Windows 11.
**File:** samples/gpu/video_writer.cpp
**Change Type:** modified
**Context:** PR #22615: Update CMake rules to include Nvidia Video Codec SDK encoding libs

**Code Changes:**
```diff
@@ -2,7 +2,7 @@
 
 #include "opencv2/opencv_modules.hpp"
 
-#if defined(HAVE_OPENCV_CUDACODEC) && defined(_WIN32)
+#if defined(HAVE_OPENCV_CUDACODEC)
 
 #include <vector>
 #include <numeric>
@@ -20,7 +20,7 @@ int main(int argc, const char* argv[])
```

Review comment:
It's sample. User expects to get result in current directory and usually do not know where tmp location. I propose to revert all changes related to `cv::tempfile`
**File:** modules/imgproc/src/stackblur.cpp
**Change Type:** added
**Context:** PR #20379: Add StackBlur for imgproc

**Code Changes:**
```diff
@@ -0,0 +1,1261 @@
+// 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.
+
+/*
+StackBlur - a fast almost Gaussian Blur
+Theory: http://underdestruction.com/2004/02/25/stackblur-2004
+The code has been borrowed from (https://github.com/flozz/StackBlur)
+and adapted for OpenCV by Zihao Mu.
```

Review comment:
I guess, you based your implementation on some other code. What's the license of the original implementation? At least, you should put the link/reference to the original code, copyright and information about the license (or the license itself, if it's short)
**File:** modules/imgproc/src/stackblur.cpp
**Change Type:** added
**Context:** PR #20379: Add StackBlur for imgproc

**Code Changes:**
```diff
@@ -0,0 +1,1261 @@
+// 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.
+
+/*
+StackBlur - a fast almost Gaussian Blur
+Theory: http://underdestruction.com/2004/02/25/stackblur-2004
+The code has been borrowed from (https://github.com/flozz/StackBlur)
+and adapted for OpenCV by Zihao Mu.
```

Review comment:
replace cn with 3 here
**File:** modules/imgproc/src/stackblur.cpp
**Change Type:** added
**Context:** PR #20379: Add StackBlur for imgproc

**Code Changes:**
```diff
@@ -0,0 +1,1261 @@
+// 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.
+
+/*
+StackBlur - a fast almost Gaussian Blur
+Theory: http://underdestruction.com/2004/02/25/stackblur-2004
+The code has been borrowed from (https://github.com/flozz/StackBlur)
+and adapted for OpenCV by Zihao Mu.
```

Review comment:
replace cn with 4 in this branch, or define a constant "const int CN = 4;" and replace "cn" with "CN"
**File:** modules/imgproc/src/stackblur.cpp
**Change Type:** added
**Context:** PR #20379: Add StackBlur for imgproc

**Code Changes:**
```diff
@@ -0,0 +1,1261 @@
+// 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.
+
+/*
+StackBlur - a fast almost Gaussian Blur
+Theory: http://underdestruction.com/2004/02/25/stackblur-2004
+The code has been borrowed from (https://github.com/flozz/StackBlur)
+and adapted for OpenCV by Zihao Mu.
```

Review comment:
shall it be multiplied by "cn"?
**File:** modules/imgproc/src/stackblur.cpp
**Change Type:** added
**Context:** PR #20379: Add StackBlur for imgproc

**Code Changes:**
```diff
@@ -0,0 +1,1261 @@
+// 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.
+
+/*
+StackBlur - a fast almost Gaussian Blur
+Theory: http://underdestruction.com/2004/02/25/stackblur-2004
+The code has been borrowed from (https://github.com/flozz/StackBlur)
+and adapted for OpenCV by Zihao Mu.
```

Review comment:
Hi, this implementation is based on two projects ([project1](https://github.com/flozz/StackBlur) and [project2](http://vitiy.info/Code/stackblur.cpp)). Should I Change the Copy Right like the [following](https://github.com/flozz/StackBlur/blob/master/LICENSE-MIT.txt)?: `` Copyright (c) 2010 Mario Klingemann ``
**File:** modules/imgproc/src/stackblur.cpp
**Change Type:** added
**Context:** PR #20379: Add StackBlur for imgproc

**Code Changes:**
```diff
@@ -0,0 +1,1261 @@
+// 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.
+
+/*
+StackBlur - a fast almost Gaussian Blur
+Theory: http://underdestruction.com/2004/02/25/stackblur-2004
+The code has been borrowed from (https://github.com/flozz/StackBlur)
+and adapted for OpenCV by Zihao Mu.
```

Review comment:
`#else`
**File:** modules/imgproc/src/stackblur.cpp
**Change Type:** added
**Context:** PR #20379: Add StackBlur for imgproc

**Code Changes:**
```diff
@@ -0,0 +1,1261 @@
+// 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.
+
+/*
+StackBlur - a fast almost Gaussian Blur
+Theory: http://underdestruction.com/2004/02/25/stackblur-2004
+The code has been borrowed from (https://github.com/flozz/StackBlur)
+and adapted for OpenCV by Zihao Mu.
```

Review comment:
Lets avoid using of dynamic array of SIMD vectors - this doesn't make sense. Lets use this instead: ``` cv::AutoBuffer<unsigned int, 512 * 4> v_stack_container(stackLen * 4); ``` + v_store() / v_load() operations.
**File:** modules/imgproc/src/stackblur.cpp
**Change Type:** added
**Context:** PR #20379: Add StackBlur for imgproc

**Code Changes:**
```diff
@@ -0,0 +1,1261 @@
+// 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.
+
+/*
+StackBlur - a fast almost Gaussian Blur
+Theory: http://underdestruction.com/2004/02/25/stackblur-2004
+The code has been borrowed from (https://github.com/flozz/StackBlur)
+and adapted for OpenCV by Zihao Mu.
```

Review comment:
Dynamic arrays on stack is not a part of C++ standard (`ISO C++ forbids variable-size array`). Please use `std::vector` or `cv::AutoBuffer<uchar, 512 * 4> stack(stackLen * 4);` (preferable)
**File:** modules/imgproc/src/stackblur.cpp
**Change Type:** added
**Context:** PR #20379: Add StackBlur for imgproc

**Code Changes:**
```diff
@@ -0,0 +1,1261 @@
+// 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.
+
+/*
+StackBlur - a fast almost Gaussian Blur
+Theory: http://underdestruction.com/2004/02/25/stackblur-2004
+The code has been borrowed from (https://github.com/flozz/StackBlur)
+and adapted for OpenCV by Zihao Mu.
```

Review comment:
Please declare variables where they are used. Improved locality improves code readability.
**File:** modules/imgproc/src/stackblur.cpp
**Change Type:** added
**Context:** PR #20379: Add StackBlur for imgproc

**Code Changes:**
```diff
@@ -0,0 +1,1261 @@
+// 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.
+
+/*
+StackBlur - a fast almost Gaussian Blur
+Theory: http://underdestruction.com/2004/02/25/stackblur-2004
+The code has been borrowed from (https://github.com/flozz/StackBlur)
+and adapted for OpenCV by Zihao Mu.
```

Review comment:
Don't use manual pointers handling. Use: ``` const uchar* src_ptr = src.ptr<uchar>(row); ```