nareshmlx/opencv-pr huggingface dataset:
**File:** modules/dnn/src/layers/scale_layer.cpp
**Change Type:** modified
**Context:** PR #16575: Support FlowNet2 model - **Merge with extra:** opencv/opencv_extra#708 relates #16319 Supported layers: - [x] DataAugmentation (1 input, 3 ...

**Code Changes:**
```diff
@@ -296,5 +296,118 @@ Ptr<Layer> ShiftLayer::create(const LayerParams& params)
     return Ptr<ScaleLayer>(new ScaleLayerImpl(scaleParams));
 }
 
+class DataAugmentationLayerImpl CV_FINAL : public DataAugmentationLayer
+{
+public:
+    DataAugmentationLayerImpl(const LayerParams& params)
+    {
+        setParamsFrom(params);
```

Review comment:
I think we don't need to override that now: https://github.com/opencv/opencv/blob/3d14dd4e3953aa7b7e2ab3a388ca7bf08fe99d99/modules/dnn/src/dnn.cpp#L4340-L4343
**File:** modules/dnn/src/layers/scale_layer.cpp
**Change Type:** modified
**Context:** PR #16575: Support FlowNet2 model - **Merge with extra:** opencv/opencv_extra#708 relates #16319 Supported layers: - [x] DataAugmentation (1 input, 3 ...
**Review Line:** 339

**Code Changes:**
```diff
+
+        float* inpData = inputs[0].ptr<float>();
+        float* outData = outputs[0].ptr<float>();
+
+        Mat data_mean_cpu = blobs[1].clone();
+        Mat data_mean_per_channel_cpu = blobs[2].clone();
+
+        const int numWeights = data_mean_cpu.total();
+        CV_Assert(numWeights != 0);
+
+        ++num_iter;
```

Review comment:
I believe they should be shared among forward iterations. So we need to initialize them in `finalize` step
**File:** modules/dnn/src/layers/correlation_layer.cpp
**Change Type:** added
**Context:** PR #16575: Support FlowNet2 model - **Merge with extra:** opencv/opencv_extra#708 relates #16319 Supported layers: - [x] DataAugmentation (1 input, 3 ...

**Code Changes:**
```diff
@@ -0,0 +1,207 @@
+// 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.
+
+// Copyright (C) 2020, Intel Corporation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+
+#include "../precomp.hpp"
+#include "layers_common.hpp"
```

Review comment:
Please request these blobs through `internals` to enable memory reusing.
**File:** modules/dnn/src/caffe/caffe_importer.cpp
**Change Type:** modified
**Context:** PR #16575: Support FlowNet2 model - **Merge with extra:** opencv/opencv_extra#708 relates #16319 Supported layers: - [x] DataAugmentation (1 input, 3 ...

**Code Changes:**
```diff
@@ -465,6 +465,35 @@ class CaffeImporter
                 net.mutable_layer(li)->mutable_bottom()->RemoveLast();
                 type = "Eltwise";
             }
+            else if (type == "Resample")
+            {
+                CV_Assert(layer.bottom_size() == 1 || layer.bottom_size() == 2);
+                type = "Resize";
+                String interp = layerParams.get<String>("type").toLowerCase();
+                layerParams.set("interpolation", interp == "linear" ? "bilinear" : interp);
```

Review comment:
Does it have names of "top"?
**File:** modules/dnn/src/layers/flow_warp_layer.cpp
**Change Type:** added
**Context:** PR #16575: Support FlowNet2 model - **Merge with extra:** opencv/opencv_extra#708 relates #16319 Supported layers: - [x] DataAugmentation (1 input, 3 ...
**Review Line:** 95

**Code Changes:**
```diff
+                            float BR = image_data[off + c * area + iy2_B * out_w + ix2_R];
+
+                            out_data[off + c * area + y * out_w + x] = (1 - alpha) * (1 - beta) * TL +
+                                                                       (1 - alpha) * beta       * BL +
+                                                                        alpha      * (1 - beta) * TR +
+                                                                        alpha      * beta       * BR;
+                        }
+                    }
+                    else
+                    {
+                        for (int c = 0; c < out_c; c++)
```

Review comment:
Can we use `warpAffine` instead?
**File:** modules/dnn/src/layers/accum_layer.cpp
**Change Type:** added
**Context:** PR #16575: Support FlowNet2 model - **Merge with extra:** opencv/opencv_extra#708 relates #16319 Supported layers: - [x] DataAugmentation (1 input, 3 ...
**Review Line:** 23

