nareshmlx/opencv-pr huggingface dataset:
**File:** modules/ts/include/opencv2/ts/ocl_test.hpp
**Change Type:** modified
**Context:** PR #11315: ARM: add new comparison to tolerate with rounding error - * clean up the source code * remove unused variable (eps) * remove unused member ...

**Code Changes:**
```diff
@@ -122,6 +122,25 @@ do \
     << "Size: " << mat1.size() << std::endl; \
 } while ((void)0, 0)
 
+#define OCL_EXPECT_MAT_N_DIFF(name, eps) \
+do \
+{ \
+    ASSERT_EQ(name ## _roi.type(), u ## name ## _roi.type()); \
+    ASSERT_EQ(name ## _roi.size(), u ## name ## _roi.size()); \
+    Mat diff, binary, binary_8; \
```

Review comment:
Right, now I'm on the same page. I'll add another ```EXPECT_LE``` just to check the border. This time by comparing with ``` (int)((binary.cols + binary.rows)/100) ``` or something similar
**File:** modules/ts/include/opencv2/ts/ocl_test.hpp
**Change Type:** modified
**Context:** PR #11315: ARM: add new comparison to tolerate with rounding error - * clean up the source code * remove unused variable (eps) * remove unused member ...

**Code Changes:**
```diff
@@ -122,6 +122,25 @@ do \
     << "Size: " << mat1.size() << std::endl; \
 } while ((void)0, 0)
 
+#define OCL_EXPECT_MAT_N_DIFF(name, eps) \
+do \
+{ \
+    ASSERT_EQ(name ## _roi.type(), u ## name ## _roi.type()); \
+    ASSERT_EQ(name ## _roi.size(), u ## name ## _roi.size()); \
+    Mat diff, binary, binary_8; \
```

Review comment:
``` Mat mask(diff.size(), CV_8UC1, cv::Scallar::all(255)); if (mask.cols > 2 && mask.rows > 2) mask(cv::Rect(1, 1, mask.cols - 2, mask.rows - 2)).setTo(0); ```
**File:** modules/imgcodecs/src/grfmt_tiff.cpp
**Change Type:** modified
**Context:** PR #11231: Support for setting TIFF DPI info in imwrite -  ### This pullrequest completes PR #10669, a feature request initiated by user chrisestesaa0...
**Review Line:** 824

**Code Changes:**
```diff
     for (size_t page = 0; page < img_vec.size(); page++)
@@ -817,6 +821,16 @@ bool TiffEncoder::writeLibTiff( const std::vector<Mat>& img_vec, const std::vect
             return false;
         }
 
+        if (((resUnit >= RESUNIT_NONE && resUnit <= RESUNIT_CENTIMETER) && !TIFFSetField(pTiffHandle, TIFFTAG_RESOLUTIONUNIT, resUnit))
+            || (dpiX >= 0 && !TIFFSetField(pTiffHandle, TIFFTAG_XRESOLUTION, (float)dpiX))
+            || (dpiY >= 0 && !TIFFSetField(pTiffHandle, TIFFTAG_YRESOLUTION, (float)dpiY))
+            )
+        {
+            TIFFClose(pTiffHandle);
```

Review comment:
`RESUNIT_NONE` and `RESUNIT_CENTIMETER` are defined in the libtiff dev header. Caller of imwrite can use those constants as flags to `imwrite` to specify legal values of resolution units.
**File:** modules/core/include/opencv2/core/check.hpp
**Change Type:** added
**Context:** PR #10978: core: add "check" macros - Proposal basics only without massive code changes. <cut> <details> <summary>Proposal details</summary> * Name: C...

**Code Changes:**
```diff
@@ -0,0 +1,135 @@
+// 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.
+
+#ifndef OPENCV_CORE_CHECK_HPP
+#define OPENCV_CORE_CHECK_HPP
+
+#include <opencv2/core/base.hpp>
+
```

Review comment:
do we really need 2 functions? Probably, the function shall be renamed to "depthToString()". I would retain only the first function, and let it return `<invalid depth>` instead of `CV_InvalidDepth`, becase the latter is not a valid macro or whatever
**File:** modules/core/include/opencv2/core/check.hpp
**Change Type:** added
**Context:** PR #10978: core: add "check" macros - Proposal basics only without massive code changes. <cut> <details> <summary>Proposal details</summary> * Name: C...

