nareshmlx/opencv-pr huggingface dataset:
**File:** modules/calib3d/src/ptsetreg.cpp
**Change Type:** added
**Context:** PR #592: rewritten several functions from calib3d: findhomography, findfundamenta... - rewritten several functions from calib3d: findhomography, findf...

**Code Changes:**
```diff
@@ -0,0 +1,540 @@
+/*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:
this is a question of style. Since I forgot myself the meaning of the last Mat::create() parameters, I'd prefer to put it explicitly.
**File:** modules/calib3d/src/ptsetreg.cpp
**Change Type:** added
**Context:** PR #592: rewritten several functions from calib3d: findhomography, findfundamenta... - rewritten several functions from calib3d: findhomography, findf...
**Review Line:** 427

**Code Changes:**
```diff
+
+        const int N = 12;
+        double buf[N*N + N + N];
+        Mat A(N, N, CV_64F, &buf[0]);
+        Mat B(N, 1, CV_64F, &buf[0] + N*N);
+        Mat X(N, 1, CV_64F, &buf[0] + N*N + N);
+        double* Adata = A.ptr<double>();
+        double* Bdata = B.ptr<double>();
+        A = Scalar::all(0);
+
+        for( int i = 0; i < (N/3); i++ )
```

Review comment:
perhaps, the kernel will be extended to support n points (which could be used by the upcoming more efficient implementation of RANSAC)
**File:** modules/calib3d/src/fundam.cpp
**Change Type:** modified
**Context:** PR #592: rewritten several functions from calib3d: findhomography, findfundamenta... - rewritten several functions from calib3d: findhomography, findf...

**Code Changes:**
```diff
@@ -7,10 +7,11 @@
 //  copy or use the software.
 //
 //
-//                        Intel License Agreement
+//                          License Agreement
 //                For Open Source Computer Vision Library
 //
 // Copyright (C) 2000, Intel Corporation, all rights reserved.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
