nareshmlx/opencv-pr huggingface dataset:
**File:** modules/imgproc/src/corner.cpp
**Change Type:** modified
**Context:** PR #2605: IPP: cornerMinEigenVal - Merge with extra: Itseez/opencv_extra#167 check_regression=_Img_MinEigenVal*

**Code Changes:**
```diff
@@ -460,10 +460,63 @@ void cv::cornerMinEigenVal( InputArray _src, OutputArray _dst, int blockSize, in
     Mat src = _src.getMat();
     _dst.create( src.size(), CV_32FC1 );
     Mat dst = _dst.getMat();
+
+#if defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY) && (IPP_VERSION_MAJOR >= 8)
+    typedef IppStatus (CV_STDCALL * ippiMinEigenValGetBufferSize)(IppiSize, int, int, int*);
+    typedef IppStatus (CV_STDCALL * ippiMinEigenVal)(const void*, int, Ipp32f*, int, IppiSize, IppiKernelType, int, int, Ipp8u*);
+    IppiKernelType kerType;
+    int kerSize = ksize;
```

Review comment:
please, fix http://build.opencv.org/builders/precommit_docs/builds/9696/steps/whitespace/logs/warnings%20%281%29
**File:** modules/imgproc/src/corner.cpp
**Change Type:** modified
**Context:** PR #2605: IPP: cornerMinEigenVal - Merge with extra: Itseez/opencv_extra#167 check_regression=_Img_MinEigenVal*
**Review Line:** 512

**Code Changes:**
```diff
+                CV_SUPPRESS_DEPRECATED_START
+                if (ok >= 0) ok = ippiMulC_32f_C1IR(norm_coef, (Ipp32f*) dst.data, (int) dst.step, srcRoi);
+                CV_SUPPRESS_DEPRECATED_END
+                if (ok >= 0)
+                    return;
+            }
+            setIppErrorStatus();
+        }
+    }
+#endif
     cornerEigenValsVecs( src, dst, blockSize, ksize, MINEIGENVAL, 0, borderType );
```

Review comment:
``` else setIppErrorStatus(); ```
**File:** modules/imgproc/src/corner.cpp
**Change Type:** modified
**Context:** PR #2605: IPP: cornerMinEigenVal - Merge with extra: Itseez/opencv_extra#167 check_regression=_Img_MinEigenVal*

**Code Changes:**
```diff
@@ -460,10 +460,63 @@ void cv::cornerMinEigenVal( InputArray _src, OutputArray _dst, int blockSize, in
     Mat src = _src.getMat();
     _dst.create( src.size(), CV_32FC1 );
     Mat dst = _dst.getMat();
+
+#if defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY) && (IPP_VERSION_MAJOR >= 8)
+    typedef IppStatus (CV_STDCALL * ippiMinEigenValGetBufferSize)(IppiSize, int, int, int*);
+    typedef IppStatus (CV_STDCALL * ippiMinEigenVal)(const void*, int, Ipp32f*, int, IppiSize, IppiKernelType, int, int, Ipp8u*);
+    IppiKernelType kerType;
+    int kerSize = ksize;
```

Review comment:
`if (ok >= 0) ok = ippiMulC_32f_C1IR(..)`
**File:** modules/imgproc/perf/perf_corners.cpp
**Change Type:** added
**Context:** PR #2605: IPP: cornerMinEigenVal - Merge with extra: Itseez/opencv_extra#167 check_regression=_Img_MinEigenVal*

**Code Changes:**
```diff
@@ -0,0 +1,92 @@
+#include "perf_precomp.hpp"
+
+using namespace std;
+using namespace cv;
+using namespace perf;
+using std::tr1::make_tuple;
+using std::tr1::get;
+
+CV_ENUM(BorderType, BORDER_REPLICATE, BORDER_CONSTANT, BORDER_REFLECT, BORDER_REFLECT_101)
```

Review comment:
`ASSERT_FALSE(src.empty()) << "Unable to load source image" << filename;` is more informative
**File:** modules/imgproc/src/corner.cpp
**Change Type:** modified
**Context:** PR #2605: IPP: cornerMinEigenVal - Merge with extra: Itseez/opencv_extra#167 check_regression=_Img_MinEigenVal*