**Code Changes:**
```diff
@@ -0,0 +1,135 @@
+// 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.
+
+#ifndef OPENCV_CORE_CHECK_HPP
+#define OPENCV_CORE_CHECK_HPP
+
+#include <opencv2/core/base.hpp>
+
```

Review comment:
drop `cv::` rename `getMatType` to `typeToString()`? same question about 2 functions
**File:** modules/core/include/opencv2/core/check.hpp
**Change Type:** added
**Context:** PR #10978: core: add "check" macros - Proposal basics only without massive code changes. <cut> <details> <summary>Proposal details</summary> * Name: C...

**Code Changes:**
```diff
@@ -0,0 +1,135 @@
+// 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.
+
+#ifndef OPENCV_CORE_CHECK_HPP
+#define OPENCV_CORE_CHECK_HPP
+
+#include <opencv2/core/base.hpp>
+
```

Review comment:
why not hide CheckContext and let the `check_failed_*` functions to form it internally? This way we get rid of unnecessary restrictions, such as just 2 arguments in the check etc. Besides, the `do {} while (0)` trick won't be required because the else branch becomes just one function call
**File:** modules/core/include/opencv2/core/check.hpp
**Change Type:** added
**Context:** PR #10978: core: add "check" macros - Proposal basics only without massive code changes. <cut> <details> <summary>Proposal details</summary> * Name: C...

**Code Changes:**
```diff
@@ -0,0 +1,135 @@
+// 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.
+
+#ifndef OPENCV_CORE_CHECK_HPP
+#define OPENCV_CORE_CHECK_HPP
+
+#include <opencv2/core/base.hpp>
+
```

Review comment:
`EQ` is erroneously copied several times
**File:** modules/core/include/opencv2/core/check.hpp
**Change Type:** added
**Context:** PR #10978: core: add "check" macros - Proposal basics only without massive code changes. <cut> <details> <summary>Proposal details</summary> * Name: C...

**Code Changes:**
```diff
@@ -0,0 +1,135 @@
+// 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.
+
+#ifndef OPENCV_CORE_CHECK_HPP
+#define OPENCV_CORE_CHECK_HPP
+
+#include <opencv2/core/base.hpp>
+
```

Review comment:
I would drop `Mat` from the name.
**File:** modules/core/include/opencv2/core/check.hpp
**Change Type:** added
**Context:** PR #10978: core: add "check" macros - Proposal basics only without massive code changes. <cut> <details> <summary>Proposal details</summary> * Name: C...

**Code Changes:**
```diff
@@ -0,0 +1,135 @@
+// 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.
+
+#ifndef OPENCV_CORE_CHECK_HPP
+#define OPENCV_CORE_CHECK_HPP
+
+#include <opencv2/core/base.hpp>
+
```

Review comment:
drop `Mat` from the name?
**File:** modules/core/include/opencv2/core/check.hpp
**Change Type:** added
**Context:** PR #10978: core: add "check" macros - Proposal basics only without massive code changes. <cut> <details> <summary>Proposal details</summary> * Name: C...

**Code Changes:**
```diff
@@ -0,0 +1,135 @@
+// 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.
+
+#ifndef OPENCV_CORE_CHECK_HPP
+#define OPENCV_CORE_CHECK_HPP
+
+#include <opencv2/core/base.hpp>
+
```

Review comment:
Renamed. First one function is moved into `cv::` namespace. Second stays in `cv::detail::`. Error string is changed to `<invalid depth>`. BTW, I would like to avoid angle brackets in messages, because many OpenCV users just copy-paste such messages into GitHub/other markdown editors "as is". Example: it is here "<invalid depth>" <== (really here, try to edit this comment) > Quote example: it is here "<invalid depth>" <== (really here, try to edit this comment) ``` Code block example: it is here "<invalid depth>" <== (really here, try to edit this comment) ``` BTW, Adding extra "spaces" allows to hack markdown editors: "< invalid depth >"
**File:** modules/core/include/opencv2/core/check.hpp
**Change Type:** added
**Context:** PR #10978: core: add "check" macros - Proposal basics only without massive code changes. <cut> <details> <summary>Proposal details</summary> * Name: C...

