nareshmlx/opencv-pr huggingface dataset:
**File:** cmake/OpenCVFindMatlab.cmake
**Change Type:** added
**Context:** PR #1384: Matlab public - This is the first public pull request for the Matlab bindings module. I've tested this code on Windows, Linux and Mac. At th...
**Review Line:** 107

**Code Changes:**
```diff
+    endforeach()
+
+    # select the highest version
+    list(APPEND VERSIONS_ "0.0")
+    list(SORT VERSIONS_)
+    list(REVERSE VERSIONS_)
+    list(GET VERSIONS_ 0 VERSION_)
+
+    # request the MATLABROOT from the registry
+    foreach(REG_ROOT_ ${REG_ROOTS_})
+      get_filename_component(QUERY_RESPONSE_ [${REG_ROOT_}\\${REG_EXTENSION_}\\${VERSION_};MATLABROOT] ABSOLUTE)
```

Review comment:
What do the other versions look like? Won't this lead to 10.0 being considered less than 9.0?
**File:** cmake/OpenCVFindMatlab.cmake
**Change Type:** added
**Context:** PR #1384: Matlab public - This is the first public pull request for the Matlab bindings module. I've tested this code on Windows, Linux and Mac. At th...

**Code Changes:**
```diff
@@ -0,0 +1,199 @@
+# ----- Find Matlab/Octave -----
+#
+# OpenCVFindMatlab.cmake attempts to locate the install path of Matlab in order
+# to extract the mex headers, libraries and shell scripts. If found
+# successfully, the following variables will be defined
+#
+#   MATLAB_FOUND:       true/false
+#   MATLAB_ROOT_DIR:    Root of Matlab installation
+#   MATLAB_BIN:         The main Matlab "executable" (shell script)
```

Review comment:
This comment still applies.
**File:** cmake/OpenCVFindMatlab.cmake
**Change Type:** added
**Context:** PR #1384: Matlab public - This is the first public pull request for the Matlab bindings module. I've tested this code on Windows, Linux and Mac. At th...

**Code Changes:**
```diff
@@ -0,0 +1,199 @@
+# ----- Find Matlab/Octave -----
+#
+# OpenCVFindMatlab.cmake attempts to locate the install path of Matlab in order
+# to extract the mex headers, libraries and shell scripts. If found
+# successfully, the following variables will be defined
+#
+#   MATLAB_FOUND:       true/false
+#   MATLAB_ROOT_DIR:    Root of Matlab installation
+#   MATLAB_BIN:         The main Matlab "executable" (shell script)
```

Review comment:
You still have to specify the .bat variant explicitly, since `find_program`, for whatever reason, doesn't consider .bat to be a program extension.
**File:** cmake/OpenCVFindMatlab.cmake
**Change Type:** added
**Context:** PR #1384: Matlab public - This is the first public pull request for the Matlab bindings module. I've tested this code on Windows, Linux and Mac. At th...
**Review Line:** 107

**Code Changes:**
```diff
+    endforeach()
+
+    # select the highest version
+    list(APPEND VERSIONS_ "0.0")
+    list(SORT VERSIONS_)
+    list(REVERSE VERSIONS_)
+    list(GET VERSIONS_ 0 VERSION_)
+
+    # request the MATLABROOT from the registry
+    foreach(REG_ROOT_ ${REG_ROOTS_})
+      get_filename_component(QUERY_RESPONSE_ [${REG_ROOT_}\\${REG_EXTENSION_}\\${VERSION_};MATLABROOT] ABSOLUTE)
```

Review comment:
Yes it will unfortunately. However each half-yearly release of Matlab is generally a +0.1 release, and we're only at 8.2 at the moment, so I've got a little while to figure out a better way of sorting. I'll add a TODO.
**File:** cmake/OpenCVFindMatlab.cmake
**Change Type:** added
**Context:** PR #1384: Matlab public - This is the first public pull request for the Matlab bindings module. I've tested this code on Windows, Linux and Mac. At th...