```

Review comment:
I want to retain the existing version. There is not much operations on those matrices. LtL will be replaced with &LtL[0][0], which is certainly portable.
**File:** modules/calib3d/src/ptsetreg.cpp
**Change Type:** added
**Context:** PR #592: rewritten several functions from calib3d: findhomography, findfundamenta... - rewritten several functions from calib3d: findhomography, findf...

**Code Changes:**
```diff
@@ -0,0 +1,540 @@
+/*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:
I would argue here. If even the author of `create` method refuses to use all its parameters then we should remove them completely from `create`. But if that arguments are useful then we should use them. Otherwise code becomes duplicated and bloated with a lot of "useful" but never-used code.
**File:** modules/calib3d/src/ptsetreg.cpp
**Change Type:** added
**Context:** PR #592: rewritten several functions from calib3d: findhomography, findfundamenta... - rewritten several functions from calib3d: findhomography, findf...
**Review Line:** 427

**Code Changes:**
```diff
+
+        const int N = 12;
+        double buf[N*N + N + N];
+        Mat A(N, N, CV_64F, &buf[0]);
+        Mat B(N, 1, CV_64F, &buf[0] + N*N);
+        Mat X(N, 1, CV_64F, &buf[0] + N*N + N);
+        double* Adata = A.ptr<double>();
+        double* Bdata = B.ptr<double>();
+        A = Scalar::all(0);
+
+        for( int i = 0; i < (N/3); i++ )
```

Review comment:
Probably here usage of auxiliary `buf` array is reasonable but you have not documented the intent of future extension. So other people editing this code will not take this possibility into account. However there are a lot of similar places if homography and fundamental matrix estimators. I pretty sure that we will not extend homography matrix to NxN )
**File:** modules/imgproc/perf/perf_houghLines.cpp
**Change Type:** modified
**Context:** PR #482: converted several more imgproc algorithms from c to c++ - converted cornersubpix, getrectsubpix, moments, distancetransform, houghlines, floo...

**Code Changes:**
```diff
@@ -36,5 +36,6 @@ PERF_TEST_P(Image_RhoStep_ThetaStep_Threshold, HoughLines,
 
     TEST_CYCLE() HoughLines(image, lines, rhoStep, thetaStep, threshold);
 
+    transpose(lines, lines);
     SANITY_CHECK(lines);
 }
```

Review comment:
Transpose of empty matrix simply returns another empty matrix, isn't it? The check seems unnecessary for me.
**File:** modules/imgproc/src/cornersubpix.cpp
**Change Type:** modified
**Context:** PR #482: converted several more imgproc algorithms from c to c++ - converted cornersubpix, getrectsubpix, moments, distancetransform, houghlines, floo...

**Code Changes:**
```diff
@@ -7,10 +7,11 @@
 //  copy or use the software.
 //
 //
-//                        Intel License Agreement
+//                           License Agreement
 //                For Open Source Computer Vision Library
 //
 // Copyright (C) 2000, Intel Corporation, all rights reserved.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
```

Review comment:
This assert will not be understood by library users. I suggest to give more descriptive names for `win_w` and `win_h` or duplicate their formulas inside the assert.
**File:** modules/imgproc/src/distransform.cpp
**Change Type:** modified
**Context:** PR #482: converted several more imgproc algorithms from c to c++ - converted cornersubpix, getrectsubpix, moments, distancetransform, houghlines, floo...

**Code Changes:**
```diff
@@ -7,10 +7,11 @@
 //  copy or use the software.
 //
 //
-//                        Intel License Agreement
+//                           License Agreement
 //                For Open Source Computer Vision Library
 //
 // Copyright (C) 2000, Intel Corporation, all rights reserved.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
```

Review comment:
If I understand the code correctly then this special version is now inaccessible from C++ interface. Could you please restore a possibility to call it from `cv::distanceTransform`? We are using it in one of our applications as `cv::distanceTransform(Mat_8UC1, OtherMat_8UC1, CV_DIST_L1, 3)` and it is important for app performance.
**File:** modules/imgproc/src/distransform.cpp
**Change Type:** modified
**Context:** PR #482: converted several more imgproc algorithms from c to c++ - converted cornersubpix, getrectsubpix, moments, distancetransform, houghlines, floo...
**Review Line:** 785

**Code Changes:**
```diff
+{
+    cv::Mat src = cv::cvarrToMat(srcarr);
+    const cv::Mat dst = cv::cvarrToMat(dstarr);
+    const cv::Mat labels = cv::cvarrToMat(labelsarr);
+
+    cv::distanceTransform(src, dst, labelsarr ? cv::_OutputArray(labels) : cv::_OutputArray(),
+                          distType, maskSize, labelType);
+
+}
+
+
```

Review comment:
This call can reallocate `labels` and `dst` Mats and caller will not get neither result nor error message. The simplest way to forbid such reallocation is to declare these Mats as `const`: ``` const cv::Mat dst = cv::cvarrToMat(dstarr); const cv::Mat labels = cv::cvarrToMat(labelsarr); ``` It will work because const Mats are getting `FIXED_TYPE+FIXED_SIZE` flag when converted to `OutputArray`
**File:** modules/imgproc/src/hough.cpp
**Change Type:** modified
**Context:** PR #482: converted several more imgproc algorithms from c to c++ - converted cornersubpix, getrectsubpix, moments, distancetransform, houghlines, floo...

**Code Changes:**
```diff
@@ -7,10 +7,11 @@
 //  copy or use the software.
 //
 //
-//                        Intel License Agreement
+//                           License Agreement
 //                For Open Source Computer Vision Library
 //
 // Copyright (C) 2000, Intel Corporation, all rights reserved.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
```

Review comment:
From my experience change from `ang` to `n*theta` will slightly shift the output of algorithm. Also please see my commit 16687a2 - casting to double is needed to make results consistent between all platforms. Our tests have identified the problem only for case of simple version by I think that the same is applicable for all variations of hough.
**File:** modules/imgproc/src/moments.cpp
**Change Type:** modified
**Context:** PR #482: converted several more imgproc algorithms from c to c++ - converted cornersubpix, getrectsubpix, moments, distancetransform, houghlines, floo...
**Review Line:** 39

**Code Changes:**
```diff
@@ -40,21 +40,22 @@
 //M*/
 #include "precomp.hpp"
 