**Code Changes:**
```diff
@@ -0,0 +1,135 @@
+// 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.
+
+#ifndef OPENCV_CORE_CHECK_HPP
+#define OPENCV_CORE_CHECK_HPP
+
+#include <opencv2/core/base.hpp>
+
```

Review comment:
The main reason of adding of `CheckContext` is significantly reduce the size of generated code. This struct is "static const", so we don't need to fill it in in the code directly, compiler places them into "const data" segment. Instead of passing 5-9 arguments to error reporting functions we need pass 2-3 args only. The similar way is used in OpenCV tracer (`LocationStaticStorage`). 2 arguments should be enough for the most part of cases. Also it handles custom value checks (second "argument" is used to describe failed condition - instead of the name of the second value). `do {} while(0)` get fixed (must wrap whole macro).
**File:** modules/core/include/opencv2/core/check.hpp
**Change Type:** added
**Context:** PR #10978: core: add "check" macros - Proposal basics only without massive code changes. <cut> <details> <summary>Proposal details</summary> * Name: C...

**Code Changes:**
```diff
@@ -0,0 +1,135 @@
+// 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.
+
+#ifndef OPENCV_CORE_CHECK_HPP
+#define OPENCV_CORE_CHECK_HPP
+
+#include <opencv2/core/base.hpp>
+
```

Review comment:
Dropped `Mat` from macros names
**File:** modules/photo/src/seamless_cloning.cpp
**Change Type:** modified
**Context:** PR #11208: Fixed mask reduction in seamless_clone - resolves #10627 ### This pullrequest changes Fixed mask reduction in seamless_clone. Renamed a few...

**Code Changes:**
```diff
@@ -75,26 +75,26 @@ void cv::seamlessClone(InputArray _src, InputArray _dst, InputArray _mask, Point
         {
             if(gray.at<uchar>(i,j) == 255)
             {
-                minx = std::min(minx,i);
-                maxx = std::max(maxx,i);
-                miny = std::min(miny,j);
-                maxy = std::max(maxy,j);
+                miny = std::min(miny,i);
+                maxy = std::max(maxy,i);
```

Review comment:
Parameters order doesn't look correct: > static MatExpr zeros(int rows, int cols, int type);
**File:** modules/ml/test/test_mltests2.cpp
**Change Type:** modified
**Context:** PR #10213: Simulated Annealing for ANN_MLP training method - **Merge with extra**: https://github.com/opencv/opencv_extra/pull/412 Add a trainning met...

**Code Changes:**
```diff
@@ -79,8 +79,10 @@ int str_to_ann_train_method( String& str )
 {
     if( !str.compare("BACKPROP") )
         return ANN_MLP::BACKPROP;
-    if( !str.compare("RPROP") )
+    if (!str.compare("RPROP"))
         return ANN_MLP::RPROP;
+    if (!str.compare("ANNEAL"))
+        return ANN_MLP::ANNEAL;
     CV_Error( CV_StsBadArg, "incorrect ann train method string" );
```

Review comment:
Consider to use ``` EXPECT_LT(n, FLT_EPSILON) << ... ``` here and above for better error messages.
**File:** modules/ml/include/opencv2/ml.hpp
**Change Type:** modified
**Context:** PR #10213: Simulated Annealing for ANN_MLP training method - **Merge with extra**: https://github.com/opencv/opencv_extra/pull/412 Add a trainning met...

**Code Changes:**
```diff
@@ -1406,13 +1406,14 @@ class CV_EXPORTS_W ANN_MLP : public StatModel
     /** Available training methods */
     enum TrainingMethods {
         BACKPROP=0, //!< The back-propagation algorithm.
-        RPROP=1 //!< The RPROP algorithm. See @cite RPROP93 for details.
+        RPROP = 1, //!< The RPROP algorithm. See @cite RPROP93 for details.
+        ANNEAL = 2 //!< The simulated annealing algorithm. See @cite Kirkpatrick83 for details.
     };
 
     /** Sets training method and common parameters.
```

