Commit 93f757f8 authored by Roman Donchenko's avatar Roman Donchenko

Boring changes - superres.

parent f21851f0
...@@ -153,7 +153,7 @@ PERF_TEST_P(Size_MatType, SuperResolution_BTVL1, ...@@ -153,7 +153,7 @@ PERF_TEST_P(Size_MatType, SuperResolution_BTVL1,
superRes->set("temporalAreaRadius", temporalAreaRadius); superRes->set("temporalAreaRadius", temporalAreaRadius);
superRes->set("opticalFlow", opticalFlow); superRes->set("opticalFlow", opticalFlow);
superRes->setInput(new OneFrameSource_GPU(GpuMat(frame))); superRes->setInput(makePtr<OneFrameSource_GPU>(GpuMat(frame)));
GpuMat dst; GpuMat dst;
superRes->nextFrame(dst); superRes->nextFrame(dst);
...@@ -171,7 +171,7 @@ PERF_TEST_P(Size_MatType, SuperResolution_BTVL1, ...@@ -171,7 +171,7 @@ PERF_TEST_P(Size_MatType, SuperResolution_BTVL1,
superRes->set("temporalAreaRadius", temporalAreaRadius); superRes->set("temporalAreaRadius", temporalAreaRadius);
superRes->set("opticalFlow", opticalFlow); superRes->set("opticalFlow", opticalFlow);
superRes->setInput(new OneFrameSource_CPU(frame)); superRes->setInput(makePtr<OneFrameSource_CPU>(frame));
Mat dst; Mat dst;
superRes->nextFrame(dst); superRes->nextFrame(dst);
......
...@@ -134,7 +134,7 @@ PERF_TEST_P(Size_MatType, SuperResolution_BTVL1_OCL, ...@@ -134,7 +134,7 @@ PERF_TEST_P(Size_MatType, SuperResolution_BTVL1_OCL,
superRes_ocl->set("temporalAreaRadius", temporalAreaRadius); superRes_ocl->set("temporalAreaRadius", temporalAreaRadius);
superRes_ocl->set("opticalFlow", opticalFlowOcl); 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; ocl::oclMat dst_ocl;
superRes_ocl->nextFrame(dst_ocl); superRes_ocl->nextFrame(dst_ocl);
......
...@@ -337,7 +337,7 @@ namespace ...@@ -337,7 +337,7 @@ namespace
// update blur filter and btv weights // 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_); filter_ = createGaussianFilter(src[0].type(), Size(blurKernelSize_, blurKernelSize_), blurSigma_);
curBlurKernelSize_ = blurKernelSize_; curBlurKernelSize_ = blurKernelSize_;
...@@ -614,5 +614,5 @@ namespace ...@@ -614,5 +614,5 @@ namespace
Ptr<SuperResolution> cv::superres::createSuperResolution_BTVL1() Ptr<SuperResolution> cv::superres::createSuperResolution_BTVL1()
{ {
return new BTVL1; return makePtr<BTVL1>();
} }
...@@ -578,7 +578,7 @@ namespace ...@@ -578,7 +578,7 @@ namespace
Ptr<SuperResolution> cv::superres::createSuperResolution_BTVL1_GPU() Ptr<SuperResolution> cv::superres::createSuperResolution_BTVL1_GPU()
{ {
return new BTVL1_GPU; return makePtr<BTVL1_GPU>();
} }
#endif // HAVE_CUDA #endif // HAVE_CUDA
...@@ -743,6 +743,6 @@ namespace ...@@ -743,6 +743,6 @@ namespace
Ptr<SuperResolution> cv::superres::createSuperResolution_BTVL1_OCL() Ptr<SuperResolution> cv::superres::createSuperResolution_BTVL1_OCL()
{ {
return new BTVL1_OCL; return makePtr<BTVL1_OCL>();
} }
#endif #endif
...@@ -74,7 +74,7 @@ namespace ...@@ -74,7 +74,7 @@ namespace
Ptr<FrameSource> cv::superres::createFrameSource_Empty() Ptr<FrameSource> cv::superres::createFrameSource_Empty()
{ {
return new EmptyFrameSource; return makePtr<EmptyFrameSource>();
} }
////////////////////////////////////////////////////// //////////////////////////////////////////////////////
...@@ -186,12 +186,12 @@ namespace ...@@ -186,12 +186,12 @@ namespace
Ptr<FrameSource> cv::superres::createFrameSource_Video(const String& fileName) 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) Ptr<FrameSource> cv::superres::createFrameSource_Camera(int deviceId)
{ {
return new CameraFrameSource(deviceId); return makePtr<CameraFrameSource>(deviceId);
} }
#endif // HAVE_OPENCV_HIGHGUI #endif // HAVE_OPENCV_HIGHGUI
...@@ -257,7 +257,7 @@ namespace ...@@ -257,7 +257,7 @@ namespace
Ptr<FrameSource> cv::superres::createFrameSource_Video_GPU(const String& fileName) Ptr<FrameSource> cv::superres::createFrameSource_Video_GPU(const String& fileName)
{ {
return new VideoFrameSource(fileName); return makePtr<VideoFrameSource>(fileName);
} }
#endif // HAVE_OPENCV_GPUCODEC #endif // HAVE_OPENCV_GPUCODEC
...@@ -169,7 +169,7 @@ namespace ...@@ -169,7 +169,7 @@ namespace
Ptr<DenseOpticalFlowExt> cv::superres::createOptFlow_Farneback() Ptr<DenseOpticalFlowExt> cv::superres::createOptFlow_Farneback()
{ {
return new Farneback; return makePtr<Farneback>();
} }
/////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////
...@@ -258,7 +258,7 @@ namespace ...@@ -258,7 +258,7 @@ namespace
Ptr<DenseOpticalFlowExt> cv::superres::createOptFlow_Simple() Ptr<DenseOpticalFlowExt> cv::superres::createOptFlow_Simple()
{ {
return new Simple; return makePtr<Simple>();
} }
/////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////
...@@ -337,7 +337,7 @@ namespace ...@@ -337,7 +337,7 @@ namespace
Ptr<DenseOpticalFlowExt> cv::superres::createOptFlow_DualTVL1() Ptr<DenseOpticalFlowExt> cv::superres::createOptFlow_DualTVL1()
{ {
return new DualTVL1; return makePtr<DualTVL1>();
} }
/////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////
...@@ -503,7 +503,7 @@ namespace ...@@ -503,7 +503,7 @@ namespace
Ptr<DenseOpticalFlowExt> cv::superres::createOptFlow_Brox_GPU() Ptr<DenseOpticalFlowExt> cv::superres::createOptFlow_Brox_GPU()
{ {
return new Brox_GPU; return makePtr<Brox_GPU>();
} }
/////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////
...@@ -562,7 +562,7 @@ namespace ...@@ -562,7 +562,7 @@ namespace
Ptr<DenseOpticalFlowExt> cv::superres::createOptFlow_PyrLK_GPU() Ptr<DenseOpticalFlowExt> cv::superres::createOptFlow_PyrLK_GPU()
{ {
return new PyrLK_GPU; return makePtr<PyrLK_GPU>();
} }
/////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////
...@@ -636,7 +636,7 @@ namespace ...@@ -636,7 +636,7 @@ namespace
Ptr<DenseOpticalFlowExt> cv::superres::createOptFlow_Farneback_GPU() Ptr<DenseOpticalFlowExt> cv::superres::createOptFlow_Farneback_GPU()
{ {
return new Farneback_GPU; return makePtr<Farneback_GPU>();
} }
/////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////
...@@ -714,7 +714,7 @@ namespace ...@@ -714,7 +714,7 @@ namespace
Ptr<DenseOpticalFlowExt> cv::superres::createOptFlow_DualTVL1_GPU() Ptr<DenseOpticalFlowExt> cv::superres::createOptFlow_DualTVL1_GPU()
{ {
return new DualTVL1_GPU; return makePtr<DualTVL1_GPU>();
} }
#endif // HAVE_OPENCV_GPUOPTFLOW #endif // HAVE_OPENCV_GPUOPTFLOW
...@@ -827,7 +827,7 @@ namespace ...@@ -827,7 +827,7 @@ namespace
Ptr<DenseOpticalFlowExt> cv::superres::createOptFlow_PyrLK_OCL() Ptr<DenseOpticalFlowExt> cv::superres::createOptFlow_PyrLK_OCL()
{ {
return new PyrLK_OCL; return makePtr<PyrLK_OCL>();
} }
/////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////
...@@ -906,7 +906,7 @@ namespace ...@@ -906,7 +906,7 @@ namespace
Ptr<DenseOpticalFlowExt> cv::superres::createOptFlow_DualTVL1_OCL() Ptr<DenseOpticalFlowExt> cv::superres::createOptFlow_DualTVL1_OCL()
{ {
return new DualTVL1_OCL; return makePtr<DualTVL1_OCL>();
} }
/////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////
...@@ -980,7 +980,7 @@ namespace ...@@ -980,7 +980,7 @@ namespace
Ptr<DenseOpticalFlowExt> cv::superres::createOptFlow_Farneback_OCL() Ptr<DenseOpticalFlowExt> cv::superres::createOptFlow_Farneback_OCL()
{ {
return new FarneBack_OCL; return makePtr<FarneBack_OCL>();
} }
#endif #endif
...@@ -59,7 +59,7 @@ private: ...@@ -59,7 +59,7 @@ private:
AllignedFrameSource::AllignedFrameSource(const cv::Ptr<cv::superres::FrameSource>& base, int scale) : AllignedFrameSource::AllignedFrameSource(const cv::Ptr<cv::superres::FrameSource>& base, int scale) :
base_(base), scale_(scale) base_(base), scale_(scale)
{ {
CV_Assert( !base_.empty() ); CV_Assert( base_ );
} }
void AllignedFrameSource::nextFrame(cv::OutputArray frame) void AllignedFrameSource::nextFrame(cv::OutputArray frame)
...@@ -101,7 +101,7 @@ private: ...@@ -101,7 +101,7 @@ private:
DegradeFrameSource::DegradeFrameSource(const cv::Ptr<cv::superres::FrameSource>& base, int scale) : DegradeFrameSource::DegradeFrameSource(const cv::Ptr<cv::superres::FrameSource>& base, int scale) :
base_(base), iscale_(1.0 / scale) base_(base), iscale_(1.0 / scale)
{ {
CV_Assert( !base_.empty() ); CV_Assert( base_ );
} }
void addGaussNoise(cv::Mat& image, double sigma) void addGaussNoise(cv::Mat& image, double sigma)
...@@ -229,7 +229,8 @@ void SuperResolution::RunTest(cv::Ptr<cv::superres::SuperResolution> superRes) ...@@ -229,7 +229,8 @@ void SuperResolution::RunTest(cv::Ptr<cv::superres::SuperResolution> superRes)
superRes->set("temporalAreaRadius", temporalAreaRadius); superRes->set("temporalAreaRadius", temporalAreaRadius);
cv::Ptr<cv::superres::FrameSource> goldSource(new AllignedFrameSource(cv::superres::createFrameSource_Video(inputVideoName), scale)); 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 // skip first frame
cv::Mat frame; cv::Mat frame;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment