Boring changes - superres.
authorRoman Donchenko <roman.donchenko@itseez.com>
Tue, 13 Aug 2013 13:57:06 +0000 (17:57 +0400)
committerRoman Donchenko <roman.donchenko@itseez.com>
Thu, 5 Sep 2013 15:02:58 +0000 (19:02 +0400)
modules/superres/perf/perf_superres.cpp
modules/superres/perf/perf_superres_ocl.cpp
modules/superres/src/btv_l1.cpp
modules/superres/src/btv_l1_gpu.cpp
modules/superres/src/btv_l1_ocl.cpp
modules/superres/src/frame_source.cpp
modules/superres/src/optical_flow.cpp
modules/superres/test/test_superres.cpp

index 83fb76e..9d83c94 100644 (file)
@@ -153,7 +153,7 @@ PERF_TEST_P(Size_MatType, SuperResolution_BTVL1,
         superRes->set("temporalAreaRadius", temporalAreaRadius);
         superRes->set("opticalFlow", opticalFlow);
 
-        superRes->setInput(new OneFrameSource_GPU(GpuMat(frame)));
+        superRes->setInput(makePtr<OneFrameSource_GPU>(GpuMat(frame)));
 
         GpuMat dst;
         superRes->nextFrame(dst);
@@ -171,7 +171,7 @@ PERF_TEST_P(Size_MatType, SuperResolution_BTVL1,
         superRes->set("temporalAreaRadius", temporalAreaRadius);
         superRes->set("opticalFlow", opticalFlow);
 
-        superRes->setInput(new OneFrameSource_CPU(frame));
+        superRes->setInput(makePtr<OneFrameSource_CPU>(frame));
 
         Mat dst;
         superRes->nextFrame(dst);
index 1d3fee2..ce8f593 100644 (file)
@@ -134,7 +134,7 @@ PERF_TEST_P(Size_MatType, SuperResolution_BTVL1_OCL,
     superRes_ocl->set("temporalAreaRadius", temporalAreaRadius);
     superRes_ocl->set("opticalFlow", opticalFlowOcl);
 
-    superRes_ocl->setInput(new OneFrameSource_OCL(frame_ocl));
+    superRes_ocl->setInput(makePtr<OneFrameSource_OCL>(frame_ocl));
 
     ocl::oclMat dst_ocl;
     superRes_ocl->nextFrame(dst_ocl);
index 178e434..e0ee7db 100644 (file)
@@ -337,7 +337,7 @@ namespace
 
         // update blur filter and btv weights
 
-        if (filter_.empty() || blurKernelSize_ != curBlurKernelSize_ || blurSigma_ != curBlurSigma_ || src[0].type() != curSrcType_)
+        if (!filter_ || blurKernelSize_ != curBlurKernelSize_ || blurSigma_ != curBlurSigma_ || src[0].type() != curSrcType_)
         {
             filter_ = createGaussianFilter(src[0].type(), Size(blurKernelSize_, blurKernelSize_), blurSigma_);
             curBlurKernelSize_ = blurKernelSize_;
@@ -614,5 +614,5 @@ namespace
 
 Ptr<SuperResolution> cv::superres::createSuperResolution_BTVL1()
 {
-    return new BTVL1;
+    return makePtr<BTVL1>();
 }
index 7b2ad73..f4268b0 100644 (file)
@@ -578,7 +578,7 @@ namespace
 
 Ptr<SuperResolution> cv::superres::createSuperResolution_BTVL1_GPU()
 {
-    return new BTVL1_GPU;
+    return makePtr<BTVL1_GPU>();
 }
 
 #endif // HAVE_CUDA
index ff60303..9d94e61 100644 (file)
@@ -743,6 +743,6 @@ namespace
 
 Ptr<SuperResolution> cv::superres::createSuperResolution_BTVL1_OCL()
 {
-    return new BTVL1_OCL;
+    return makePtr<BTVL1_OCL>();
 }
 #endif
index 5c6b123..14576d5 100644 (file)
@@ -74,7 +74,7 @@ namespace
 
 Ptr<FrameSource> cv::superres::createFrameSource_Empty()
 {
-    return new EmptyFrameSource;
+    return makePtr<EmptyFrameSource>();
 }
 
 //////////////////////////////////////////////////////
@@ -186,12 +186,12 @@ namespace
 
 Ptr<FrameSource> cv::superres::createFrameSource_Video(const String& fileName)
 {
-    return new VideoFrameSource(fileName);
+    return makePtr<VideoFrameSource>(fileName);
 }
 
 Ptr<FrameSource> cv::superres::createFrameSource_Camera(int deviceId)
 {
-    return new CameraFrameSource(deviceId);
+    return makePtr<CameraFrameSource>(deviceId);
 }
 
 #endif // HAVE_OPENCV_HIGHGUI
@@ -257,7 +257,7 @@ namespace
 
 Ptr<FrameSource> cv::superres::createFrameSource_Video_GPU(const String& fileName)
 {
-    return new VideoFrameSource(fileName);
+    return makePtr<VideoFrameSource>(fileName);
 }
 
 #endif // HAVE_OPENCV_GPUCODEC
index 1779498..85c7411 100644 (file)
@@ -169,7 +169,7 @@ namespace
 
 Ptr<DenseOpticalFlowExt> cv::superres::createOptFlow_Farneback()
 {
-    return new Farneback;
+    return makePtr<Farneback>();
 }
 
 ///////////////////////////////////////////////////////////////////
@@ -258,7 +258,7 @@ namespace
 
 Ptr<DenseOpticalFlowExt> cv::superres::createOptFlow_Simple()
 {
-    return new Simple;
+    return makePtr<Simple>();
 }
 
 ///////////////////////////////////////////////////////////////////
@@ -337,7 +337,7 @@ namespace
 
 Ptr<DenseOpticalFlowExt> cv::superres::createOptFlow_DualTVL1()
 {
-    return new DualTVL1;
+    return makePtr<DualTVL1>();
 }
 
 ///////////////////////////////////////////////////////////////////
@@ -503,7 +503,7 @@ namespace
 
 Ptr<DenseOpticalFlowExt> cv::superres::createOptFlow_Brox_GPU()
 {
-    return new Brox_GPU;
+    return makePtr<Brox_GPU>();
 }
 
 ///////////////////////////////////////////////////////////////////
@@ -562,7 +562,7 @@ namespace
 
 Ptr<DenseOpticalFlowExt> cv::superres::createOptFlow_PyrLK_GPU()
 {
-    return new PyrLK_GPU;
+    return makePtr<PyrLK_GPU>();
 }
 
 ///////////////////////////////////////////////////////////////////
@@ -636,7 +636,7 @@ namespace
 
 Ptr<DenseOpticalFlowExt> cv::superres::createOptFlow_Farneback_GPU()
 {
-    return new Farneback_GPU;
+    return makePtr<Farneback_GPU>();
 }
 
 ///////////////////////////////////////////////////////////////////
@@ -714,7 +714,7 @@ namespace
 
 Ptr<DenseOpticalFlowExt> cv::superres::createOptFlow_DualTVL1_GPU()
 {
-    return new DualTVL1_GPU;
+    return makePtr<DualTVL1_GPU>();
 }
 
 #endif // HAVE_OPENCV_GPUOPTFLOW
@@ -827,7 +827,7 @@ namespace
 
 Ptr<DenseOpticalFlowExt> cv::superres::createOptFlow_PyrLK_OCL()
 {
-    return new PyrLK_OCL;
+    return makePtr<PyrLK_OCL>();
 }
 
 ///////////////////////////////////////////////////////////////////
@@ -906,7 +906,7 @@ namespace
 
 Ptr<DenseOpticalFlowExt> cv::superres::createOptFlow_DualTVL1_OCL()
 {
-    return new DualTVL1_OCL;
+    return makePtr<DualTVL1_OCL>();
 }
 
 ///////////////////////////////////////////////////////////////////
@@ -980,7 +980,7 @@ namespace
 
 Ptr<DenseOpticalFlowExt> cv::superres::createOptFlow_Farneback_OCL()
 {
-    return new FarneBack_OCL;
+    return makePtr<FarneBack_OCL>();
 }
 
 #endif
index 2cede09..d33e182 100644 (file)
@@ -59,7 +59,7 @@ private:
 AllignedFrameSource::AllignedFrameSource(const cv::Ptr<cv::superres::FrameSource>& base, int scale) :
     base_(base), scale_(scale)
 {
-    CV_Assert( !base_.empty() );
+    CV_Assert( base_ );
 }
 
 void AllignedFrameSource::nextFrame(cv::OutputArray frame)
@@ -101,7 +101,7 @@ private:
 DegradeFrameSource::DegradeFrameSource(const cv::Ptr<cv::superres::FrameSource>& base, int scale) :
     base_(base), iscale_(1.0 / scale)
 {
-    CV_Assert( !base_.empty() );
+    CV_Assert( base_ );
 }
 
 void addGaussNoise(cv::Mat& image, double sigma)
@@ -229,7 +229,8 @@ void SuperResolution::RunTest(cv::Ptr<cv::superres::SuperResolution> superRes)
     superRes->set("temporalAreaRadius", temporalAreaRadius);
 
     cv::Ptr<cv::superres::FrameSource> goldSource(new AllignedFrameSource(cv::superres::createFrameSource_Video(inputVideoName), scale));
-    cv::Ptr<cv::superres::FrameSource> lowResSource(new DegradeFrameSource(new AllignedFrameSource(cv::superres::createFrameSource_Video(inputVideoName), scale), scale));
+    cv::Ptr<cv::superres::FrameSource> lowResSource(new DegradeFrameSource(
+        cv::makePtr<AllignedFrameSource>(cv::superres::createFrameSource_Video(inputVideoName), scale), scale));
 
     // skip first frame
     cv::Mat frame;