**Code Changes:**
```diff
@@ -460,10 +460,63 @@ void cv::cornerMinEigenVal( InputArray _src, OutputArray _dst, int blockSize, in
     Mat src = _src.getMat();
     _dst.create( src.size(), CV_32FC1 );
     Mat dst = _dst.getMat();
+
+#if defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY) && (IPP_VERSION_MAJOR >= 8)
+    typedef IppStatus (CV_STDCALL * ippiMinEigenValGetBufferSize)(IppiSize, int, int, int*);
+    typedef IppStatus (CV_STDCALL * ippiMinEigenVal)(const void*, int, Ipp32f*, int, IppiSize, IppiKernelType, int, int, Ipp8u*);
+    IppiKernelType kerType;
+    int kerSize = ksize;
```

Review comment:
can we use AutoBuffer here?
**File:** modules/imgproc/src/corner.cpp
**Change Type:** modified
**Context:** PR #2605: IPP: cornerMinEigenVal - Merge with extra: Itseez/opencv_extra#167 check_regression=_Img_MinEigenVal*

**Code Changes:**
```diff
@@ -460,10 +460,63 @@ void cv::cornerMinEigenVal( InputArray _src, OutputArray _dst, int blockSize, in
     Mat src = _src.getMat();
     _dst.create( src.size(), CV_32FC1 );
     Mat dst = _dst.getMat();
+
+#if defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY) && (IPP_VERSION_MAJOR >= 8)
+    typedef IppStatus (CV_STDCALL * ippiMinEigenValGetBufferSize)(IppiSize, int, int, int*);
+    typedef IppStatus (CV_STDCALL * ippiMinEigenVal)(const void*, int, Ipp32f*, int, IppiSize, IppiKernelType, int, int, Ipp8u*);
+    IppiKernelType kerType;
+    int kerSize = ksize;
```

Review comment:
Yes. Changed.
**File:** cmake/templates/OpenCVConfig.cmake.in
**Change Type:** modified
**Context:** PR #2458: OpenCV_MODULES_SUFFIX variable added to OpenCVConfig.cmake - To enable custom module configurations for Android SDK. To branch 2.4 instead o...

**Code Changes:**
```diff
@@ -18,31 +18,35 @@
 #    This file will define the following variables:
 #      - OpenCV_LIBS                     : The list of all imported targets for OpenCV modules.
 #      - OpenCV_INCLUDE_DIRS             : The OpenCV include directories.
-#      - OpenCV_COMPUTE_CAPABILITIES     : The version of compute capability
-#      - OpenCV_ANDROID_NATIVE_API_LEVEL : Minimum required level of Android API
+#      - OpenCV_COMPUTE_CAPABILITIES     : The version of compute capability.
+#      - OpenCV_ANDROID_NATIVE_API_LEVEL : Minimum required level of Android API.
 #      - OpenCV_VERSION                  : The version of this OpenCV build: "@OPENCV_VERSION@"
 #      - OpenCV_VERSION_MAJOR            : Major version part of OpenCV_VERSION: "@OPENCV_VERSION_MAJOR@"
```

Review comment:
Eh... why not leave it as it was, except with a different variable name?
**File:** cmake/templates/OpenCVConfig.cmake.in
**Change Type:** modified
**Context:** PR #2458: OpenCV_MODULES_SUFFIX variable added to OpenCVConfig.cmake - To enable custom module configurations for Android SDK. To branch 2.4 instead o...

**Code Changes:**
```diff
@@ -18,31 +18,35 @@
 #    This file will define the following variables:
 #      - OpenCV_LIBS                     : The list of all imported targets for OpenCV modules.
 #      - OpenCV_INCLUDE_DIRS             : The OpenCV include directories.
-#      - OpenCV_COMPUTE_CAPABILITIES     : The version of compute capability
-#      - OpenCV_ANDROID_NATIVE_API_LEVEL : Minimum required level of Android API
+#      - OpenCV_COMPUTE_CAPABILITIES     : The version of compute capability.
+#      - OpenCV_ANDROID_NATIVE_API_LEVEL : Minimum required level of Android API.
 #      - OpenCV_VERSION                  : The version of this OpenCV build: "@OPENCV_VERSION@"
 #      - OpenCV_VERSION_MAJOR            : Major version part of OpenCV_VERSION: "@OPENCV_VERSION_MAJOR@"
```