**Code Changes:**
```diff
@@ -0,0 +1,199 @@
+# ----- Find Matlab/Octave -----
+#
+# OpenCVFindMatlab.cmake attempts to locate the install path of Matlab in order
+# to extract the mex headers, libraries and shell scripts. If found
+# successfully, the following variables will be defined
+#
+#   MATLAB_FOUND:       true/false
+#   MATLAB_ROOT_DIR:    Root of Matlab installation
+#   MATLAB_BIN:         The main Matlab "executable" (shell script)
```

Review comment:
**sigh**. I think working with CMake is the least-favourite part of my day.
**File:** cmake/OpenCVFindMatlab.cmake
**Change Type:** added
**Context:** PR #1384: Matlab public - This is the first public pull request for the Matlab bindings module. I've tested this code on Windows, Linux and Mac. At th...
**Review Line:** 48

**Code Changes:**
```diff
+  elseif (APPLE)
+    set(CMAKE_FIND_LIBRARY_PREFIXES "lib" PARENT_SCOPE)
+    set(CMAKE_FIND_LIBRARY_SUFFIXES ".dylib" ".a" PARENT_SCOPE)
+  elseif (WIN32)
+    set(CMAKE_FIND_LIBRARY_PREFIXES "lib" PARENT_SCOPE)
+    set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".dll" PARENT_SCOPE)
+  endif()
+endfunction()
+
+
+
```

Review comment:
My understanding of linkage in Windows is limited. As I understand it, each DLL needs a corresponding LIB file that contains symbol definition and location information. So if I don't link directly to DLLs, don't I at least a LIB file to link against? If, as you say, Mathworks doesn't ship LIB files, how does one link against any of the Matlab libraries such as mx, mkl, etc?
**File:** cmake/OpenCVFindMatlab.cmake
**Change Type:** added
**Context:** PR #1384: Matlab public - This is the first public pull request for the Matlab bindings module. I've tested this code on Windows, Linux and Mac. At th...
**Review Line:** 48

**Code Changes:**
```diff
+  elseif (APPLE)
+    set(CMAKE_FIND_LIBRARY_PREFIXES "lib" PARENT_SCOPE)
+    set(CMAKE_FIND_LIBRARY_SUFFIXES ".dylib" ".a" PARENT_SCOPE)
+  elseif (WIN32)
+    set(CMAKE_FIND_LIBRARY_PREFIXES "lib" PARENT_SCOPE)
+    set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".dll" PARENT_SCOPE)
+  endif()
+endfunction()
+
+
+
```