Review comment:
There is no way to alter virtual function table without breaking of library ABI interface. Try using this: ``` // .hpp file class CV_EXPORTS_W ANN_MLP : public StatModel { ... CV_WRAP double getAnnealInitialT() const = 0; // <-- no virtual; ... other new methods ... } class CV_EXPORTS_W ANN_MLP_ANNEAL : public ANN_MLP { ... new virtual methods ... } //ann_mlp.cpp double ANN_MLP::getAnnealInitialT() const { const ANN_MLP_ANNEAL* this_ = dynamic_cast<const ANN_MLP_ANNEAL*>(this); if (!this_) CV_Error(Error::StsNotImplemented, "the class is not ANN_MLP_ANNEAL"); return this_->getAnnealInitialT(); } //replace class ANN_MLPImpl : public ANN_MLP class ANN_MLPImpl : public ANN_MLP_ANNEAL ``` Also there is option without "ANN_MLP_ANNEAL" class, but "dynamic_cast" is used with "ANN_MLPImpl" directly.
**File:** modules/ml/include/opencv2/ml.hpp
**Change Type:** modified
**Context:** PR #10213: Simulated Annealing for ANN_MLP training method - **Merge with extra**: https://github.com/opencv/opencv_extra/pull/412 Add a trainning met...

**Code Changes:**
```diff
@@ -1406,13 +1406,14 @@ class CV_EXPORTS_W ANN_MLP : public StatModel
     /** Available training methods */
     enum TrainingMethods {
         BACKPROP=0, //!< The back-propagation algorithm.
-        RPROP=1 //!< The RPROP algorithm. See @cite RPROP93 for details.
+        RPROP = 1, //!< The RPROP algorithm. See @cite RPROP93 for details.
+        ANNEAL = 2 //!< The simulated annealing algorithm. See @cite Kirkpatrick83 for details.
     };
 
     /** Sets training method and common parameters.
```

Review comment:
I try and I must copy all methods in ANN_MLPImpl isn't it?
**File:** modules/ml/include/opencv2/ml.hpp
**Change Type:** modified
**Context:** PR #10213: Simulated Annealing for ANN_MLP training method - **Merge with extra**: https://github.com/opencv/opencv_extra/pull/412 Add a trainning met...

**Code Changes:**
```diff
@@ -1406,13 +1406,14 @@ class CV_EXPORTS_W ANN_MLP : public StatModel
     /** Available training methods */
     enum TrainingMethods {
         BACKPROP=0, //!< The back-propagation algorithm.
-        RPROP=1 //!< The RPROP algorithm. See @cite RPROP93 for details.
+        RPROP = 1, //!< The RPROP algorithm. See @cite RPROP93 for details.
+        ANNEAL = 2 //!< The simulated annealing algorithm. See @cite Kirkpatrick83 for details.
     };
 
     /** Sets training method and common parameters.
```

Review comment:
All **new** methods.
**File:** modules/ml/include/opencv2/ml.hpp
**Change Type:** modified
**Context:** PR #10213: Simulated Annealing for ANN_MLP training method - **Merge with extra**: https://github.com/opencv/opencv_extra/pull/412 Add a trainning met...

**Code Changes:**
```diff
@@ -1406,13 +1406,14 @@ class CV_EXPORTS_W ANN_MLP : public StatModel
     /** Available training methods */
     enum TrainingMethods {
         BACKPROP=0, //!< The back-propagation algorithm.
-        RPROP=1 //!< The RPROP algorithm. See @cite RPROP93 for details.
+        RPROP = 1, //!< The RPROP algorithm. See @cite RPROP93 for details.
+        ANNEAL = 2 //!< The simulated annealing algorithm. See @cite Kirkpatrick83 for details.
     };
 
     /** Sets training method and common parameters.
```

Review comment:
> In ann_mlp.cpp I insert Need just replace base class `ANN_MLP` => `ANN_MLP_ANNEAL` of `ANN_MLPImpl` (not `ANN_MLP_ANNEALImpl`).
**File:** modules/ml/src/ann_mlp.cpp
**Change Type:** modified
**Context:** PR #10213: Simulated Annealing for ANN_MLP training method - **Merge with extra**: https://github.com/opencv/opencv_extra/pull/412 Add a trainning met...

**Code Changes:**
```diff
@@ -42,6 +42,7 @@
 
 namespace cv { namespace ml {
 
+
 struct AnnParams
 {
     AnnParams()
@@ -51,6 +52,8 @@ struct AnnParams
         bpDWScale = bpMomentScale = 0.1;
```