Review comment:
I'd use `NOT DEFINED` here.
**File:** cmake/templates/OpenCVConfig.cmake.in
**Change Type:** modified
**Context:** PR #2458: OpenCV_MODULES_SUFFIX variable added to OpenCVConfig.cmake - To enable custom module configurations for Android SDK. To branch 2.4 instead o...

**Code Changes:**
```diff
@@ -18,31 +18,35 @@
 #    This file will define the following variables:
 #      - OpenCV_LIBS                     : The list of all imported targets for OpenCV modules.
 #      - OpenCV_INCLUDE_DIRS             : The OpenCV include directories.
-#      - OpenCV_COMPUTE_CAPABILITIES     : The version of compute capability
-#      - OpenCV_ANDROID_NATIVE_API_LEVEL : Minimum required level of Android API
+#      - OpenCV_COMPUTE_CAPABILITIES     : The version of compute capability.
+#      - OpenCV_ANDROID_NATIVE_API_LEVEL : Minimum required level of Android API.
 #      - OpenCV_VERSION                  : The version of this OpenCV build: "@OPENCV_VERSION@"
 #      - OpenCV_VERSION_MAJOR            : Major version part of OpenCV_VERSION: "@OPENCV_VERSION_MAJOR@"
```

Review comment:
Wrong section; this is not an output variable. I'd move it to the advanced variables section. Also, you added periods to the previous variables' description, but not this one's.
**File:** cmake/templates/OpenCVConfig.cmake.in
**Change Type:** modified
**Context:** PR #2458: OpenCV_MODULES_SUFFIX variable added to OpenCVConfig.cmake - To enable custom module configurations for Android SDK. To branch 2.4 instead o...

**Code Changes:**
```diff
@@ -18,31 +18,35 @@
 #    This file will define the following variables:
 #      - OpenCV_LIBS                     : The list of all imported targets for OpenCV modules.
 #      - OpenCV_INCLUDE_DIRS             : The OpenCV include directories.
-#      - OpenCV_COMPUTE_CAPABILITIES     : The version of compute capability
-#      - OpenCV_ANDROID_NATIVE_API_LEVEL : Minimum required level of Android API
+#      - OpenCV_COMPUTE_CAPABILITIES     : The version of compute capability.
+#      - OpenCV_ANDROID_NATIVE_API_LEVEL : Minimum required level of Android API.
 #      - OpenCV_VERSION                  : The version of this OpenCV build: "@OPENCV_VERSION@"
 #      - OpenCV_VERSION_MAJOR            : Major version part of OpenCV_VERSION: "@OPENCV_VERSION_MAJOR@"
```

Review comment:
Not quite what I meant. What I meant was why not just change `modules_file_suffix` to `OpenCV_MODULES_SUFFIX`, and initialize it by default if it's not set? I would really like `modules_file_suffix` to be gone, because it's a rather bad name to define in a public config file.
**File:** samples/ocl/facedetect.cpp
**Change Type:** modified
**Context:** PR #2965: Update facedetect.cpp - Somebody forgot to add curly brackets
**Review Line:** 96

**Code Changes:**
```diff
@@ -93,9 +93,10 @@ static int facedetect_one_thread(bool useCPU, double scale )
         if( image.empty() )
         {
             capture = cvCaptureFromAVI( inputName.c_str() );
-            if(!capture)
+            if(!capture){
                 cout << "Capture from AVI didn't work" << endl;
-            return EXIT_FAILURE;
+                return EXIT_FAILURE;
+            }
         }
```

Review comment:
Looks like bracket should be on the new line (for file style consistency), also spaces in the `if`.
**File:** modules/imgproc/src/color.cpp
**Change Type:** modified
**Context:** PR #2586: disabled some IPP funcs - Disabled functions: - ippiNorm_Inf_16u_C1MR - ippiColorToGray_8u_C3C1R - ippiColorToGray_16u_C3C1R - ippiColorToGr...