Review comment:
> As I understand it, each DLL needs a corresponding LIB file that contains symbol definition and location information. That is correct. > If, as you say, Mathworks doesn't ship LIB files I didn't say that (and I'm pretty sure it does). > So if I don't link directly to DLLs, don't I at least a LIB file to link against? I think you're misinterpreting what I said. You do need the .lib files - but you don't need the .dll files.
**File:** cmake/OpenCVFindMatlab.cmake
**Change Type:** added
**Context:** PR #1384: Matlab public - This is the first public pull request for the Matlab bindings module. I've tested this code on Windows, Linux and Mac. At th...
**Review Line:** 48

**Code Changes:**
```diff
+  elseif (APPLE)
+    set(CMAKE_FIND_LIBRARY_PREFIXES "lib" PARENT_SCOPE)
+    set(CMAKE_FIND_LIBRARY_SUFFIXES ".dylib" ".a" PARENT_SCOPE)
+  elseif (WIN32)
+    set(CMAKE_FIND_LIBRARY_PREFIXES "lib" PARENT_SCOPE)
+    set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".dll" PARENT_SCOPE)
+  endif()
+endfunction()
+
+
+
```

Review comment:
(seeing as this is already merged, and it's not a huge issue, you don't have to fix it right now - but it's something to keep in mind if you're going to submit improvements)
**File:** modules/imgproc/src/morph.cpp
**Change Type:** modified
**Context:** PR #2653: IPP: added LUT optimization - ``` check_regression_x=*Lut*:*lut*:*LUT* test_module_x=core test_filter_x=*Lut*:*lut*:*LUT* build_examples=OFF...

**Code Changes:**
```diff
@@ -1258,8 +1258,11 @@ static bool IPPMorphReplicate(int op, const Mat &src, Mat &dst, const Mat &kerne
         default:
             return false;
         }
-
         #undef IPP_MORPH_CASE
+
+#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ == 8
+        return false; /// It disables false positive warning in GCC 4.8.2
+#endif
```

Review comment:
this is a matter of taste, but I think that the default case should still be there. It's more safe. If someone changes IPP_MORPH_CASE macro so that it does not include "return ok", the new code will silently return false.
**File:** modules/imgproc/src/morph.cpp
**Change Type:** modified
**Context:** PR #2653: IPP: added LUT optimization - ``` check_regression_x=*Lut*:*lut*:*LUT* test_module_x=core test_filter_x=*Lut*:*lut*:*LUT* build_examples=OFF...

**Code Changes:**
```diff
@@ -1258,8 +1258,11 @@ static bool IPPMorphReplicate(int op, const Mat &src, Mat &dst, const Mat &kerne
         default:
             return false;
         }
-
         #undef IPP_MORPH_CASE
+
+#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ == 8
+        return false; /// It disables false positive warning in GCC 4.8.2
+#endif
```

Review comment:
Vadim, fixed.
**File:** modules/core/src/convert.cpp
**Change Type:** modified
**Context:** PR #2653: IPP: added LUT optimization - ``` check_regression_x=*Lut*:*lut*:*LUT* test_module_x=core test_filter_x=*Lut*:*lut*:*LUT* build_examples=OFF...
**Review Line:** 1641

**Code Changes:**
```diff
+    uchar* lutBuffer;
+    uchar* lutTable[4];
+
+    IppLUTParallelBody_LUTCN(const Mat& src, const Mat& lut, Mat& dst, bool* _ok)
+        : ok(_ok), src_(src), lut_(lut), dst_(dst), lutBuffer(NULL)
+    {
+        lutcn = lut.channels();
+        IppiSize sz256 = {256, 1};
+
+        size_t elemSize1 = dst.elemSize1();
+        CV_DbgAssert(elemSize1 == 1);
```

Review comment:
please, invoke the constructor of base class `ParallelLoopBody`
**File:** modules/core/src/convert.cpp
**Change Type:** modified
**Context:** PR #2653: IPP: added LUT optimization - ``` check_regression_x=*Lut*:*lut*:*LUT* test_module_x=core test_filter_x=*Lut*:*lut*:*LUT* build_examples=OFF...

**Code Changes:**
```diff
@@ -1543,10 +1543,10 @@ static LUTFunc lutTab[] =
 
 static bool ocl_LUT(InputArray _src, InputArray _lut, OutputArray _dst)
 {
-    int dtype = _dst.type(), lcn = _lut.channels(), dcn = CV_MAT_CN(dtype), ddepth = CV_MAT_DEPTH(dtype);
+    int lcn = _lut.channels(), dcn = _src.channels(), ddepth = _lut.depth();
 
     UMat src = _src.getUMat(), lut = _lut.getUMat();
-    _dst.create(src.size(), dtype);
+    _dst.create(src.size(), CV_MAKETYPE(ddepth, dcn));
```

Review comment:
`CV_ELEM_SIZE1(dst.depth())` -> `dst.elemSize1()`
**File:** modules/core/src/convert.cpp
**Change Type:** modified
**Context:** PR #2653: IPP: added LUT optimization - ``` check_regression_x=*Lut*:*lut*:*LUT* test_module_x=core test_filter_x=*Lut*:*lut*:*LUT* build_examples=OFF...

**Code Changes:**
```diff
@@ -1543,10 +1543,10 @@ static LUTFunc lutTab[] =
 
 static bool ocl_LUT(InputArray _src, InputArray _lut, OutputArray _dst)
 {
-    int dtype = _dst.type(), lcn = _lut.channels(), dcn = CV_MAT_CN(dtype), ddepth = CV_MAT_DEPTH(dtype);
+    int lcn = _lut.channels(), dcn = _src.channels(), ddepth = _lut.depth();
 
     UMat src = _src.getUMat(), lut = _lut.getUMat();
-    _dst.create(src.size(), dtype);
+    _dst.create(src.size(), CV_MAKETYPE(ddepth, dcn));
```

Review comment:
`dst.data` already has type `uchar*`
**File:** modules/core/src/convert.cpp
**Change Type:** modified
**Context:** PR #2653: IPP: added LUT optimization - ``` check_regression_x=*Lut*:*lut*:*LUT* test_module_x=core test_filter_x=*Lut*:*lut*:*LUT* build_examples=OFF...

**Code Changes:**
```diff
@@ -1543,10 +1543,10 @@ static LUTFunc lutTab[] =
 
 static bool ocl_LUT(InputArray _src, InputArray _lut, OutputArray _dst)
 {
-    int dtype = _dst.type(), lcn = _lut.channels(), dcn = CV_MAT_CN(dtype), ddepth = CV_MAT_DEPTH(dtype);
+    int lcn = _lut.channels(), dcn = _src.channels(), ddepth = _lut.depth();
 
     UMat src = _src.getUMat(), lut = _lut.getUMat();
-    _dst.create(src.size(), dtype);
+    _dst.create(src.size(), CV_MAKETYPE(ddepth, dcn));
```

Review comment:
`dst.size().height` -> `dst.rows`
**File:** modules/core/src/convert.cpp
**Change Type:** modified
**Context:** PR #2653: IPP: added LUT optimization - ``` check_regression_x=*Lut*:*lut*:*LUT* test_module_x=core test_filter_x=*Lut*:*lut*:*LUT* build_examples=OFF...

**Code Changes:**
```diff
@@ -1543,10 +1543,10 @@ static LUTFunc lutTab[] =
 
 static bool ocl_LUT(InputArray _src, InputArray _lut, OutputArray _dst)
 {
-    int dtype = _dst.type(), lcn = _lut.channels(), dcn = CV_MAT_CN(dtype), ddepth = CV_MAT_DEPTH(dtype);
+    int lcn = _lut.channels(), dcn = _src.channels(), ddepth = _lut.depth();
 
     UMat src = _src.getUMat(), lut = _lut.getUMat();
-    _dst.create(src.size(), dtype);
+    _dst.create(src.size(), CV_MAKETYPE(ddepth, dcn));
```

Review comment:
please, delete inexistent code above
**File:** modules/calib3d/src/stereobm.cpp
**Change Type:** modified
**Context:** PR #2415: fixed difference between SSE2 and C branches of StereoBM - thanks to @KonstantinMatskevich for the tests (#2369); I did not put them in here...
**Review Line:** 434

**Code Changes:**
```diff
-            minsad = sad[mind];
+            ushort CV_DECL_ALIGNED(16) minsad_buf[8], mind_buf[8];
+            _mm_store_si128((__m128i*)minsad_buf, minsad8);
+            _mm_store_si128((__m128i*)mind_buf, mind8);
+            for( d = 0; d < 8; d++ )
+                if(minsad > (int)minsad_buf[d] || (minsad == (int)minsad_buf[d] && mind > mind_buf[d]))
+                {
+                    minsad = minsad_buf[d];
+                    mind = mind_buf[d];
+                }
 
```

Review comment:
"good vectorization" :wink:
**File:** modules/calib3d/src/stereobm.cpp
**Change Type:** modified
**Context:** PR #2415: fixed difference between SSE2 and C branches of StereoBM - thanks to @KonstantinMatskevich for the tests (#2369); I did not put them in here...
**Review Line:** 434

**Code Changes:**
```diff
-            minsad = sad[mind];
+            ushort CV_DECL_ALIGNED(16) minsad_buf[8], mind_buf[8];
+            _mm_store_si128((__m128i*)minsad_buf, minsad8);
+            _mm_store_si128((__m128i*)mind_buf, mind8);
+            for( d = 0; d < 8; d++ )
+                if(minsad > (int)minsad_buf[d] || (minsad == (int)minsad_buf[d] && mind > mind_buf[d]))
+                {
+                    minsad = minsad_buf[d];
+                    mind = mind_buf[d];
+                }
 
```

Review comment:
you don't get it! this is scalarization! after analyzing this and that, I decided to follow the modern trend!
**File:** modules/bioinspired/doc/retina/index.rst
**Change Type:** renamed
**Context:** PR #984: Retina move to a new module : bioinspired - Creating a new module (following discussion with Vadim). => new module : bioinspired. the aim is ...
**Review Line:** 19

**Code Changes:**
```diff
+
 Introduction
 ++++++++++++
 
@@ -17,7 +19,7 @@ Class which provides the main controls to the Gipsa/Listic labs human  retina mo
 * peripheral vision for sensitive transient signals detection (motion and events) : the magnocellular pathway.
 
 From a general point of view, this filter whitens the image spectrum and corrects luminance thanks to local adaptation. An other important property is its hability to filter out spatio-temporal noise while enhancing details.
-This model originates from Jeanny Herault work [Herault2010]_. It has been involved in Alexandre Benoit phd and his current research [Benoit2010]_ (he currently maintains this module within OpenCV). It includes the work of other Jeanny's phd student such as [Chaix2007]_ and the log polar transformations of Barthelemy Durette described in Jeanny's book.
+This model originates from Jeanny Herault work [Herault2010]_. It has been involved in Alexandre Benoit phd and his current research [Benoit2010]_, [Strat2013]_ (he currently maintains this module within OpenCV). It includes the work of other Jeanny's phd student such as [Chaix2007]_ and the log polar transformations of Barthelemy Durette described in Jeanny's book.
 
```

Review comment:
The file should be moved from modules/bioinspired/doc/retina to modules/bioinspired/doc/. In particular that should fix displaying images.
**File:** modules/bioinspired/include/opencv2/bioinspired.hpp
**Change Type:** added
**Context:** PR #984: Retina move to a new module : bioinspired - Creating a new module (following discussion with Vadim). => new module : bioinspired. the aim is ...

**Code Changes:**
```diff
@@ -0,0 +1,50 @@
+/*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:
putting "using namespace cv::hsvtools;" into library header is not very good practice. It's user who should use such directives. Let's remove it.
**File:** modules/bioinspired/include/opencv2/bioinspired/retina.hpp
**Change Type:** renamed
**Context:** PR #984: Retina move to a new module : bioinspired - Creating a new module (following discussion with Vadim). => new module : bioinspired. the aim is ...

**Code Changes:**
```diff
@@ -6,12 +6,12 @@
  ** copy or use the software.
  **
  **
- ** HVStools : interfaces allowing OpenCV users to integrate Human Vision System models. Presented models originate from Jeanny Herault's original research and have been reused and adapted by the author&collaborators for computed vision applications since his thesis with Alice Caplier at Gipsa-Lab.
+ ** bioinspired : interfaces allowing OpenCV users to integrate Human Vision System models. Presented models originate from Jeanny Herault's original research and have been reused and adapted by the author&collaborators for computed vision applications since his thesis with Alice Caplier at Gipsa-Lab.
  ** Use: extract still images & image sequences features, from contours details to motion spatio-temporal features, etc. for high level visual scene analysis. Also contribute to image enhancement/compression such as tone mapping.
  **
  ** Maintainers : Listic lab (code author current affiliation & applications) and Gipsa Lab (original research origins & applications)
  **
```

Review comment:
I found it very confusing that the module is called bioinspired and the namespace is called hsvtools. Can we make namespace looking more similar to the module name? Something like "bio"?
**File:** modules/bioinspired/include/opencv2/bioinspired/retina.hpp
**Change Type:** renamed
**Context:** PR #984: Retina move to a new module : bioinspired - Creating a new module (following discussion with Vadim). => new module : bioinspired. the aim is ...

**Code Changes:**
```diff
@@ -6,12 +6,12 @@
  ** copy or use the software.
  **
  **
- ** HVStools : interfaces allowing OpenCV users to integrate Human Vision System models. Presented models originate from Jeanny Herault's original research and have been reused and adapted by the author&collaborators for computed vision applications since his thesis with Alice Caplier at Gipsa-Lab.
+ ** bioinspired : interfaces allowing OpenCV users to integrate Human Vision System models. Presented models originate from Jeanny Herault's original research and have been reused and adapted by the author&collaborators for computed vision applications since his thesis with Alice Caplier at Gipsa-Lab.
  ** Use: extract still images & image sequences features, from contours details to motion spatio-temporal features, etc. for high level visual scene analysis. Also contribute to image enhancement/compression such as tone mapping.
  **
  ** Maintainers : Listic lab (code author current affiliation & applications) and Gipsa Lab (original research origins & applications)
  **
```

Review comment:
non-anonymoous enumerations are not quite compatible with our Python and Java bindings. Is it possible to make the enumeration anonymous?
**File:** modules/bioinspired/include/opencv2/bioinspired/retina.hpp
**Change Type:** renamed
**Context:** PR #984: Retina move to a new module : bioinspired - Creating a new module (following discussion with Vadim). => new module : bioinspired. the aim is ...

**Code Changes:**
```diff
@@ -6,12 +6,12 @@
  ** copy or use the software.
  **
  **
- ** HVStools : interfaces allowing OpenCV users to integrate Human Vision System models. Presented models originate from Jeanny Herault's original research and have been reused and adapted by the author&collaborators for computed vision applications since his thesis with Alice Caplier at Gipsa-Lab.
+ ** bioinspired : interfaces allowing OpenCV users to integrate Human Vision System models. Presented models originate from Jeanny Herault's original research and have been reused and adapted by the author&collaborators for computed vision applications since his thesis with Alice Caplier at Gipsa-Lab.
  ** Use: extract still images & image sequences features, from contours details to motion spatio-temporal features, etc. for high level visual scene analysis. Also contribute to image enhancement/compression such as tone mapping.
  **
  ** Maintainers : Listic lab (code author current affiliation & applications) and Gipsa Lab (original research origins & applications)
  **
```

Review comment:
1. without CV_EXPORTS the function will not be available for Windows users when OpenCV is built as DLL. 2. the leading underscore should probably be removed - we use underscores for external functions very very rarely, e.g. when there is already function without underscore. 3. Actually, I'd suggest to make this function internal for now. I checked that it's not used in samples and it's actually implementation-specific. If we move it inside, we could remove <pre>#include &lt;valarray&gt;</pre> from headers.
**File:** modules/bioinspired/doc/retina/index.rst
**Change Type:** renamed
**Context:** PR #984: Retina move to a new module : bioinspired - Creating a new module (following discussion with Vadim). => new module : bioinspired. the aim is ...
**Review Line:** 19

**Code Changes:**
```diff
+
 Introduction
 ++++++++++++
 
@@ -17,7 +19,7 @@ Class which provides the main controls to the Gipsa/Listic labs human  retina mo
 * peripheral vision for sensitive transient signals detection (motion and events) : the magnocellular pathway.
 
 From a general point of view, this filter whitens the image spectrum and corrects luminance thanks to local adaptation. An other important property is its hability to filter out spatio-temporal noise while enhancing details.
-This model originates from Jeanny Herault work [Herault2010]_. It has been involved in Alexandre Benoit phd and his current research [Benoit2010]_ (he currently maintains this module within OpenCV). It includes the work of other Jeanny's phd student such as [Chaix2007]_ and the log polar transformations of Barthelemy Durette described in Jeanny's book.
+This model originates from Jeanny Herault work [Herault2010]_. It has been involved in Alexandre Benoit phd and his current research [Benoit2010]_, [Strat2013]_ (he currently maintains this module within OpenCV). It includes the work of other Jeanny's phd student such as [Chaix2007]_ and the log polar transformations of Barthelemy Durette described in Jeanny's book.
 
```

Review comment:
Hi, actually, i do not understand this note. which image is concerned ?