Review comment:
```.diff -class ANN_MLPImpl : public ANN_MLP +class ANN_MLPImpl : public ANN_MLP_ANNEAL ```
**File:** modules/ml/include/opencv2/ml.hpp
**Change Type:** modified
**Context:** PR #10213: Simulated Annealing for ANN_MLP training method - **Merge with extra**: https://github.com/opencv/opencv_extra/pull/412 Add a trainning met...

**Code Changes:**
```diff
@@ -1406,13 +1406,14 @@ class CV_EXPORTS_W ANN_MLP : public StatModel
     /** Available training methods */
     enum TrainingMethods {
         BACKPROP=0, //!< The back-propagation algorithm.
-        RPROP=1 //!< The RPROP algorithm. See @cite RPROP93 for details.
+        RPROP = 1, //!< The RPROP algorithm. See @cite RPROP93 for details.
+        ANNEAL = 2 //!< The simulated annealing algorithm. See @cite Kirkpatrick83 for details.
     };
 
     /** Sets training method and common parameters.
```

Review comment:
Remove this `create()`. Reuse existed from ANN_MLP.
**File:** modules/ml/include/opencv2/ml.hpp
**Change Type:** modified
**Context:** PR #10213: Simulated Annealing for ANN_MLP training method - **Merge with extra**: https://github.com/opencv/opencv_extra/pull/412 Add a trainning met...
**Review Line:** 1961

**Code Changes:**
```diff
+{
+    RNG rEnergy;
+    double coolingRatio;
+    double initialT;
+    double finalT;
+    int iterPerStep;
+    Impl()
+    {
+        initialT = 2;
+        finalT = 0.1;
+        coolingRatio = 0.95;
```

Review comment:
Implementation details should be moved out from public headers. All details should be stored in `SimulatedAnnealingSolver::Impl`, which should be placed in .cpp file.
**File:** modules/ml/include/opencv2/ml.hpp
**Change Type:** modified
**Context:** PR #10213: Simulated Annealing for ANN_MLP training method - **Merge with extra**: https://github.com/opencv/opencv_extra/pull/412 Add a trainning met...

**Code Changes:**
```diff
@@ -1406,13 +1406,14 @@ class CV_EXPORTS_W ANN_MLP : public StatModel
     /** Available training methods */
     enum TrainingMethods {
         BACKPROP=0, //!< The back-propagation algorithm.
-        RPROP=1 //!< The RPROP algorithm. See @cite RPROP93 for details.
+        RPROP = 1, //!< The RPROP algorithm. See @cite RPROP93 for details.
+        ANNEAL = 2 //!< The simulated annealing algorithm. See @cite Kirkpatrick83 for details.
     };
 
     /** Sets training method and common parameters.
```

Review comment:
see comment above
**File:** modules/ml/src/ann_mlp.cpp
**Change Type:** modified
**Context:** PR #10213: Simulated Annealing for ANN_MLP training method - **Merge with extra**: https://github.com/opencv/opencv_extra/pull/412 Add a trainning met...

**Code Changes:**
```diff
@@ -42,6 +42,7 @@
 
 namespace cv { namespace ml {
 
+
 struct AnnParams
 {
     AnnParams()
@@ -51,6 +52,8 @@ struct AnnParams
         bpDWScale = bpMomentScale = 0.1;
```

Review comment:
Please avoid Indentation in namespaces.
**File:** modules/ml/src/ann_mlp.cpp
**Change Type:** modified
**Context:** PR #10213: Simulated Annealing for ANN_MLP training method - **Merge with extra**: https://github.com/opencv/opencv_extra/pull/412 Add a trainning met...

**Code Changes:**
```diff
@@ -42,6 +42,7 @@
 
 namespace cv { namespace ml {
 
+
 struct AnnParams
 {
     AnnParams()
@@ -51,6 +52,8 @@ struct AnnParams
         bpDWScale = bpMomentScale = 0.1;
```

Review comment:
class ANN_MLPImpl : public ANN_MLP_ANNEAL error C2259 cannot instantiate abstract class
**File:** modules/ml/include/opencv2/ml.hpp
**Change Type:** modified
**Context:** PR #10213: Simulated Annealing for ANN_MLP training method - **Merge with extra**: https://github.com/opencv/opencv_extra/pull/412 Add a trainning met...

