nareshmlx/opencv-pr huggingface dataset:
**File:** cmake/OpenCVUtils.cmake
**Change Type:** modified
**Context:** PR #2276: Multiple improvements in OpenCV examples build. - EMBED_CUDA and FORCE_EMBED_IOENCV flags added to cmake macro add_android_project; INSTALL_...

**Code Changes:**
```diff
@@ -448,6 +448,20 @@ macro(ocv_convert_to_full_paths VAR)
 endmacro()
 
 
+# convert list of paths to libraries names without lib prefix
+macro(ocv_convert_to_lib_name var)
+  set(__tmp "")
+  foreach(path ${ARGN})
+    get_filename_component(__tmp_name "${path}" NAME_WE)
+    string(REGEX REPLACE "^lib" "" __tmp_name ${__tmp_name})
```

Review comment:
Don't see the point of this check.
**File:** cmake/OpenCVUtils.cmake
**Change Type:** modified
**Context:** PR #2276: Multiple improvements in OpenCV examples build. - EMBED_CUDA and FORCE_EMBED_IOENCV flags added to cmake macro add_android_project; INSTALL_...

**Code Changes:**
```diff
@@ -448,6 +448,20 @@ macro(ocv_convert_to_full_paths VAR)
 endmacro()
 
 
+# convert list of paths to libraries names without lib prefix
+macro(ocv_convert_to_lib_name var)
+  set(__tmp "")
+  foreach(path ${ARGN})
+    get_filename_component(__tmp_name "${path}" NAME_WE)
+    string(REGEX REPLACE "^lib" "" __tmp_name ${__tmp_name})
```

Review comment:
Why not a function?
**File:** cmake/OpenCVUtils.cmake
**Change Type:** modified
**Context:** PR #2276: Multiple improvements in OpenCV examples build. - EMBED_CUDA and FORCE_EMBED_IOENCV flags added to cmake macro add_android_project; INSTALL_...

**Code Changes:**
```diff
@@ -448,6 +448,20 @@ macro(ocv_convert_to_full_paths VAR)
 endmacro()
 
 
+# convert list of paths to libraries names without lib prefix
+macro(ocv_convert_to_lib_name var)
+  set(__tmp "")
+  foreach(path ${ARGN})
+    get_filename_component(__tmp_name "${path}" NAME_WE)
+    string(REGEX REPLACE "^lib" "" __tmp_name ${__tmp_name})
```

Review comment:
${VAR} is a name of target variable. This is check that macro's parameter is present.
**File:** cmake/OpenCVUtils.cmake
**Change Type:** modified
**Context:** PR #2276: Multiple improvements in OpenCV examples build. - EMBED_CUDA and FORCE_EMBED_IOENCV flags added to cmake macro add_android_project; INSTALL_...

**Code Changes:**
```diff
@@ -448,6 +448,20 @@ macro(ocv_convert_to_full_paths VAR)
 endmacro()
 
 
+# convert list of paths to libraries names without lib prefix
+macro(ocv_convert_to_lib_name var)
+  set(__tmp "")
+  foreach(path ${ARGN})
+    get_filename_component(__tmp_name "${path}" NAME_WE)
+    string(REGEX REPLACE "^lib" "" __tmp_name ${__tmp_name})
```

Review comment:
I use the same approach as in most places in OpenCV. I think it does not matter here.
**File:** cmake/OpenCVUtils.cmake
**Change Type:** modified
**Context:** PR #2276: Multiple improvements in OpenCV examples build. - EMBED_CUDA and FORCE_EMBED_IOENCV flags added to cmake macro add_android_project; INSTALL_...

**Code Changes:**
```diff
@@ -448,6 +448,20 @@ macro(ocv_convert_to_full_paths VAR)
 endmacro()
 
 
+# convert list of paths to libraries names without lib prefix
+macro(ocv_convert_to_lib_name var)
+  set(__tmp "")
+  foreach(path ${ARGN})
+    get_filename_component(__tmp_name "${path}" NAME_WE)
+    string(REGEX REPLACE "^lib" "" __tmp_name ${__tmp_name})
```

Review comment:
1. How could it not be present? 2. Even if it could, doing nothing is not the best way to handle it.
**File:** cmake/OpenCVUtils.cmake
**Change Type:** modified
**Context:** PR #2276: Multiple improvements in OpenCV examples build. - EMBED_CUDA and FORCE_EMBED_IOENCV flags added to cmake macro add_android_project; INSTALL_...