**Code Changes:**
```diff
@@ -200,12 +200,14 @@ void CvtColorLoop(const Mat& src, Mat& dst, const Cvt& cvt)
 }
 
 #if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
+
 typedef IppStatus (CV_STDCALL* ippiReorderFunc)(const void *, int, void *, int, IppiSize, const int *);
 typedef IppStatus (CV_STDCALL* ippiGeneralFunc)(const void *, int, void *, int, IppiSize);
 typedef IppStatus (CV_STDCALL* ippiColor2GrayFunc)(const void *, int, void *, int, IppiSize, const Ipp32f *);
 
 template <typename Cvt>
```

Review comment:
`#if 0` will look better
**File:** modules/core/src/stat.cpp
**Change Type:** modified
**Context:** PR #2597: IPP: countNonZero - check_regression=_Count_ test_filter=_Count_ test_modules=core build_examples=OFF
**Review Line:** 707

**Code Changes:**
```diff
+        if (src.isContinuous())
+        {
+            roiSize.width = (Ipp32s)src.total();
+            roiSize.height = 1;
+            srcstep = (Ipp32s)src.total() * CV_ELEM_SIZE(type);
+        }
+
+        int depth = CV_MAT_DEPTH(type);
+        if (depth == CV_8U)
+            status = ippiCountInRange_8u_C1R((const Ipp8u *)src.data, srcstep, roiSize, &count, 0, 0);
+        else if (depth == CV_32F)
```

Review comment:
Does this optimization make sence for performance?
**File:** modules/core/src/stat.cpp
**Change Type:** modified
**Context:** PR #2597: IPP: countNonZero - check_regression=_Count_ test_filter=_Count_ test_modules=core build_examples=OFF
**Review Line:** 707

**Code Changes:**
```diff
+        if (src.isContinuous())
+        {
+            roiSize.width = (Ipp32s)src.total();
+            roiSize.height = 1;
+            srcstep = (Ipp32s)src.total() * CV_ELEM_SIZE(type);
+        }
+
+        int depth = CV_MAT_DEPTH(type);
+        if (depth == CV_8U)
+            status = ippiCountInRange_8u_C1R((const Ipp8u *)src.data, srcstep, roiSize, &count, 0, 0);
+        else if (depth == CV_32F)
```

Review comment:
yes, and it's necessary for dims > 2
**File:** modules/imgproc/src/imgwarp.cpp
**Change Type:** modified
**Context:** PR #220: sse2 version of resize area fast - sse2 version of resize area fast for types CV_(8, 16)UC(1, 3, 4)
**Review Line:** 1274

**Code Changes:**
```diff
+        __m128i delta2 = _mm_set1_epi16(2);
+
+        if (cn == 1)
+        {
+            __m128i masklow = _mm_set1_epi16(0x00ff);
+            for ( ; dx < w - 8; dx += 8, S0 += 16, S1 += 16, D += 8)
+            {
+                __m128i r0 = _mm_loadu_si128((const __m128i*)S0);
+                __m128i r1 = _mm_loadu_si128((const __m128i*)S1);
+
+                __m128i s0 = _mm_add_epi16(_mm_srli_epi16(r0, 8), _mm_and_si128(r0, masklow));
```

Review comment:
You can safely change loop condition to `dx <= w - 8`. You will process 8 more pixels with SIMD ) Same applicable to the most of other vectorized loops.
**File:** modules/imgproc/src/imgwarp.cpp
**Change Type:** modified
**Context:** PR #220: sse2 version of resize area fast - sse2 version of resize area fast for types CV_(8, 16)UC(1, 3, 4)

**Code Changes:**
```diff
@@ -1241,27 +1241,217 @@ static void resizeGeneric_( const Mat& src, Mat& dst,
 template <typename T, typename WT>
 struct ResizeAreaFastNoVec
 {
-    ResizeAreaFastNoVec(int /*_scale_x*/, int /*_scale_y*/,
-        int /*_cn*/, int /*_step*//*, const int**/ /*_ofs*/) { }
-    int operator() (const T* /*S*/, T* /*D*/, int /*w*/) const { return 0; }
+    ResizeAreaFastNoVec(int, int) { }
+    ResizeAreaFastNoVec(int, int, int, int) { }
+    int operator() (const T*, T*, int) const
```

