nareshmlx/opencv-pr huggingface dataset:
**File:** modules/objdetect/include/opencv2/objdetect/erfilter.hpp
**Change Type:** added
**Context:** PR #1159: Class-specific Extremal Region Filter algorithm as proposed in : - Neumann L., Matas J.: Real-Time Scene Text Localization and Recognition, ...

**Code Changes:**
```diff
@@ -0,0 +1,197 @@
+/*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:
Wouldn't it be more convenient to just make the constructor `explicit` instead?
**File:** modules/objdetect/include/opencv2/objdetect/erfilter.hpp
**Change Type:** added
**Context:** PR #1159: Class-specific Extremal Region Filter algorithm as proposed in : - Neumann L., Matas J.: Real-Time Scene Text Localization and Recognition, ...

**Code Changes:**
```diff
@@ -0,0 +1,197 @@
+/*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:
ok! I've used the "explicit" keyword as it prevents duplicate code.
**File:** modules/objdetect/src/icf.cpp
**Change Type:** added
**Context:** PR #137: Soft cascade implementation.

**Code Changes:**
```diff
@@ -0,0 +1,113 @@
+/*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 line gives error in Visual Studio "ambiguous call to overloaded function". Replace sqrt(2) with sqrt(2.0f).
**File:** modules/objdetect/src/softcascade.cpp
**Change Type:** added
**Context:** PR #137: Soft cascade implementation.

**Code Changes:**
```diff
@@ -0,0 +1,527 @@
+/*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 line gives error in Visual Studio "ambiguous call to overloaded function". Replace log(2) with log(2.0f)
**File:** modules/video/src/bgfg_gaussmix2.cpp
**Change Type:** modified
**Context:** PR #2509: modified BackgroundSubtractorMOG2::getBackgroundImage so that it can now... - ... work with gray-level images. Explanation: Although the cla...

**Code Changes:**
```diff
@@ -577,54 +577,48 @@ void BackgroundSubtractorMOG2::operator()(InputArray _image, OutputArray _fgmask
 void BackgroundSubtractorMOG2::getBackgroundImage(OutputArray backgroundImage) const
 {
     int nchannels = CV_MAT_CN(frameType);
-    CV_Assert( nchannels == 3 );
-    Mat meanBackground(frameSize, CV_8UC3, Scalar::all(0));
-
+    CV_Assert(nchannels == 1 || nchannels == 3);
+    Mat meanBackground(frameSize, CV_MAKETYPE(CV_8U, nchannels), Scalar::all(0));
     int firstGaussianIdx = 0;
```

Review comment:
this is terribly inefficient. You basically allocate a chunk of memory in dynamic head for each pixel. Simple solution would be to move vector<float> declaration outside of the loops.
**File:** modules/video/src/bgfg_gaussmix2.cpp
**Change Type:** modified
**Context:** PR #2509: modified BackgroundSubtractorMOG2::getBackgroundImage so that it can now... - ... work with gray-level images. Explanation: Although the cla...
**Review Line:** 608

**Code Changes:**
```diff
-            meanVal *= (1.f / totalWeight);
-            meanBackground.at<Vec3b>(row, col) = Vec3b(meanVal);
+            float invWeight = 1.f/totalWeight;
+            switch(nchannels)
+            {
+            case 1:
+                meanBackground.at<uchar>(row, col) = (uchar)(meanVal[0] * invWeight);
+                meanVal[0] = 0.f;
+                break;
+            case 3:
+                Vec3f& meanVec = *reinterpret_cast<Vec3f*>(&meanVal[0]);
```

Review comment:
actually, since the code is pretty compact, I would simply duplicate the above code twice (for 1- and 3-channel images) and put it inside the switch.
**File:** data/lbpcascades/lbpcascade_profileface.xml
**Change Type:** modified
**Context:** PR #1481: fixed malformed XML
**Review Line:** 8

**Code Changes:**
```diff
     This is 20x34 detector of profile faces using LBP features.
     It was created by Attila Novak during GSoC 2012.
     Note that the detector only detects faces rotated to the right,
     so you may want to run it on the original and on
     the flipped image to detect different profile faces.
 -->
-<?xml version="1.0"?>
 <opencv_storage>
 <cascade>
   <stageType>BOOST</stageType>
```

Review comment:
The parser expects this before any comments.
**File:** data/lbpcascades/lbpcascade_silverware.xml
**Change Type:** modified
**Context:** PR #1481: fixed malformed XML
**Review Line:** 9

**Code Changes:**
```diff
     This is 12x80 detector of the silverware (forks, spoons, knives) using LBP features.
     It was created by Attila Novak during GSoC 2012.
@@ -6,7 +7,6 @@
     (probably should run detector several times).
     It also assumes the "top view" when the camera optical axis is orthogonal to the table plane.
 -->
-<?xml version="1.0"?>
 <opencv_storage>
 <cascade>
   <stageType>BOOST</stageType>
```

Review comment:
The parser expects this before any comments.
**File:** modules/core/src/ocl.cpp
**Change Type:** modified
**Context:** PR #1824: updated patch to bring in the first functions with "transparent API" - this is updated variant of #1814

**Code Changes:**
```diff
@@ -114,8 +114,13 @@ typedef struct _cl_sampler *        cl_sampler;
 
 typedef int cl_int;
 typedef unsigned cl_uint;
-typedef long cl_long;
-typedef unsigned long cl_ulong;
+#if defined (_WIN32) && defined(_MSC_VER)
+    typedef __int64 cl_long;
+    typedef unsigned __int64 cl_ulong;
+#else
```

Review comment:
`cn > 4`
**File:** modules/core/src/precomp.hpp
**Change Type:** modified
**Context:** PR #1824: updated patch to bring in the first functions with "transparent API" - this is updated variant of #1814

**Code Changes:**
```diff
@@ -205,13 +205,30 @@ enum { BLOCK_SIZE = 1024 };
 
 inline bool checkScalar(const Mat& sc, int atype, int sckind, int akind)
 {
-    if( sc.dims > 2 || (sc.cols != 1 && sc.rows != 1) || !sc.isContinuous() )
+    if( sc.dims > 2 || !sc.isContinuous() )
+        return false;
+    Size sz = sc.size();
+    if(sz.width != 1 && sz.height != 1)
         return false;
```

Review comment:
Currently CMake PCH generator doesn't support dependency on auto-generated files (it is actual for Linux platforms). So please move this include into .cpp files (it is actual for all `precomp.hpp`). Error log sample: ``` [ 3%] Building CXX object modules/core/CMakeFiles/opencv_core_pch_dephelp.dir/opencv_core_pch_dephelp.cxx.o In file included from /home/buildslave/project/amdocl/buildslave/precommit_OCL-lin64/build/modules/core/opencv_core_pch_dephelp.cxx:1:0: /home/buildslave/project/amdocl/buildslave/precommit_OCL-lin64/opencv/modules/core/src/precomp.hpp:70:30: fatal error: opencl_kernels.hpp: No such file or directory compilation terminated. ```
**File:** modules/core/src/arithm.cpp
**Change Type:** modified
**Context:** PR #1824: updated patch to bring in the first functions with "transparent API" - this is updated variant of #1814
**Review Line:** 1009

**Code Changes:**
```diff
     {
-        _dst.create(src1.size(), src1.type());
-        Mat dst = _dst.getMat();
+        _dst.create(sz1, type1);
+        if( use_opencl && ocl_binary_op(*psrc1, *psrc2, _dst, _mask, bitwise, oclop, false) )
+            return;
         if( bitwise )
         {
             func = *tab;
-            c = (int)src1.elemSize();
+            cn = (int)CV_ELEM_SIZE(type1);
```

Review comment:
Any ideas about exceptions processing from `ocl_binary_op`? (double type is not supported by device, argument checks, other exceptions). For prototype it is OK, but we will need more accurate decision before we will start to move ocl functions.
**File:** modules/core/src/matrix.cpp
**Change Type:** modified
**Context:** PR #1824: updated patch to bring in the first functions with "transparent API" - this is updated variant of #1814
**Review Line:** 1898

**Code Changes:**
```diff
@@ -1665,7 +1895,7 @@ void _OutputArray::create(int rows, int cols, int mtype, int i, bool allowTransp
     create(2, sizes, mtype, i, allowTransposed, fixedDepthMask);
 }
 
-void _OutputArray::create(int dims, const int* sizes, int mtype, int i,
+void _OutputArray::create(int d, const int* sizes, int mtype, int i,
                           bool allowTransposed, int fixedDepthMask) const
 {
     int k = kind();
@@ -1683,7 +1913,7 @@ void _OutputArray::create(int dims, const int* sizes, int mtype, int i,
                 m.release();
```

Review comment:
Why was `dims` replaced?
**File:** modules/imgproc/src/color.cpp
**Change Type:** modified
**Context:** PR #1824: updated patch to bring in the first functions with "transparent API" - this is updated variant of #1814
**Review Line:** 2694

**Code Changes:**
```diff
 };
 
+
+static bool ocl_cvtColor( InputArray _src, OutputArray _dst, int code, int dcn )
+{
+    bool ok = true;
+    UMat src = _src.getUMat(), dst;
+    Size sz = src.size(), dstSz = sz;
+    int scn = src.channels(), depth = src.depth(), bidx;
+    size_t globalsize[] = { src.cols, src.rows };
+    ocl::Kernel k;
```

Review comment:
maybe `false`? Because if `k.empty() == true` then `cv::cvtColor` does nothing
**File:** modules/core/src/matrix.cpp
**Change Type:** modified
**Context:** PR #1824: updated patch to bring in the first functions with "transparent API" - this is updated variant of #1814
**Review Line:** 1898

**Code Changes:**
```diff
@@ -1665,7 +1895,7 @@ void _OutputArray::create(int rows, int cols, int mtype, int i, bool allowTransp
     create(2, sizes, mtype, i, allowTransposed, fixedDepthMask);
 }
 
-void _OutputArray::create(int dims, const int* sizes, int mtype, int i,
+void _OutputArray::create(int d, const int* sizes, int mtype, int i,
                           bool allowTransposed, int fixedDepthMask) const
 {
     int k = kind();
@@ -1683,7 +1913,7 @@ void _OutputArray::create(int dims, const int* sizes, int mtype, int i,
                 m.release();
```

Review comment:
because `_OutputArray` has method `dims(int i = -1)`
**File:** modules/core/src/arithm.cpp
**Change Type:** modified
**Context:** PR #1824: updated patch to bring in the first functions with "transparent API" - this is updated variant of #1814
**Review Line:** 1009

**Code Changes:**
```diff
     {
-        _dst.create(src1.size(), src1.type());
-        Mat dst = _dst.getMat();
+        _dst.create(sz1, type1);
+        if( use_opencl && ocl_binary_op(*psrc1, *psrc2, _dst, _mask, bitwise, oclop, false) )
+            return;
         if( bitwise )
         {
             func = *tab;
-            c = (int)src1.elemSize();
+            cn = (int)CV_ELEM_SIZE(type1);
```

Review comment:
IMHO `ocl_binary_op` should check device capabilities and input args inside and return `false` if so.
**File:** modules/photo/src/seamless_cloning.cpp
**Change Type:** modified
**Context:** PR #2409: Replaced calls to cout from photo module, by CV_Assert - I think CV_Assert should be more adequate

**Code Changes:**
```diff
@@ -41,7 +41,6 @@
 
 #include "precomp.hpp"
 #include "opencv2/photo.hpp"
-#include <iostream>
 #include <stdlib.h>
 
 #include "seamless_cloning.hpp"
@@ -93,11 +92,7 @@ void cv::seamlessClone(InputArray _src, InputArray _dst, InputArray _mask, Point
     int minyd = p.x - leny/2;
```

Review comment:
`CV_Assert(minxd >= 0 && minyd >= 0 && maxxd <= dest.rows && maxyd <= dest.cols);`
**File:** modules/photo/src/contrast_preserve.cpp
**Change Type:** modified
**Context:** PR #2409: Replaced calls to cout from photo module, by CV_Assert - I think CV_Assert should be more adequate

**Code Changes:**
```diff
@@ -45,7 +45,6 @@
 #include "math.h"
 #include <vector>
 #include <limits>
-#include <iostream>
 #include "contrast_preserve.hpp"
 
 using namespace std;
@@ -60,16 +59,7 @@ void cv::decolor(InputArray _src, OutputArray _dst, OutputArray _color_boost)
     _color_boost.create(I.size(), CV_8UC3);
```

Review comment:
`CV_Assert(!I.empty() && I.channels() == 3);`
**File:** modules/contrib/include/opencv2/contrib.hpp
**Change Type:** modified
**Context:** PR #2393: fixed defects from coverity.com, Xcode static analyzer
**Review Line:** 58

**Code Changes:**
```diff
@@ -55,7 +55,7 @@ class CV_EXPORTS Octree
 public:
     struct Node
     {
-        Node() {}
+        Node() { memset(this, 0, sizeof(Node)); }
         int begin, end;
         float x_min, x_max, y_min, y_max, z_min, z_max;
         int maxLevels;
```

Review comment:
It is better to remove ctor totally.
**File:** modules/calib3d/test/test_chesscorners.cpp
**Change Type:** modified
**Context:** PR #2393: fixed defects from coverity.com, Xcode static analyzer
**Review Line:** 313

**Code Changes:**
```diff
     }
 
-    sum_error /= count;
-    ts->printf(cvtest::TS::LOG, "Average error is %f\n", sum_error);
+    if (count != 0)
+        sum_error /= count;
+    ts->printf(cvtest::TS::LOG, "Average error is %f (%d patterns have been found)\n", sum_error, count);
 }
 
 double calcErrorMinError(const Size& cornSz, const vector<Point2f>& corners_found, const vector<Point2f>& corners_generated)
```

Review comment:
without `else` statement
**File:** modules/core/src/system.cpp
**Change Type:** modified
**Context:** PR #2393: fixed defects from coverity.com, Xcode static analyzer
**Review Line:** 429

**Code Changes:**
```diff
@@ -426,6 +426,7 @@ String format( const char* fmt, ... )
         String s(len, '\0');
         va_start(va, fmt);
         len = vsnprintf((char*)s.c_str(), len + 1, fmt, va);
+        (void)len;
         va_end(va);
         return s;
     }
```

Review comment:
Wouldn't it be better to remove the `len` assignment?
**File:** modules/calib3d/test/test_chesscorners.cpp
**Change Type:** modified
**Context:** PR #2393: fixed defects from coverity.com, Xcode static analyzer
**Review Line:** 313

**Code Changes:**
```diff
     }
 
-    sum_error /= count;
-    ts->printf(cvtest::TS::LOG, "Average error is %f\n", sum_error);
+    if (count != 0)
+        sum_error /= count;
+    ts->printf(cvtest::TS::LOG, "Average error is %f (%d patterns have been found)\n", sum_error, count);
 }
 
 double calcErrorMinError(const Size& cornSz, const vector<Point2f>& corners_found, const vector<Point2f>& corners_generated)
```

Review comment:
Zero `count` is an error, I presume, so why not? And in the other similar instance you used `ASSERT_NE`, so why not here?
**File:** modules/calib3d/test/test_chesscorners.cpp
**Change Type:** modified
**Context:** PR #2393: fixed defects from coverity.com, Xcode static analyzer
**Review Line:** 313

**Code Changes:**
```diff
     }
 
-    sum_error /= count;
-    ts->printf(cvtest::TS::LOG, "Average error is %f\n", sum_error);
+    if (count != 0)
+        sum_error /= count;
+    ts->printf(cvtest::TS::LOG, "Average error is %f (%d patterns have been found)\n", sum_error, count);
 }
 
 double calcErrorMinError(const Size& cornSz, const vector<Point2f>& corners_found, const vector<Point2f>& corners_generated)
```

Review comment:
Because it's really equal to zero in some cases (buildbot said me about it) and I don't want/know to fix it.
**File:** modules/core/src/system.cpp
**Change Type:** modified
**Context:** PR #2393: fixed defects from coverity.com, Xcode static analyzer
**Review Line:** 429

**Code Changes:**
```diff
@@ -426,6 +426,7 @@ String format( const char* fmt, ... )
         String s(len, '\0');
         va_start(va, fmt);
         len = vsnprintf((char*)s.c_str(), len + 1, fmt, va);
+        (void)len;
         va_end(va);
         return s;
     }
```

Review comment:
I suspect in such case analyzer will say `unchecked return value` > The function returns a value that indicates an error condition. If this is not checked, the error condition may not be handled correctly. (But maybe not)
**File:** modules/calib3d/test/test_chesscorners.cpp
**Change Type:** modified
**Context:** PR #2393: fixed defects from coverity.com, Xcode static analyzer
**Review Line:** 313

**Code Changes:**
```diff
     }
 
-    sum_error /= count;
-    ts->printf(cvtest::TS::LOG, "Average error is %f\n", sum_error);
+    if (count != 0)
+        sum_error /= count;
+    ts->printf(cvtest::TS::LOG, "Average error is %f (%d patterns have been found)\n", sum_error, count);
 }
 
 double calcErrorMinError(const Size& cornSz, const vector<Point2f>& corners_found, const vector<Point2f>& corners_generated)
```

Review comment:
I see. Then can you at least put the `printf` below into the `if` branch, so that it doesn't claim 0 average error when in fact no errors were calculated? And perhaps print a different message in the `else` branch.
**File:** modules/calib3d/test/test_chesscorners.cpp
**Change Type:** modified
**Context:** PR #2393: fixed defects from coverity.com, Xcode static analyzer
**Review Line:** 314

**Code Changes:**
```diff
 
-    sum_error /= count;
-    ts->printf(cvtest::TS::LOG, "Average error is %f\n", sum_error);
+    if (count != 0)
+        sum_error /= count;
+    ts->printf(cvtest::TS::LOG, "Average error is %f (%d patterns have been found)\n", sum_error, count);
 }
 
 double calcErrorMinError(const Size& cornSz, const vector<Point2f>& corners_found, const vector<Point2f>& corners_generated)
```

Review comment:
I guess this message is enough
**File:** platforms/scripts/cmake_android_all_cameras.py
**Change Type:** modified
**Context:** PR #1815: NativeCamera build with AndroidStub backported from OpenCV master.

**Code Changes:**
```diff
@@ -7,6 +7,12 @@
 ScriptHome = os.path.split(sys.argv[0])[0]
 ConfFile = open(os.path.join(ScriptHome, "camera_build.conf"), "rt")
 HomeDir = os.getcwd()
+
+stub = os.environ.get("ANDROID_STUB_ROOT", "")
+
+if (stub == ""):
+    print("Warning: ANDROID_STUB_ROOT environment variable is not set or is empty")
+
```

Review comment:
Wouldn't it make more sense to put this under the `except`?
**File:** platforms/scripts/cmake_android_all_cameras.py
**Change Type:** modified
**Context:** PR #1815: NativeCamera build with AndroidStub backported from OpenCV master.

**Code Changes:**
```diff
@@ -7,6 +7,12 @@
 ScriptHome = os.path.split(sys.argv[0])[0]
 ConfFile = open(os.path.join(ScriptHome, "camera_build.conf"), "rt")
 HomeDir = os.getcwd()
+
+stub = os.environ.get("ANDROID_STUB_ROOT", "")
+
+if (stub == ""):
+    print("Warning: ANDROID_STUB_ROOT environment variable is not set or is empty")
+
```

Review comment:
I think that warning is useful even it is set to empty. And you're right. I change the warning message.
**File:** platforms/scripts/cmake_android_all_cameras.py
**Change Type:** modified
**Context:** PR #1815: NativeCamera build with AndroidStub backported from OpenCV master.

**Code Changes:**
```diff
@@ -7,6 +7,12 @@
 ScriptHome = os.path.split(sys.argv[0])[0]
 ConfFile = open(os.path.join(ScriptHome, "camera_build.conf"), "rt")
 HomeDir = os.getcwd()
+
+stub = os.environ.get("ANDROID_STUB_ROOT", "")
+
+if (stub == ""):
+    print("Warning: ANDROID_STUB_ROOT environment variable is not set or is empty")
+
```

Review comment:
I'd use `os.environ.get("ANDROID_STUB_ROOT", "")` then.
**File:** modules/core/test/test_umat.cpp
**Change Type:** modified
**Context:** PR #2286: UMat: issue in OpenCLAllocator::unmap() - It is minimal reproducer for the problem.
**Review Line:** 937

**Code Changes:**
```diff
+    catch (...)
+    {
+        exceptionDetected = true;
+    }
+    ASSERT_TRUE(exceptionDetected); // data race
+}
+
+TEST(UMat, DISABLED_Test_same_behaviour_write_and_read)
+{
+    bool exceptionDetected = false;
+    try
```

Review comment:
this test (and probably others from same_behaviour series) is not valid in my opinion. Need to discuss.
**File:** modules/core/src/gpu_stream.cpp
**Change Type:** modified
**Context:** PR #1281: Rewrite Ptr - This replaces OpenCV's Ptr with a rewritten version. The new version is safer, as well as more flexible, but is, unfortunately...

**Code Changes:**
```diff
@@ -100,7 +100,7 @@ cv::gpu::Stream::Stream()
 #ifndef HAVE_CUDA
     throw_no_cuda();
 #else
-    impl_ = new Impl;
+    impl_ = makePtr<Impl>();
 #endif
 }
 
@@ -182,7 +182,7 @@ void cv::gpu::Stream::enqueueHostCallback(StreamCallback callback, void* userDat
```

Review comment:
``` static Stream s(makePtr<Impl>(0)); ```
**File:** modules/core/include/opencv2/core/gpu.hpp
**Change Type:** modified
**Context:** PR #1281: Rewrite Ptr - This replaces OpenCV's Ptr with a rewritten version. The new version is safer, as well as more flexible, but is, unfortunately...
**Review Line:** 672

**Code Changes:**
```diff
@@ -666,12 +666,6 @@ CV_EXPORTS void printShortCudaDeviceInfo(int device);
 
 }} // namespace cv { namespace gpu {
 
-namespace cv {
-
-template <> CV_EXPORTS void Ptr<cv::gpu::Stream::Impl>::delete_obj();
-template <> CV_EXPORTS void Ptr<cv::gpu::Event::Impl>::delete_obj();
-
-}
 
 #include "opencv2/core/gpu.inl.hpp"
 
```

Review comment:
It can be replaced with: ``` template <> CV_EXPORTS void DefaultDeleter<cv::gpu::Stream::Impl>::operator ()(cv::gpu::Stream::Impl* obj) const; template <> CV_EXPORTS void DefaultDeleter<cv::gpu::Event::Impl>::operator ()(cv::gpu::Event::Impl* obj) const; ```
**File:** modules/core/include/opencv2/core/gpu.hpp
**Change Type:** modified
**Context:** PR #1281: Rewrite Ptr - This replaces OpenCV's Ptr with a rewritten version. The new version is safer, as well as more flexible, but is, unfortunately...
**Review Line:** 672

**Code Changes:**
```diff
@@ -666,12 +666,6 @@ CV_EXPORTS void printShortCudaDeviceInfo(int device);
 
 }} // namespace cv { namespace gpu {
 
-namespace cv {
-
-template <> CV_EXPORTS void Ptr<cv::gpu::Stream::Impl>::delete_obj();
-template <> CV_EXPORTS void Ptr<cv::gpu::Event::Impl>::delete_obj();
-
-}
 
 #include "opencv2/core/gpu.inl.hpp"
 
```

Review comment:
What for? I deleted them, because they do the same thing as `DefaultDeleter`.
**File:** modules/core/include/opencv2/core/gpu.hpp
**Change Type:** modified
**Context:** PR #1281: Rewrite Ptr - This replaces OpenCV's Ptr with a rewritten version. The new version is safer, as well as more flexible, but is, unfortunately...
**Review Line:** 672

**Code Changes:**
```diff
@@ -666,12 +666,6 @@ CV_EXPORTS void printShortCudaDeviceInfo(int device);
 
 }} // namespace cv { namespace gpu {
 
-namespace cv {
-
-template <> CV_EXPORTS void Ptr<cv::gpu::Stream::Impl>::delete_obj();
-template <> CV_EXPORTS void Ptr<cv::gpu::Event::Impl>::delete_obj();
-
-}
 
 #include "opencv2/core/gpu.inl.hpp"
 
```

Review comment:
Yes, you are right. I've just understood that new Ptr works with incomplete types.
**File:** modules/highgui/test/test_grfmt.cpp
**Change Type:** modified
**Context:** PR #2378: added jpeg progressive support. - Related to this ticket: http://code.opencv.org/issues/3547.

**Code Changes:**
```diff
@@ -386,6 +386,30 @@ TEST(Highgui_Jpeg, encode_empty)
 
     ASSERT_THROW(cv::imencode(".jpg", img, jpegImg), cv::Exception);
 }
+
+TEST(Highgui_Jpeg, encode_decode_progressive_jpeg)
+{
+    cvtest::TS& ts = *cvtest::TS::ptr();
+    string input = string(ts.get_data_path()) + "../cv/shared/lena.png";
+    cv::Mat img = cv::imread(input);
```

Review comment:
I recommend you to use EXPECT_MAT_NEAR macro like this: EXPECT_MAT_NEAR(img_jpg_progressive, img_jpg_normal, 0). It is OpenCV test module extension for GTest. It makes the same check but it writes differs element that useful for test fail debug.