**Code Changes:**
```diff
@@ -448,6 +448,20 @@ macro(ocv_convert_to_full_paths VAR)
 endmacro()
 
 
+# convert list of paths to libraries names without lib prefix
+macro(ocv_convert_to_lib_name var)
+  set(__tmp "")
+  foreach(path ${ARGN})
+    get_filename_component(__tmp_name "${path}" NAME_WE)
+    string(REGEX REPLACE "^lib" "" __tmp_name ${__tmp_name})
```

Review comment:
Not going to insist, but using functions is usually less error prone. And in this case you can even save lines, because you wouldn't have to unset those variables at the end.
**File:** modules/ts/src/ts_arrtest.cpp
**Change Type:** modified
**Context:** PR #2368: Warning fixes for GCC 4.8.
**Review Line:** 125

**Code Changes:**
```diff
@@ -122,7 +122,7 @@ void ArrayTest::get_test_array_types_and_sizes( int /*test_case_idx*/, vector<ve
 }
 
 
-static const int icvTsTypeToDepth[] =
+static const unsigned int icvTsTypeToDepth[] =
 {
     IPL_DEPTH_8U, IPL_DEPTH_8S, IPL_DEPTH_16U, IPL_DEPTH_16S,
     IPL_DEPTH_32S, IPL_DEPTH_32F, IPL_DEPTH_64F
```

Review comment:
The only place I see an element of this array used is as an argument to `cvCreateImage`, which is of type `int`. So what warning does this fix?
**File:** modules/imgproc/src/imgwarp.cpp
**Change Type:** modified
**Context:** PR #2368: Warning fixes for GCC 4.8.

**Code Changes:**
```diff
@@ -1217,8 +1217,13 @@ class resizeGeneric_Invoker :
         alpha(_alpha), _beta(__beta), ssize(_ssize), dsize(_dsize),
         ksize(_ksize), xmin(_xmin), xmax(_xmax)
     {
+        CV_Assert(ksize <= MAX_ESIZE);
     }
 
+#if defined(__GNUC__) && (__GNUC__ == 4) && (__GNUC_MINOR__ == 8)
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Warray-bounds"
```

Review comment:
This also needs `defined __GNUC__`, or other compilers might complain.
**File:** modules/imgproc/src/imgwarp.cpp
**Change Type:** modified
**Context:** PR #2368: Warning fixes for GCC 4.8.
**Review Line:** 1285

**Code Changes:**
```diff
     Mat dst;
     const int* xofs, *yofs;
     const AT* alpha, *_beta;
     Size ssize, dsize;
-    int ksize, xmin, xmax;
+    const int ksize, xmin, xmax;
+
+    resizeGeneric_Invoker& operator = (const resizeGeneric_Invoker&);
 };
 
 template<class HResize, class VResize>
```

Review comment:
it's a bad practice (see http://msdn.microsoft.com/en-us/library/hsyx7kbz.aspx)
**File:** modules/ts/src/ts_arrtest.cpp
**Change Type:** modified
**Context:** PR #2368: Warning fixes for GCC 4.8.
**Review Line:** 125

**Code Changes:**
```diff
@@ -122,7 +122,7 @@ void ArrayTest::get_test_array_types_and_sizes( int /*test_case_idx*/, vector<ve
 }
 
 
-static const int icvTsTypeToDepth[] =
+static const unsigned int icvTsTypeToDepth[] =
 {
     IPL_DEPTH_8U, IPL_DEPTH_8S, IPL_DEPTH_16U, IPL_DEPTH_16S,
     IPL_DEPTH_32S, IPL_DEPTH_32F, IPL_DEPTH_64F
```

Review comment:
ts_arrtest.cpp:129:1: warning: narrowing conversion of '2147483656u' from 'unsigned int' to 'const int' inside { } is ill-formed in C++11 [-Wnarrowing] }; ^ ts_arrtest.cpp:129:1: warning: narrowing conversion of '2147483664u' from 'unsigned int' to 'const int' inside { } is ill-formed in C++11 [-Wnarrowing] ts_arrtest.cpp:129:1: warning: narrowing conversion of '2147483680u' from 'unsigned int' to 'const int' inside { } is ill-formed in C++11 [-Wnarrowing]
**File:** modules/highgui/src/window_w32.cpp
**Change Type:** modified
**Context:** PR #2122: [HighGUI] Add Mouse Wheel Events on Windows - This feature adds support for handling mouse-wheel events on Windows. It adds 2 new events: 1....