Review comment:
Please remove these comments from final version.
**File:** modules/imgproc/src/imgwarp.cpp
**Change Type:** modified
**Context:** PR #220: sse2 version of resize area fast - sse2 version of resize area fast for types CV_(8, 16)UC(1, 3, 4)
**Review Line:** 1336

**Code Changes:**
```diff
+                s0 = _mm_add_epi16(s1, _mm_add_epi16(s0, delta2));
+                s0 = _mm_packus_epi16(_mm_srli_epi16(s0, 2), zero);
+                _mm_storel_epi64((__m128i*)(D+4), s0);
+            }
+        }
+
+        return dx;
+    }
+
+private:
+    int cn;
```

Review comment:
It is better to not fail inside this and similar functors. You can safely return 0 if it is called with some unsupported argument. It will not change much right now but will simplify future support and extension of the code. (lines shifted - this comment if for line 1312)
**File:** modules/imgproc/src/imgwarp.cpp
**Change Type:** modified
**Context:** PR #220: sse2 version of resize area fast - sse2 version of resize area fast for types CV_(8, 16)UC(1, 3, 4)
**Review Line:** 1391

**Code Changes:**
```diff
+            for ( ; dx < w - 3; dx += 3, S0 += 6, S1 += 6, D += 3)
+            {
+                __m128i r0 = _mm_loadu_si128((const __m128i*)S0);
+                __m128i r1 = _mm_loadu_si128((const __m128i*)S1);
+
+                __m128i r0_16l = _mm_unpacklo_epi16(r0, zero);
+                __m128i r0_16h = _mm_unpacklo_epi16(_mm_srli_si128(r0, 6), zero);
+                __m128i r1_16l = _mm_unpacklo_epi16(r1, zero);
+                __m128i r1_16h = _mm_unpacklo_epi16(_mm_srli_si128(r1, 6), zero);
+
+                __m128i s0 = _mm_add_epi16(r0_16l, r0_16h);
```

Review comment:
it is good to undef such defines right after usage (e.g. at the end of current function). (lines shifted - this comment if for line 1367)
**File:** modules/imgproc/src/min_enclosing_triangle.cpp
**Change Type:** added
**Context:** PR #1470: Minimum enclosing triangle of a 2D point set - Added a new function called `minEnclosingTriangle` to the `imgproc` module which computes the...

**Code Changes:**
```diff
@@ -0,0 +1,1563 @@
+/*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.
+//
+//  INFORMATION REGARDING THE CONTRIBUTION:
```

Review comment:
there are non-ASCII characters in comments, please, fix it
**File:** modules/imgproc/include/opencv2/imgproc.hpp
**Change Type:** modified
**Context:** PR #1470: Minimum enclosing triangle of a 2D point set - Added a new function called `minEnclosingTriangle` to the `imgproc` module which computes the...

**Code Changes:**
```diff
@@ -1451,6 +1451,9 @@ CV_EXPORTS_W void boxPoints(RotatedRect box, OutputArray points);
 CV_EXPORTS_W void minEnclosingCircle( InputArray points,
                                       CV_OUT Point2f& center, CV_OUT float& radius );
 
+//! computes the minimal enclosing triangle for a set of points and returns its area
+CV_EXPORTS_W double minEnclosingTriangle( InputArray points, CV_OUT OutputArray triangle );
+
 //! matches two contours using one of the available algorithms
 CV_EXPORTS_W double matchShapes( InputArray contour1, InputArray contour2,
                                  int method, double parameter );
```

Review comment:
I think, it takes very little time to compute triangle area once the triangle is found. Why not have a single function double minEnclosingTriangle(InputArray points, OutputArray triangle) that returns the triangle area? This will also resolve problem with Python bindings, because for Python both functions will take a single parameter and therefore can not be distinguished one from another.
**File:** modules/imgproc/src/min_enclosing_triangle.cpp
**Change Type:** added
**Context:** PR #1470: Minimum enclosing triangle of a 2D point set - Added a new function called `minEnclosingTriangle` to the `imgproc` module which computes the...

**Code Changes:**
```diff
@@ -0,0 +1,1563 @@
+/*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.
+//
+//  INFORMATION REGARDING THE CONTRIBUTION:
```