**Code Changes:**
```diff
@@ -1406,13 +1406,14 @@ class CV_EXPORTS_W ANN_MLP : public StatModel
     /** Available training methods */
     enum TrainingMethods {
         BACKPROP=0, //!< The back-propagation algorithm.
-        RPROP=1 //!< The RPROP algorithm. See @cite RPROP93 for details.
+        RPROP = 1, //!< The RPROP algorithm. See @cite RPROP93 for details.
+        ANNEAL = 2 //!< The simulated annealing algorithm. See @cite Kirkpatrick83 for details.
     };
 
     /** Sets training method and common parameters.
```

Review comment:
Because you should not use `=0` here. You should provide implementations for these methods in .cpp file.
**File:** modules/ml/src/ann_mlp.cpp
**Change Type:** modified
**Context:** PR #10213: Simulated Annealing for ANN_MLP training method - **Merge with extra**: https://github.com/opencv/opencv_extra/pull/412 Add a trainning met...

**Code Changes:**
```diff
@@ -42,6 +42,7 @@
 
 namespace cv { namespace ml {
 
+
 struct AnnParams
 {
     AnnParams()
@@ -51,6 +52,8 @@ struct AnnParams
         bpDWScale = bpMomentScale = 0.1;
```

Review comment:
This is not need as separate class. Merge this contents into ANN_MLPImpl. - revert "=0" change in .hpp file (but keep "const" fix). - remove these new calls with dynamic_cast: `double ANN_MLP_ANNEAL::getAnnealInitialT() const`
**File:** modules/photo/src/contrast_preserve.hpp
**Change Type:** modified
**Context:** PR #10997: Optimize decolor in photo - ### This pullrequest changes - Replaced `vector.push_back` into `vector.resize()` and `vector[i] = foo;` to imp...

**Code Changes:**
```diff
@@ -58,19 +58,19 @@ class Decolor
     public:
         float sigma;
         void init();
-        vector<double> product(vector < vector<int> > &comb, vector <double> &initRGB);
+        vector<double> product(vector <Vec3i> &comb, const double initRGB[3]);
         double energyCalcu(vector <double> &Cg, vector < vector <double> > &polyGrad, vector <double> &wei);
         void singleChannelGradx(const Mat &img, Mat& dest);
         void singleChannelGrady(const Mat &img, Mat& dest);
         void gradvector(const Mat &img, vector <double> &grad);
```

Review comment:
> Mat rgb_channel[3]; This change is dangerous. There is no checks number of channels in this function. RGBA/BGRA image will corrupt memory. Also this change has minimal effect on performance. The same note for other similar changes.
**File:** modules/photo/src/contrast_preserve.hpp
**Change Type:** modified
**Context:** PR #10997: Optimize decolor in photo - ### This pullrequest changes - Replaced `vector.push_back` into `vector.resize()` and `vector[i] = foo;` to imp...

**Code Changes:**
```diff
@@ -58,19 +58,19 @@ class Decolor
     public:
         float sigma;
         void init();
-        vector<double> product(vector < vector<int> > &comb, vector <double> &initRGB);
+        vector<double> product(vector <Vec3i> &comb, const double initRGB[3]);
         double energyCalcu(vector <double> &Cg, vector < vector <double> > &polyGrad, vector <double> &wei);
         void singleChannelGradx(const Mat &img, Mat& dest);
         void singleChannelGrady(const Mat &img, Mat& dest);
         void gradvector(const Mat &img, vector <double> &grad);
```

Review comment:
size_t is enough: ```.diff -vector<double>::size_type +size_t ```
**File:** modules/photo/src/contrast_preserve.hpp
**Change Type:** modified
**Context:** PR #10997: Optimize decolor in photo - ### This pullrequest changes - Replaced `vector.push_back` into `vector.resize()` and `vector[i] = foo;` to imp...

**Code Changes:**
```diff
@@ -58,19 +58,19 @@ class Decolor
     public:
         float sigma;
         void init();
-        vector<double> product(vector < vector<int> > &comb, vector <double> &initRGB);
+        vector<double> product(vector <Vec3i> &comb, const double initRGB[3]);
         double energyCalcu(vector <double> &Cg, vector < vector <double> > &polyGrad, vector <double> &wei);
         void singleChannelGradx(const Mat &img, Mat& dest);
         void singleChannelGrady(const Mat &img, Mat& dest);
         void gradvector(const Mat &img, vector <double> &grad);
```

Review comment:
> unsigned int i > .size() Type should be "size_t" in these loops.