**Code Changes:**
```diff
+    {
+        setParamsFrom(params);
+        top_height = params.get<int>("top_height", 0);
+        top_width = params.get<int>("top_width", 0);
+        divisor = params.get<int>("size_divisible_by", 0);
+        have_reference = params.get<String>("have_reference", "false") == "true";
+    }
+
+    virtual bool getMemoryShapes(const std::vector<MatShape> &inputs,
+                                 const int requiredOutputs,
+                                 std::vector<MatShape> &outputs,
```

Review comment:
Do we have `.get<bool>()`?
**File:** modules/dnn/src/layers/accum_layer.cpp
**Change Type:** added
**Context:** PR #16575: Support FlowNet2 model - **Merge with extra:** opencv/opencv_extra#708 relates #16319 Supported layers: - [x] DataAugmentation (1 input, 3 ...

**Code Changes:**
```diff
@@ -0,0 +1,141 @@
+// 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.
+
+// Copyright (C) 2020, Intel Corporation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+
+#include "../precomp.hpp"
+#include "layers_common.hpp"
```

Review comment:
It is better to avoid manual pointer arithmetic. Use `Mat::ptr()` instead.
**File:** modules/dnn/src/layers/accum_layer.cpp
**Change Type:** added
**Context:** PR #16575: Support FlowNet2 model - **Merge with extra:** opencv/opencv_extra#708 relates #16319 Supported layers: - [x] DataAugmentation (1 input, 3 ...
**Review Line:** 23

**Code Changes:**
```diff
+    {
+        setParamsFrom(params);
+        top_height = params.get<int>("top_height", 0);
+        top_width = params.get<int>("top_width", 0);
+        divisor = params.get<int>("size_divisible_by", 0);
+        have_reference = params.get<String>("have_reference", "false") == "true";
+    }
+
+    virtual bool getMemoryShapes(const std::vector<MatShape> &inputs,
+                                 const int requiredOutputs,
+                                 std::vector<MatShape> &outputs,
```

Review comment:
Yes, we have, but missing params in opencv-caffe.proto represents as string. We don't add Accum params to proto.
**File:** modules/dnn/src/layers/accum_layer.cpp
**Change Type:** added
**Context:** PR #16575: Support FlowNet2 model - **Merge with extra:** opencv/opencv_extra#708 relates #16319 Supported layers: - [x] DataAugmentation (1 input, 3 ...

**Code Changes:**
```diff
@@ -0,0 +1,141 @@
+// 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.
+
+// Copyright (C) 2020, Intel Corporation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+
+#include "../precomp.hpp"
+#include "layers_common.hpp"
```

Review comment:
Implementation looks very similar to one we have in resize_layer. Can we inherit this class from there?
**File:** modules/dnn/include/opencv2/dnn/all_layers.hpp
**Change Type:** modified
**Context:** PR #16575: Support FlowNet2 model - **Merge with extra:** opencv/opencv_extra#708 relates #16319 Supported layers: - [x] DataAugmentation (1 input, 3 ...
**Review Line:** 569

**Code Changes:**
```diff
+
+    class CV_EXPORTS CorrelationLayer : public Layer
+    {
+    public:
+        static Ptr<CorrelationLayer> create(const LayerParams& params);
+    };
+
+    class CV_EXPORTS AccumLayer : public Layer
+    {
+    public:
+        static Ptr<AccumLayer> create(const LayerParams& params);
```

Review comment:
With a patch from https://github.com/opencv/opencv/pull/16840 do we still need CorrelationLayer?
**File:** modules/dnn/include/opencv2/dnn/all_layers.hpp
**Change Type:** modified
**Context:** PR #16575: Support FlowNet2 model - **Merge with extra:** opencv/opencv_extra#708 relates #16319 Supported layers: - [x] DataAugmentation (1 input, 3 ...
**Review Line:** 569

**Code Changes:**
```diff
+
+    class CV_EXPORTS CorrelationLayer : public Layer
+    {
+    public:
+        static Ptr<CorrelationLayer> create(const LayerParams& params);
+    };
+
+    class CV_EXPORTS AccumLayer : public Layer
+    {
+    public:
+        static Ptr<AccumLayer> create(const LayerParams& params);
```