**Code Changes:**
```diff
@@ -40,6 +40,7 @@
 //M*/
 
 #include "precomp.hpp"
+#include <windowsx.h> // required for GET_X_LPARAM() and GET_Y_LPARAM() macros
 
 #if defined WIN32 || defined _WIN32
 
@@ -1377,6 +1378,39 @@ MainWindowProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
             SetFocus(window->hwnd);
```

Review comment:
I think you should use `ScreenToClient` here. You're using the window's top left corner as the origin, but it needs to be the client area's top left corner for the calculation below to be correct.
**File:** modules/highgui/include/opencv2/highgui.hpp
**Change Type:** modified
**Context:** PR #2122: [HighGUI] Add Mouse Wheel Events on Windows - This feature adds support for handling mouse-wheel events on Windows. It adds 2 new events: 1....

**Code Changes:**
```diff
@@ -76,7 +76,9 @@ enum { EVENT_MOUSEMOVE      = 0,
        EVENT_MBUTTONUP      = 6,
        EVENT_LBUTTONDBLCLK  = 7,
        EVENT_RBUTTONDBLCLK  = 8,
-       EVENT_MBUTTONDBLCLK  = 9
+       EVENT_MBUTTONDBLCLK  = 9,
+       EVENT_MOUSEWHEEL     = 10,
+       EVENT_MOUSEHWHEEL    = 11
      };
 
```

Review comment:
Please align these like the lines above.
**File:** modules/highgui/src/window_w32.cpp
**Change Type:** modified
**Context:** PR #2122: [HighGUI] Add Mouse Wheel Events on Windows - This feature adds support for handling mouse-wheel events on Windows. It adds 2 new events: 1....

**Code Changes:**
```diff
@@ -40,6 +40,7 @@
 //M*/
 
 #include "precomp.hpp"
+#include <windowsx.h> // required for GET_X_LPARAM() and GET_Y_LPARAM() macros
 
 #if defined WIN32 || defined _WIN32
 
@@ -1377,6 +1378,39 @@ MainWindowProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
             SetFocus(window->hwnd);
```