Review comment:
using non-read-only static variables in extremely bad programming practice. It means that you will get very weird bugs or even program crashes if you try to call this function from different threads. Please, get rid of all such variables and pass them as function parameters
**File:** modules/imgproc/include/opencv2/imgproc.hpp
**Change Type:** modified
**Context:** PR #1381: Added documentation for LSD - Added documentation for the LineSegmentDetector class merged #1119. Including some updated + sample algorithm ...

**Code Changes:**
```diff
@@ -904,7 +904,7 @@ class LineSegmentDetector : public Algorithm
 {
 public:
 /**
- * Detect lines in the input image with the specified ROI.
+ * Detect lines in the input image.
  *
  * @param _image    A grayscale(CV_8UC1) input image.
  *                  If only a roi needs to be selected, use
@@ -913,8 +913,6 @@ class LineSegmentDetector : public Algorithm
```

Review comment:
Please don't add `const` to `InputArray`. It causes warnings, because `InputArray` is a reference, so it's already constant.
**File:** modules/imgproc/src/lsd.cpp
**Change Type:** modified
**Context:** PR #1381: Added documentation for LSD - Added documentation for the LineSegmentDetector class merged #1119. Including some updated + sample algorithm ...

**Code Changes:**
```diff
@@ -1,5 +1,6 @@
 /*M///////////////////////////////////////////////////////////////////////////////////////
-// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
+//
+//  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,
@@ -9,8 +10,7 @@
 //                           License Agreement
```

Review comment:
this is quite bad solution - convert the input/output image to color one in-place! Instead, the subsequent loop should be changed to handle both grayscale and color cases OR just add CV_Assert(_image->type() == CV_8UC3);
**File:** modules/imgproc/src/lsd.cpp
**Change Type:** modified
**Context:** PR #1381: Added documentation for LSD - Added documentation for the LineSegmentDetector class merged #1119. Including some updated + sample algorithm ...

**Code Changes:**
```diff
@@ -1,5 +1,6 @@
 /*M///////////////////////////////////////////////////////////////////////////////////////
-// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
+//
+//  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,
@@ -9,8 +10,7 @@
 //                           License Agreement
```

Review comment:
it's super inefficient - to call getMatRef() within a loop. Please, call it once outside of the loop. Also, please, use nested loop and .at<Vec3b>() operator instead of 1D access. The assert for array continuity should be removed.
**File:** modules/imgproc/src/lsd.cpp
**Change Type:** modified
**Context:** PR #1381: Added documentation for LSD - Added documentation for the LineSegmentDetector class merged #1119. Including some updated + sample algorithm ...

**Code Changes:**
```diff
@@ -1,5 +1,6 @@
 /*M///////////////////////////////////////////////////////////////////////////////////////
-// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
+//
+//  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,
@@ -9,8 +10,7 @@
 //                           License Agreement
```

Review comment:
The output must be in colour, so I agree that the asset is a better solution.
**File:** modules/imgproc/src/lsd.cpp
**Change Type:** modified
**Context:** PR #1381: Added documentation for LSD - Added documentation for the LineSegmentDetector class merged #1119. Including some updated + sample algorithm ...

**Code Changes:**
```diff
@@ -1,5 +1,6 @@
 /*M///////////////////////////////////////////////////////////////////////////////////////
-// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
+//
+//  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,
@@ -9,8 +10,7 @@
 //                           License Agreement
```

Review comment:
I've changed the getMatRef to be called only once (I though the method was just a cast of the data). I don't see why the .at() operator must be used, as it's slower + it's a per pixel operation. If you insist, I'll change it.
**File:** modules/imgproc/src/connectedcomponents.cpp
**Change Type:** modified
**Context:** PR #1342: correct range computation in connectedcomponents stats - I originally tried doing a more efficient implementation but it was difficult to do...

**Code Changes:**
```diff
@@ -92,20 +92,10 @@ namespace cv{
         }
         void operator()(int r, int c, int l){
             int *row = &statsv.at<int>(l, 0);
-            if(c > row[CC_STAT_WIDTH]){
-                row[CC_STAT_WIDTH] = c;
-            }else{
-                if(c < row[CC_STAT_LEFT]){
-                    row[CC_STAT_LEFT] = c;
-                }
```

Review comment:
should be r here instead of c