Review comment:
Yes, we need it.CorrelationLayer from ONNX (CP-VTON model) needed MatMul inputs (#16840), but CorrelationLayer from Caffe based on another logic.
**File:** modules/dnn/src/layers/resize_layer.cpp
**Change Type:** modified
**Context:** PR #16575: Support FlowNet2 model - **Merge with extra:** opencv/opencv_extra#708 relates #16319 Supported layers: - [x] DataAugmentation (1 input, 3 ...

**Code Changes:**
```diff
@@ -19,8 +19,8 @@ namespace cv { namespace dnn {
 class ResizeLayerImpl : public ResizeLayer
 {
 public:
-    ResizeLayerImpl(const LayerParams& params) : zoomFactorWidth(params.get<int>("zoom_factor_x", params.get<int>("zoom_factor", 0))),
-                                                 zoomFactorHeight(params.get<int>("zoom_factor_y", params.get<int>("zoom_factor", 0))),
+    ResizeLayerImpl(const LayerParams& params) : zoomFactorWidth(params.get<float>("zoom_factor_x", params.get<float>("zoom_factor", 0))),
+                                                 zoomFactorHeight(params.get<float>("zoom_factor_y", params.get<float>("zoom_factor", 0))),
                                                  scaleWidth(0), scaleHeight(0)
     {
```

Review comment:
What's new in caffe_linear and caffe_nearest?
**File:** modules/dnn/src/layers/scale_layer.cpp
**Change Type:** modified
**Context:** PR #16575: Support FlowNet2 model - **Merge with extra:** opencv/opencv_extra#708 relates #16319 Supported layers: - [x] DataAugmentation (1 input, 3 ...

**Code Changes:**
```diff
@@ -296,5 +296,118 @@ Ptr<Layer> ShiftLayer::create(const LayerParams& params)
     return Ptr<ScaleLayer>(new ScaleLayerImpl(scaleParams));
 }
 
+class DataAugmentationLayerImpl CV_FINAL : public DataAugmentationLayer
+{
+public:
+    DataAugmentationLayerImpl(const LayerParams& params)
+    {
+        setParamsFrom(params);
```

Review comment:
Unused method?
**File:** modules/dnn/include/opencv2/dnn/all_layers.hpp
**Change Type:** modified
**Context:** PR #16575: Support FlowNet2 model - **Merge with extra:** opencv/opencv_extra#708 relates #16319 Supported layers: - [x] DataAugmentation (1 input, 3 ...
**Review Line:** 569

**Code Changes:**
```diff
+
+    class CV_EXPORTS CorrelationLayer : public Layer
+    {
+    public:
+        static Ptr<CorrelationLayer> create(const LayerParams& params);
+    };
+
+    class CV_EXPORTS AccumLayer : public Layer
+    {
+    public:
+        static Ptr<AccumLayer> create(const LayerParams& params);
```

Review comment:
Yes, sorry, just mixed with CP-VTON
**File:** modules/dnn/src/layers/resize_layer.cpp
**Change Type:** modified
**Context:** PR #16575: Support FlowNet2 model - **Merge with extra:** opencv/opencv_extra#708 relates #16319 Supported layers: - [x] DataAugmentation (1 input, 3 ...

**Code Changes:**
```diff
@@ -19,8 +19,8 @@ namespace cv { namespace dnn {
 class ResizeLayerImpl : public ResizeLayer
 {
 public:
-    ResizeLayerImpl(const LayerParams& params) : zoomFactorWidth(params.get<int>("zoom_factor_x", params.get<int>("zoom_factor", 0))),
-                                                 zoomFactorHeight(params.get<int>("zoom_factor_y", params.get<int>("zoom_factor", 0))),
+    ResizeLayerImpl(const LayerParams& params) : zoomFactorWidth(params.get<float>("zoom_factor_x", params.get<float>("zoom_factor", 0))),
+                                                 zoomFactorHeight(params.get<float>("zoom_factor_y", params.get<float>("zoom_factor", 0))),
                                                  scaleWidth(0), scaleHeight(0)
     {
```

Review comment:
Why they are not supported?
**File:** modules/dnn/src/layers/resize_layer.cpp
**Change Type:** modified
**Context:** PR #16575: Support FlowNet2 model - **Merge with extra:** opencv/opencv_extra#708 relates #16319 Supported layers: - [x] DataAugmentation (1 input, 3 ...

**Code Changes:**
```diff
@@ -19,8 +19,8 @@ namespace cv { namespace dnn {
 class ResizeLayerImpl : public ResizeLayer
 {
 public:
-    ResizeLayerImpl(const LayerParams& params) : zoomFactorWidth(params.get<int>("zoom_factor_x", params.get<int>("zoom_factor", 0))),
-                                                 zoomFactorHeight(params.get<int>("zoom_factor_y", params.get<int>("zoom_factor", 0))),
+    ResizeLayerImpl(const LayerParams& params) : zoomFactorWidth(params.get<float>("zoom_factor_x", params.get<float>("zoom_factor", 0))),
+                                                 zoomFactorHeight(params.get<float>("zoom_factor_y", params.get<float>("zoom_factor", 0))),
                                                  scaleWidth(0), scaleHeight(0)
     {
```

Review comment:
Caffe result with these factors is not equal to OpenCV resize
**File:** modules/dnn/src/layers/resize_layer.cpp
**Change Type:** modified
**Context:** PR #16575: Support FlowNet2 model - **Merge with extra:** opencv/opencv_extra#708 relates #16319 Supported layers: - [x] DataAugmentation (1 input, 3 ...
**Review Line:** 49

**Code Changes:**
```diff
                          std::vector<MatShape> &outputs,
                          std::vector<MatShape> &internals) const CV_OVERRIDE
     {
-        CV_Assert_N(inputs.size() == 1, inputs[0].size() == 4);
+        CV_Assert_N(inputs.size() == 1 || inputs.size() == 2, inputs[0].size() == 4);
         outputs.resize(1, inputs[0]);
-        outputs[0][2] = zoomFactorHeight > 0 ? (outputs[0][2] * zoomFactorHeight) : outHeight;
-        outputs[0][3] = zoomFactorWidth > 0 ? (outputs[0][3] * zoomFactorWidth) : outWidth;
+        if (inputs.size() == 1) {
+            outputs[0][2] = zoomFactorHeight > 0 ? (outputs[0][2] * zoomFactorHeight) : outHeight;
+            outputs[0][3] = zoomFactorWidth > 0 ? (outputs[0][3] * zoomFactorWidth) : outWidth;
```

Review comment:
Maybe let's move it under `if` but instead of ``` outputs[0][2] = inputs[1][2]; outputs[0][3] = inputs[1][3]; ``` do ``` outputs.resize(1, inputs[1]); ```
**File:** samples/dnn/optical_flow.py
**Change Type:** added
**Context:** PR #16575: Support FlowNet2 model - **Merge with extra:** opencv/opencv_extra#708 relates #16319 Supported layers: - [x] DataAugmentation (1 input, 3 ...

**Code Changes:**
```diff
@@ -0,0 +1,85 @@
+#!/usr/bin/env python
+'''
+This sample using FlowNet v2 model to calculate optical flow.
+Original paper: https://arxiv.org/abs/1612.01925.
+Original repo:  https://github.com/lmb-freiburg/flownet2.
+
+Download the converted .caffemodel model from https://drive.google.com/open?id=16qvE9VNmU39NttpZwZs81Ga8VYQJDaWZ
+and .prototxt from https://drive.google.com/open?id=19bo6SWU2p8ZKvjXqMKiCPdK8mghwDy9b.
+Otherwise download original model from https://lmb.informatik.uni-freiburg.de/resources/binaries/flownet2/flownet2-models.tar.gz,
```

Review comment:
How many `ChannelNorm` layers inside? Maybe it make sense to put modified `.prototxt` to opencv_extra?
**File:** samples/dnn/optical_flow.py
**Change Type:** added
**Context:** PR #16575: Support FlowNet2 model - **Merge with extra:** opencv/opencv_extra#708 relates #16319 Supported layers: - [x] DataAugmentation (1 input, 3 ...

**Code Changes:**
```diff
@@ -0,0 +1,85 @@
+#!/usr/bin/env python
+'''
+This sample using FlowNet v2 model to calculate optical flow.
+Original paper: https://arxiv.org/abs/1612.01925.
+Original repo:  https://github.com/lmb-freiburg/flownet2.
+
+Download the converted .caffemodel model from https://drive.google.com/open?id=16qvE9VNmU39NttpZwZs81Ga8VYQJDaWZ
+and .prototxt from https://drive.google.com/open?id=19bo6SWU2p8ZKvjXqMKiCPdK8mghwDy9b.
+Otherwise download original model from https://lmb.informatik.uni-freiburg.de/resources/binaries/flownet2/flownet2-models.tar.gz,
```

Review comment:
Why no WINDOW_NORMAL?
**File:** samples/dnn/optical_flow.py
**Change Type:** added
**Context:** PR #16575: Support FlowNet2 model - **Merge with extra:** opencv/opencv_extra#708 relates #16319 Supported layers: - [x] DataAugmentation (1 input, 3 ...

**Code Changes:**
```diff
@@ -0,0 +1,85 @@
+#!/usr/bin/env python
+'''
+This sample using FlowNet v2 model to calculate optical flow.
+Original paper: https://arxiv.org/abs/1612.01925.
+Original repo:  https://github.com/lmb-freiburg/flownet2.
+
+Download the converted .caffemodel model from https://drive.google.com/open?id=16qvE9VNmU39NttpZwZs81Ga8VYQJDaWZ
+and .prototxt from https://drive.google.com/open?id=19bo6SWU2p8ZKvjXqMKiCPdK8mghwDy9b.
+Otherwise download original model from https://lmb.informatik.uni-freiburg.de/resources/binaries/flownet2/flownet2-models.tar.gz,
```

Review comment:
```python inp0 = cv.dnn.blobFromImage(first_img, size=(self.width, self.height)) ```
**File:** samples/dnn/optical_flow.py
**Change Type:** added
**Context:** PR #16575: Support FlowNet2 model - **Merge with extra:** opencv/opencv_extra#708 relates #16319 Supported layers: - [x] DataAugmentation (1 input, 3 ...

**Code Changes:**
```diff
@@ -0,0 +1,85 @@
+#!/usr/bin/env python
+'''
+This sample using FlowNet v2 model to calculate optical flow.
+Original paper: https://arxiv.org/abs/1612.01925.
+Original repo:  https://github.com/lmb-freiburg/flownet2.
+
+Download the converted .caffemodel model from https://drive.google.com/open?id=16qvE9VNmU39NttpZwZs81Ga8VYQJDaWZ
+and .prototxt from https://drive.google.com/open?id=19bo6SWU2p8ZKvjXqMKiCPdK8mghwDy9b.
+Otherwise download original model from https://lmb.informatik.uni-freiburg.de/resources/binaries/flownet2/flownet2-models.tar.gz,
```

Review comment:
`COLOR_HSV2BGR`?
**File:** modules/dnn/src/layers/resize_layer.cpp
**Change Type:** modified
**Context:** PR #16575: Support FlowNet2 model - **Merge with extra:** opencv/opencv_extra#708 relates #16319 Supported layers: - [x] DataAugmentation (1 input, 3 ...
**Review Line:** 49

**Code Changes:**
```diff
                          std::vector<MatShape> &outputs,
                          std::vector<MatShape> &internals) const CV_OVERRIDE
     {
-        CV_Assert_N(inputs.size() == 1, inputs[0].size() == 4);
+        CV_Assert_N(inputs.size() == 1 || inputs.size() == 2, inputs[0].size() == 4);
         outputs.resize(1, inputs[0]);
-        outputs[0][2] = zoomFactorHeight > 0 ? (outputs[0][2] * zoomFactorHeight) : outHeight;
-        outputs[0][3] = zoomFactorWidth > 0 ? (outputs[0][3] * zoomFactorWidth) : outWidth;
+        if (inputs.size() == 1) {
+            outputs[0][2] = zoomFactorHeight > 0 ? (outputs[0][2] * zoomFactorHeight) : outHeight;
+            outputs[0][3] = zoomFactorWidth > 0 ? (outputs[0][3] * zoomFactorWidth) : outWidth;
```

Review comment:
`output[0][1] = inputs[0][1] != inputs[1][1] `
**File:** samples/dnn/optical_flow.py
**Change Type:** added
**Context:** PR #16575: Support FlowNet2 model - **Merge with extra:** opencv/opencv_extra#708 relates #16319 Supported layers: - [x] DataAugmentation (1 input, 3 ...

**Code Changes:**
```diff
@@ -0,0 +1,85 @@
+#!/usr/bin/env python
+'''
+This sample using FlowNet v2 model to calculate optical flow.
+Original paper: https://arxiv.org/abs/1612.01925.
+Original repo:  https://github.com/lmb-freiburg/flownet2.
+
+Download the converted .caffemodel model from https://drive.google.com/open?id=16qvE9VNmU39NttpZwZs81Ga8VYQJDaWZ
+and .prototxt from https://drive.google.com/open?id=19bo6SWU2p8ZKvjXqMKiCPdK8mghwDy9b.
+Otherwise download original model from https://lmb.informatik.uni-freiburg.de/resources/binaries/flownet2/flownet2-models.tar.gz,
```

Review comment:
I put modified .prototxt and .caffemodel to cloud.
**File:** samples/dnn/optical_flow.py
**Change Type:** added
**Context:** PR #16575: Support FlowNet2 model - **Merge with extra:** opencv/opencv_extra#708 relates #16319 Supported layers: - [x] DataAugmentation (1 input, 3 ...

**Code Changes:**
```diff
@@ -0,0 +1,85 @@
+#!/usr/bin/env python
+'''
+This sample using FlowNet v2 model to calculate optical flow.
+Original paper: https://arxiv.org/abs/1612.01925.
+Original repo:  https://github.com/lmb-freiburg/flownet2.
+
+Download the converted .caffemodel model from https://drive.google.com/open?id=16qvE9VNmU39NttpZwZs81Ga8VYQJDaWZ
+and .prototxt from https://drive.google.com/open?id=19bo6SWU2p8ZKvjXqMKiCPdK8mghwDy9b.
+Otherwise download original model from https://lmb.informatik.uni-freiburg.de/resources/binaries/flownet2/flownet2-models.tar.gz,
```

Review comment:
Please rephrase so user can understand which are required steps and that are optional. Otherwise one can download .caffemodel then "To get original model". I'd like to put everything in one place and say "Download this and that. Otherwise download original model from here". Changes required in prototxt file I'd like to recommend to write right in the prototxt file as a reference to origin prototxt file.
**File:** modules/dnn/src/layers/resize_layer.cpp
**Change Type:** modified
**Context:** PR #16575: Support FlowNet2 model - **Merge with extra:** opencv/opencv_extra#708 relates #16319 Supported layers: - [x] DataAugmentation (1 input, 3 ...

**Code Changes:**
```diff
@@ -19,8 +19,8 @@ namespace cv { namespace dnn {
 class ResizeLayerImpl : public ResizeLayer
 {
 public:
-    ResizeLayerImpl(const LayerParams& params) : zoomFactorWidth(params.get<int>("zoom_factor_x", params.get<int>("zoom_factor", 0))),
-                                                 zoomFactorHeight(params.get<int>("zoom_factor_y", params.get<int>("zoom_factor", 0))),
+    ResizeLayerImpl(const LayerParams& params) : zoomFactorWidth(params.get<float>("zoom_factor_x", params.get<float>("zoom_factor", 0))),
+                                                 zoomFactorHeight(params.get<float>("zoom_factor_y", params.get<float>("zoom_factor", 0))),
                                                  scaleWidth(0), scaleHeight(0)
     {
```

Review comment:
Please avoid extra new lines adding/removing
**File:** modules/java/generator/src/java/org/opencv/utils/Converters.java
**Change Type:** modified
**Context:** PR #17248: Prefer addAll instead of iteration for performance

**Code Changes:**
```diff
@@ -519,8 +519,7 @@ public static Mat vector_vector_Point_to_Mat(List<MatOfPoint> pts, List<Mat> mat
         Mat res;
         int lCount = (pts != null) ? pts.size() : 0;
         if (lCount > 0) {
-            for (MatOfPoint vpt : pts)
-                mats.add(vpt);
+            mats.addAll(pts);
             res = vector_Mat_to_Mat(mats);
         } else {
             res = new Mat();
```

Review comment:
Yes I publish a fix.
**File:** platforms/linux/riscv.toolchain.cmake
**Change Type:** added
**Context:** PR #17145: Added initial version of cmake toolchain for RISC-V architecture

**Code Changes:**
```diff
@@ -0,0 +1,62 @@
+cmake_minimum_required(VERSION 2.8)
+
+if(COMMAND toolchain_save_config)
+  return() # prevent recursive call
+endif()
+
+set(CMAKE_SYSTEM_NAME Linux)
+set(CMAKE_SYSTEM_VERSION 1)
+
```

Review comment:
Looks like these "set" lines have wrong effect (especially with "if" combination).
**File:** modules/calib3d/src/fisheye.cpp
**Change Type:** added
**Context:** PR #2726: Fisheye camera model for calibration and stereo rectification. - Added Fisheye camera model for calibration and stereo rectification. TestDa...
**Review Line:** 44

**Code Changes:**
```diff
+// the use of this software, even if advised of the possibility of such damage.
+//
+//M*/
+
+#include "precomp.hpp"
+#include "fisheye.hpp"
+
+namespace cv { namespace
+{
+    struct JacobianRow
+    {
```

Review comment:
every opencv source file should start with the license; then, the first #include should be precomp.hpp, otherwise precompiled headers on Windows will not work