+namespace cv
+{
+
 // The function calculates center of gravity and the central second order moments
-static void icvCompleteMomentState( CvMoments* moments )
+static void completeMomentState( Moments* moments )
 {
     double cx = 0, cy = 0;
     double mu20, mu11, mu02;
 
     assert( moments != 0 );
```

Review comment:
You have not updated license in this file :)
**File:** modules/imgproc/src/samplers.cpp
**Change Type:** modified
**Context:** PR #482: converted several more imgproc algorithms from c to c++ - converted cornersubpix, getrectsubpix, moments, distancetransform, houghlines, floo...
**Review Line:** 398

**Code Changes:**
```diff
-            }                                                               \
-        }                                                                   \
-    }                                                                       \
-                                                                            \
-    return CV_OK;                                                           \
+    cv::getRectSubPix(src, dst.size(), center, dst, dst.type());
 }
 
 
-/*#define srctype uchar
-#define dsttype uchar
```

Review comment:
`dst` might be reallocated.
**File:** modules/imgproc/src/samplers.cpp
**Change Type:** modified
**Context:** PR #482: converted several more imgproc algorithms from c to c++ - converted cornersubpix, getrectsubpix, moments, distancetransform, houghlines, floo...

**Code Changes:**
```diff
@@ -7,10 +7,11 @@
 //  copy or use the software.
 //
 //
-//                        Intel License Agreement
+//                           License Agreement
 //                For Open Source Computer Vision Library
 //
 // Copyright (C) 2000, Intel Corporation, all rights reserved.
+// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
```

Review comment:
And here same about `dst` reallocation.
**File:** modules/imgproc/src/segmentation.cpp
**Change Type:** modified
**Context:** PR #482: converted several more imgproc algorithms from c to c++ - converted cornersubpix, getrectsubpix, moments, distancetransform, houghlines, floo...
**Review Line:** 535

**Code Changes:**
```diff
+                        CvTermCriteria termcrit )
+{
+    cv::Mat src = cv::cvarrToMat(srcarr);
+    const cv::Mat dst = cv::cvarrToMat(dstarr);
+
+    cv::pyrMeanShiftFiltering(src, dst, sp0, sr, max_level, termcrit);
 }
+
```

Review comment:
Possible `dst` reallocation here. And license is not updated in this file.
**File:** modules/core/include/opencv2/core/core.hpp
**Change Type:** modified
**Context:** PR #317: several comp. geometry functions rewritten in C++ - several comp. geometry functions rewritten in C++. This PR is the first one on way 2.4->2...
**Review Line:** 3087

**Code Changes:**
```diff
@@ -3081,7 +3084,7 @@ template<typename _Tp, int m> class CV_EXPORTS VecCommaInitializer : public Matx
  \code
  void my_func(const cv::Mat& m)
  {
-    cv::AutoBuffer<float, 1000> buf; // create automatic buffer containing 1000 floats
+    cv::AutoBuffer<float> buf; // create automatic buffer containing 1000 floats
 
     buf.allocate(m.rows); // if m.rows <= 1000, the pre-allocated buffer is used,
                           // otherwise the buffer of "m.rows" floats will be allocated
@@ -3090,23 +3093,32 @@ template<typename _Tp, int m> class CV_EXPORTS VecCommaInitializer : public Matx
  }
```

Review comment:
Comment on this line is out of date
**File:** modules/core/include/opencv2/core/core.hpp
**Change Type:** modified
**Context:** PR #317: several comp. geometry functions rewritten in C++ - several comp. geometry functions rewritten in C++. This PR is the first one on way 2.4->2...
**Review Line:** 3093

**Code Changes:**
```diff
+    cv::AutoBuffer<float> buf; // create automatic buffer containing 1000 floats
 
     buf.allocate(m.rows); // if m.rows <= 1000, the pre-allocated buffer is used,
                           // otherwise the buffer of "m.rows" floats will be allocated
@@ -3090,23 +3093,32 @@ template<typename _Tp, int m> class CV_EXPORTS VecCommaInitializer : public Matx
  }
  \endcode
 */