Review comment:
Typo in "macro" (and shouldn't it be "macros" anyway)?
**File:** modules/highgui/src/window_w32.cpp
**Change Type:** modified
**Context:** PR #2122: [HighGUI] Add Mouse Wheel Events on Windows - This feature adds support for handling mouse-wheel events on Windows. It adds 2 new events: 1....

**Code Changes:**
```diff
@@ -40,6 +40,7 @@
 //M*/
 
 #include "precomp.hpp"
+#include <windowsx.h> // required for GET_X_LPARAM() and GET_Y_LPARAM() macros
 
 #if defined WIN32 || defined _WIN32
 
@@ -1377,6 +1378,39 @@ MainWindowProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
             SetFocus(window->hwnd);
```

Review comment:
Oops. Yes. fixed.
**File:** modules/highgui/doc/user_interface.rst
**Change Type:** modified
**Context:** PR #2122: [HighGUI] Add Mouse Wheel Events on Windows - This feature adds support for handling mouse-wheel events on Windows. It adds 2 new events: 1....

**Code Changes:**
```diff
@@ -208,6 +208,26 @@ Sets mouse handler for the specified window
     :param userdata: The optional parameter passed to the callback.
 
 
+getMouseWheelDelta
+------------------
+Gets the mouse-wheel motion delta, when handling mouse-wheel events EVENT_MOUSEWHEEL and EVENT_MOUSEHWHEEL.
+
+.. ocv:function:: int getMouseWheelDelta(int flags)
+
```

Review comment:
The interpretation can't depend on the platform, or cross-platform code becomes impossible. Also, what do you mean, usually? Be more definite.
**File:** modules/highgui/doc/user_interface.rst
**Change Type:** modified
**Context:** PR #2122: [HighGUI] Add Mouse Wheel Events on Windows - This feature adds support for handling mouse-wheel events on Windows. It adds 2 new events: 1....

**Code Changes:**
```diff
@@ -208,6 +208,26 @@ Sets mouse handler for the specified window
     :param userdata: The optional parameter passed to the callback.
 
 
+getMouseWheelDelta
+------------------
+Gets the mouse-wheel motion delta, when handling mouse-wheel events EVENT_MOUSEWHEEL and EVENT_MOUSEHWHEEL.
+
+.. ocv:function:: int getMouseWheelDelta(int flags)
+
```

Review comment:
Many mice do not have scroll-wheels. Many that do, do not support horizontal-scroll. This is a _non-mandatory_ feature and the problem is that there is no agreed standard here. From the windows docshttp://msdn.microsoft.com/en-us/library/windows/desktop/ms645617(v=vs.85).aspx : The wheel rotation will be a multiple of _WHEEL_DELTA_, which is set at 120. This is the threshold for action to be taken, and one such action (for example, scrolling one increment) should occur for each delta. The delta was set to 120 to allow Microsoft or other vendors to build finer-resolution wheels (a freely-rotating wheel with no notches) to send more messages per rotation, but with a smaller value in each message. To use this feature, you can either add the incoming delta values until _WHEEL_DELTA_ is reached (so for a delta-rotation you get the same response), or scroll partial lines in response to the more frequent messages. You can also choose your scroll granularity and accumulate deltas until it is reached. I've seen this value set at 120 on other platforms as well (from a brief search) but I cannot guarantee it. As a general note: No one is (or should be) doing production-quality high-end GUIs with highgui. Highgui is meant for easy visualization of images - especially at the PoC or algorithm experimentation phase. We are not re-implementing wxWidgets. It is possible to mark this feature as experimental and liable to breaking changes in the future when more platforms are supported.
**File:** modules/highgui/doc/user_interface.rst
**Change Type:** modified
**Context:** PR #2122: [HighGUI] Add Mouse Wheel Events on Windows - This feature adds support for handling mouse-wheel events on Windows. It adds 2 new events: 1....

**Code Changes:**
```diff
@@ -208,6 +208,26 @@ Sets mouse handler for the specified window
     :param userdata: The optional parameter passed to the callback.
 
 
+getMouseWheelDelta
+------------------
+Gets the mouse-wheel motion delta, when handling mouse-wheel events EVENT_MOUSEWHEEL and EVENT_MOUSEHWHEEL.
+
+.. ocv:function:: int getMouseWheelDelta(int flags)
+
```

Review comment:
If the mouse doesn't have a wheel, the event will simply never arrive. That's not a problem. Same if the backend doesn't support it. However, if the event _does_ arrive, the user needs to know how to interpret it. And that interpretation should be the same on all platforms. Besides, in this case this is easy to do. Just say that 120 always corresponds to one rotation of the wheel. Backends can adapt.
**File:** modules/highgui/doc/user_interface.rst
**Change Type:** modified
**Context:** PR #2122: [HighGUI] Add Mouse Wheel Events on Windows - This feature adds support for handling mouse-wheel events on Windows. It adds 2 new events: 1....

**Code Changes:**
```diff
@@ -208,6 +208,26 @@ Sets mouse handler for the specified window
     :param userdata: The optional parameter passed to the callback.
 
 
+getMouseWheelDelta
+------------------
+Gets the mouse-wheel motion delta, when handling mouse-wheel events EVENT_MOUSEWHEEL and EVENT_MOUSEHWHEEL.
+
+.. ocv:function:: int getMouseWheelDelta(int flags)
+
```

Review comment:
You can't document a macro as a function (see http://build.opencv.org/builders/precommit_docs/builds/7598). You can probably just mention it in the text.
**File:** modules/imgproc/perf/perf_moments.cpp
**Change Type:** added
**Context:** PR #2830: added perf test for moments - performance moments check_regression=_Moments_ **https://github.com/Itseez/opencv_extra/pull/194** build_examp...

**Code Changes:**
```diff
@@ -0,0 +1,38 @@
+// 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) 2014, Itseez, Inc., all rights reserved.
+// Third party copyrights are property of their respective owners.
+
+#include "perf_precomp.hpp"
+
```

Review comment:
all the tests with prefix `OCL` are located in `module_name/perf/opencl`. And as I previously said, we already have OpenCL test for `CV_8UC1`. I don't see any reason for keeping 2 identical tests, so I believe it should be removed.
**File:** modules/imgproc/perf/perf_moments.cpp
**Change Type:** added
**Context:** PR #2830: added perf test for moments - performance moments check_regression=_Moments_ **https://github.com/Itseez/opencv_extra/pull/194** build_examp...

**Code Changes:**
```diff
@@ -0,0 +1,38 @@
+// 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) 2014, Itseez, Inc., all rights reserved.
+// Third party copyrights are property of their respective owners.
+
+#include "perf_precomp.hpp"
+
```

Review comment:
why only `false`? It would be better to make `binaryMode` as test parameter
**File:** modules/imgproc/perf/perf_moments.cpp
**Change Type:** added
**Context:** PR #2830: added perf test for moments - performance moments check_regression=_Moments_ **https://github.com/Itseez/opencv_extra/pull/194** build_examp...

**Code Changes:**
```diff
@@ -0,0 +1,38 @@
+// 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) 2014, Itseez, Inc., all rights reserved.
+// Third party copyrights are property of their respective owners.
+
+#include "perf_precomp.hpp"
+
```

Review comment:
In most performance tests we use randomize matrix. Why do you use imread instead random in this case?
**File:** modules/imgproc/perf/perf_moments.cpp
**Change Type:** added
**Context:** PR #2830: added perf test for moments - performance moments check_regression=_Moments_ **https://github.com/Itseez/opencv_extra/pull/194** build_examp...

**Code Changes:**
```diff
@@ -0,0 +1,38 @@
+// 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) 2014, Itseez, Inc., all rights reserved.
+// Third party copyrights are property of their respective owners.
+
+#include "perf_precomp.hpp"
+
```

Review comment:
is this header realy need?
**File:** modules/imgproc/perf/perf_moments.cpp
**Change Type:** added
**Context:** PR #2830: added perf test for moments - performance moments check_regression=_Moments_ **https://github.com/Itseez/opencv_extra/pull/194** build_examp...

**Code Changes:**
```diff
@@ -0,0 +1,38 @@
+// 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) 2014, Itseez, Inc., all rights reserved.
+// Third party copyrights are property of their respective owners.
+
+#include "perf_precomp.hpp"
+
```

Review comment:
Why `UMat`?
**File:** modules/ocl/perf/perf_kalman.cpp
**Change Type:** added
**Context:** PR #1434: Added performance for Kalman Filter.

**Code Changes:**
```diff
@@ -0,0 +1,93 @@
+/*M///////////////////////////////////////////////////////////////////////////////////////
+//
+//  IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
+//
+//  By downloading, copying, installing or using the software you agree to this license.
+//  If you do not agree to this license, do not download, install,
+//  copy or use the software.
+//
+//
```

Review comment:
You can process data uploading under "if(RUN_OCL_IMPL)" but not under OCL_TEST_CYCLE()
**File:** modules/ocl/perf/perf_kalman.cpp
**Change Type:** added
**Context:** PR #1434: Added performance for Kalman Filter.

**Code Changes:**
```diff
@@ -0,0 +1,93 @@
+/*M///////////////////////////////////////////////////////////////////////////////////////
+//
+//  IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
+//
+//  By downloading, copying, installing or using the software you agree to this license.
+//  If you do not agree to this license, do not download, install,
+//  copy or use the software.
+//
+//
```

Review comment:
There are some agreements: we measure performance time without data transters (where it is possible). So move `download()` call out of `OCL_TEST_CYCLE`. Something like this: ``` oclMat oclResult; OCL_TEST_CYCLE() { ... oclResult = kalman_ocl.statePre } oclResult.download(statePre_); ```
**File:** modules/ocl/perf/perf_kalman.cpp
**Change Type:** added
**Context:** PR #1434: Added performance for Kalman Filter.

**Code Changes:**
```diff
@@ -0,0 +1,93 @@
+/*M///////////////////////////////////////////////////////////////////////////////////////
+//
+//  IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
+//
+//  By downloading, copying, installing or using the software you agree to this license.
+//  If you do not agree to this license, do not download, install,
+//  copy or use the software.
+//
+//
```

Review comment:
Sanity checks are similar for PLAIN and OCL implementations, so you can move it to the end of test (after `if(RUN_OCL_IMPL)`)
**File:** CMakeLists.txt
**Change Type:** modified
**Context:** PR #2563: Enable IPP and IPPICV support - check_regression=_Min_ test_modules=core test_filter=_Min_
**Review Line:** 130

**Code Changes:**
```diff
@@ -127,7 +127,8 @@ OCV_OPTION(WITH_FFMPEG         "Include FFMPEG support"                      ON
 OCV_OPTION(WITH_GSTREAMER      "Include Gstreamer support"                   ON   IF (UNIX AND NOT APPLE AND NOT ANDROID) )
 OCV_OPTION(WITH_GSTREAMER_0_10 "Enable Gstreamer 0.10 support (instead of 1.x)"                              OFF )
 OCV_OPTION(WITH_GTK            "Include GTK support"                         ON   IF (UNIX AND NOT APPLE AND NOT ANDROID) )
-OCV_OPTION(WITH_IPP            "Include Intel IPP support"                   OFF  IF (MSVC OR X86 OR X86_64) )
+OCV_OPTION(WITH_ICV            "Include Intel IPP ICV support"               ON   IF (NOT IOS) )
+OCV_OPTION(WITH_IPP            "Include Intel IPP support"                   OFF  IF (NOT IOS) )
 OCV_OPTION(WITH_JASPER         "Include JPEG2K support"                      ON   IF (NOT IOS) )
 OCV_OPTION(WITH_JPEG           "Include JPEG support"                        ON)
 OCV_OPTION(WITH_WEBP           "Include WebP support"                        ON   IF (NOT IOS) )
@@ -916,11 +917,11 @@ endif(DEFINED WITH_INTELPERC)
```

Review comment:
I suggest `WITH_IPP_ICV` instead of `WITH_ICV`
**File:** modules/optim/src/simplex.cpp
**Change Type:** added
**Context:** PR #1282: Prepare Downhill Simplex for pull request - This is an implementation of so-called downhill simplex method (https://en.wikipedia.org/wiki/Ne...

**Code Changes:**
```diff
@@ -0,0 +1,273 @@
+#include "precomp.hpp"
+#include "debug.hpp"
+#include "opencv2/core/core_c.h"
+
+namespace cv{namespace optim{
+
+    class DownhillSolverImpl : public DownhillSolver
+    {
+    public:
```

Review comment:
use cv::reduce() instead of this custom code
**File:** modules/optim/src/simplex.cpp
**Change Type:** added
**Context:** PR #1282: Prepare Downhill Simplex for pull request - This is an implementation of so-called downhill simplex method (https://en.wikipedia.org/wiki/Ne...

**Code Changes:**
```diff
@@ -0,0 +1,273 @@
+#include "precomp.hpp"
+#include "debug.hpp"
+#include "opencv2/core/core_c.h"
+
+namespace cv{namespace optim{
+
+    class DownhillSolverImpl : public DownhillSolver
+    {
+    public:
```

Review comment:
the method naming style should preferably be consistent. For external names you use mixed-case style (which is in line with our coding style), for internal methods you use all-lower-case names with separating underscores. Please, fix it.
**File:** modules/optim/src/simplex.cpp
**Change Type:** added
**Context:** PR #1282: Prepare Downhill Simplex for pull request - This is an implementation of so-called downhill simplex method (https://en.wikipedia.org/wiki/Ne...

**Code Changes:**
```diff
@@ -0,0 +1,273 @@
+#include "precomp.hpp"
+#include "debug.hpp"
+#include "opencv2/core/core_c.h"
+
+namespace cv{namespace optim{
+
+    class DownhillSolverImpl : public DownhillSolver
+    {
+    public:
```

Review comment:
this line is irrelevant. copyTo() creates create() for the destination array.
**File:** modules/optim/src/simplex.cpp
**Change Type:** added
**Context:** PR #1282: Prepare Downhill Simplex for pull request - This is an implementation of so-called downhill simplex method (https://en.wikipedia.org/wiki/Ne...
**Review Line:** 266

**Code Changes:**
```diff
+    }
+    void DownhillSolverImpl::setInitStep(InputArray step){
+        //set dimensionality and make a deep copy of step
+        Mat m=step.getMat();
+        dprintf(("m.cols=%d\nm.rows=%d\n",m.cols,m.rows));
+        CV_Assert(MIN(m.cols,m.rows)==1 && m.type()==CV_64FC1);
+        if(m.rows==1){
+            m.copyTo(_step);
+        }else{
+            transpose(m,_step);
+        }
```

Review comment:
the implementation is overly complex. use the following code after assert: <pre> if(m.rows == 1) m.copyTo(_step); else transpose(m, _step); </pre>