-template<typename _Tp, size_t fixed_size=4096/sizeof(_Tp)+8> class CV_EXPORTS AutoBuffer
+template<typename _Tp, size_t fixed_size> class CV_EXPORTS AutoBuffer
 {
```

Review comment:
I would suggest to not remove the second template parameter. Lets change the default size but preserve a parameter. It is useful if the typical data size is known. For example NL-means denoising typically uses 21x21 window so you can declare `AutoBuffer<int, 21*21> window;` and avoid heap allocation in the most common scenario even if its size is slightly bigger than default buffer size.
**File:** modules/core/include/opencv2/core/core.hpp
**Change Type:** modified
**Context:** PR #317: several comp. geometry functions rewritten in C++ - several comp. geometry functions rewritten in C++. This PR is the first one on way 2.4->2...

**Code Changes:**
```diff
@@ -109,6 +109,8 @@ template<typename _Tp> class CV_EXPORTS MatIterator_;
 template<typename _Tp> class CV_EXPORTS MatConstIterator_;
 template<typename _Tp> class CV_EXPORTS MatCommaInitializer_;
 
+template<typename _Tp, size_t fixed_size = 1024/sizeof(_Tp)+8> class CV_EXPORTS AutoBuffer;
+
 CV_EXPORTS string format( const char* fmt, ... );
 CV_EXPORTS string tempfile( const char* suffix CV_DEFAULT(0));
 
@@ -2061,7 +2063,8 @@ CV_EXPORTS void swap(Mat& a, Mat& b);
```

Review comment:
Formatting is broken here
**File:** modules/imgproc/src/convhull.cpp
**Change Type:** modified
**Context:** PR #317: several comp. geometry functions rewritten in C++ - several comp. geometry functions rewritten in C++. This PR is the first one on way 2.4->2...

**Code Changes:**
```diff
@@ -40,18 +40,22 @@
 //M*/
 
 #include "precomp.hpp"
+#include <iostream>
 
-static int
-icvSklansky_32s( CvPoint** array, int start, int end, int* stack, int nsign, int sign2 )
+namespace cv
+{
```

Review comment:
Do we really need this dead code?
**File:** apps/CMakeLists.txt
**Change Type:** modified
**Context:** PR #322: Soft Cascade module - Move all functionality for soft cascade into dedicated module Add soft cascade training
**Review Line:** 3

**Code Changes:**
```diff
@@ -1,2 +1,4 @@
 add_subdirectory(haartraining)
 add_subdirectory(traincascade)
+add_subdirectory(sft)
+
```

Review comment:
maybe we should rename this app? (sft does not tell nothing about the task)
**File:** apps/sft/config.cpp
**Change Type:** added
**Context:** PR #322: Soft Cascade module - Move all functionality for soft cascade into dedicated module Add soft cascade training
**Review Line:** 128

**Code Changes:**
```diff
+    void operator ()(const T a) const {out << a << " ";}
+
+    std::ostream& out;
+private:
+    Out& operator=(Out const& other);
+};
+}
+
+std::ostream& sft::operator<<(std::ostream& out, const Config& m)
+{
+    out << std::setw(14) << std::left << "trainPath"    << m.trainPath     << std::endl
```

Review comment:
The structure name looks too generic. Can it cause a problem with included libs in future?
**File:** apps/sft/include/sft/dataset.hpp
**Change Type:** added
**Context:** PR #322: Soft Cascade module - Move all functionality for soft cascade into dedicated module Add soft cascade training

**Code Changes:**
```diff
@@ -0,0 +1,67 @@
+/*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:
move Dataset to cv::sft:: ?
**File:** apps/sft/sft.cpp
**Change Type:** added
**Context:** PR #322: Soft Cascade module - Move all functionality for soft cascade into dedicated module Add soft cascade training

**Code Changes:**
```diff
@@ -0,0 +1,161 @@
+/*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:
Minor: why do you use std::flush after std::endl? (I thought that std::endl always flushes the output buffer)
**File:** apps/sft/config.cpp
**Change Type:** added
**Context:** PR #322: Soft Cascade module - Move all functionality for soft cascade into dedicated module Add soft cascade training
**Review Line:** 128

**Code Changes:**
```diff
+    void operator ()(const T a) const {out << a << " ";}
+
+    std::ostream& out;
+private:
+    Out& operator=(Out const& other);
+};
+}
+
+std::ostream& sft::operator<<(std::ostream& out, const Config& m)
+{
+    out << std::setw(14) << std::left << "trainPath"    << m.trainPath     << std::endl
```

Review comment:
well, yes, I would rather put it to sft too.
**File:** apps/CMakeLists.txt
**Change Type:** modified
**Context:** PR #322: Soft Cascade module - Move all functionality for soft cascade into dedicated module Add soft cascade training
**Review Line:** 3

**Code Changes:**
```diff
@@ -1,2 +1,4 @@
 add_subdirectory(haartraining)
 add_subdirectory(traincascade)
+add_subdirectory(sft)
+
```

Review comment:
it will get opencv_ prefix automatically. I'm fine with the name, but any suggestions are appreciated
**File:** modules/softcascade/include/opencv2/softcascade/softcascade.hpp
**Change Type:** added
**Context:** PR #322: Soft Cascade module - Move all functionality for soft cascade into dedicated module Add soft cascade training
**Review Line:** 65

**Code Changes:**
```diff
+    Detection(const cv::Rect& b, const float c, int k = PEDESTRIAN) : bb(b), confidence(c), kind(k) {}
+
+    cv::Rect bb;
+    float confidence;
+    int kind;
+};
+
+class CV_EXPORTS Dataset
+{
+public:
+    typedef enum {POSITIVE = 1, NEGATIVE = 2} SampleType;
```

Review comment:
Agree with Vadim that "cv::Detection etc. is not very good"
**File:** apps/CMakeLists.txt
**Change Type:** modified
**Context:** PR #322: Soft Cascade module - Move all functionality for soft cascade into dedicated module Add soft cascade training
**Review Line:** 3

**Code Changes:**
```diff
@@ -1,2 +1,4 @@
 add_subdirectory(haartraining)
 add_subdirectory(traincascade)
+add_subdirectory(sft)
+
```

Review comment:
I understand about opencv_ but I really don't like such weird names. We have three apps now, but how we will distinguish between them if we will have more apps and all of them will have the names like sft, pdt, fhg, awqq,.. :) Long names are not so bad. Maybe opencv_trainsoftcascade? (by analogy with opencv_traincascade)
**File:** apps/sft/config.cpp
**Change Type:** added
**Context:** PR #322: Soft Cascade module - Move all functionality for soft cascade into dedicated module Add soft cascade training
**Review Line:** 128

**Code Changes:**
```diff
+    void operator ()(const T a) const {out << a << " ";}
+
+    std::ostream& out;
+private:
+    Out& operator=(Out const& other);
+};
+}
+
+std::ostream& sft::operator<<(std::ostream& out, const Config& m)
+{
+    out << std::setw(14) << std::left << "trainPath"    << m.trainPath     << std::endl
```

Review comment:
I've put it to anonymous namespace.
**File:** modules/softcascade/include/opencv2/softcascade/softcascade.hpp
**Change Type:** added
**Context:** PR #322: Soft Cascade module - Move all functionality for soft cascade into dedicated module Add soft cascade training
**Review Line:** 65

**Code Changes:**
```diff
+    Detection(const cv::Rect& b, const float c, int k = PEDESTRIAN) : bb(b), confidence(c), kind(k) {}
+
+    cv::Rect bb;
+    float confidence;
+    int kind;
+};
+
+class CV_EXPORTS Dataset
+{
+public:
+    typedef enum {POSITIVE = 1, NEGATIVE = 2} SampleType;
```

Review comment:
Since it located into cv::softcascade namespace i think it's legal to use such name.
**File:** apps/CMakeLists.txt
**Change Type:** modified
**Context:** PR #322: Soft Cascade module - Move all functionality for soft cascade into dedicated module Add soft cascade training
**Review Line:** 3

**Code Changes:**
```diff
@@ -1,2 +1,4 @@
 add_subdirectory(haartraining)
 add_subdirectory(traincascade)
+add_subdirectory(sft)
+
```

Review comment:
the target name will be opencv_trainsoftcascade. Is it Ok?
**File:** samples/java/sbt/README
**Change Type:** added
**Context:** PR #301: Adds samples for Java and Scala - A demo of the Java wrapper for OpenCV with two examples: 1) feature detection and matching and 2) face dete...

**Code Changes:**
```diff
@@ -0,0 +1,13 @@
+A demo of the Java wrapper for OpenCV with two examples:
+1) feature detection and matching and
+2) face detection.
+The examples are coded in Scala and Java.
+Anyone familiar with Java should be able to read the Scala examples.
+Please feel free to contribute code examples in Scala or Java, or any JVM language.
+
+To run the examples:
+1) Install OpenCV and copy the OpenCV jar to lib/.
```

Review comment:
Could we split lines into pieces 100 symbols max? Otherwise, diffs will be difficult to read.
**File:** doc/tutorials/introduction/desktop_java/java_dev_intro.rst
**Change Type:** added
**Context:** PR #301: Adds samples for Java and Scala - A demo of the Java wrapper for OpenCV with two examples: 1) feature detection and matching and 2) face dete...

**Code Changes:**
```diff
@@ -0,0 +1,523 @@
+
+.. _Java_Dev_Intro:
+
+
+Introduction to Java Development
+********************************
+
+Last updated: 12 February, 2013.
+
```

Review comment:
Sounds awkward, I don't like first 3 words and locally looks redundant. My suggestion: "On other OSes (and Windows actually) you can build OpenCV with Java support from sources." Or something like this...
**File:** doc/tutorials/introduction/desktop_java/java_dev_intro.rst
**Change Type:** added
**Context:** PR #301: Adds samples for Java and Scala - A demo of the Java wrapper for OpenCV with two examples: 1) feature detection and matching and 2) face dete...

**Code Changes:**
```diff
@@ -0,0 +1,523 @@
+
+.. _Java_Dev_Intro:
+
+
+Introduction to Java Development
+********************************
+
+Last updated: 12 February, 2013.
+
```

Review comment:
I would completely remove info about the primary repository, it is USELESS for users.
**File:** doc/tutorials/introduction/desktop_java/java_dev_intro.rst
**Change Type:** added
**Context:** PR #301: Adds samples for Java and Scala - A demo of the Java wrapper for OpenCV with two examples: 1) feature detection and matching and 2) face dete...

**Code Changes:**
```diff
@@ -0,0 +1,523 @@
+
+.. _Java_Dev_Intro:
+
+
+Introduction to Java Development
+********************************
+
+Last updated: 12 February, 2013.
+
```

Review comment:
How long it will be true? AFAIU `master` will have these changes soon.