Remove deprecated methods from cv::Algorithm
This commit is contained in:
@@ -460,7 +460,7 @@ namespace
|
||||
func(_src, _dst, btvKernelSize, btvWeights);
|
||||
}
|
||||
|
||||
class BTVL1_Base
|
||||
class BTVL1_Base : public cv::superres::SuperResolution
|
||||
{
|
||||
public:
|
||||
BTVL1_Base();
|
||||
@@ -470,6 +470,17 @@ namespace
|
||||
|
||||
void collectGarbage();
|
||||
|
||||
CV_IMPL_PROPERTY(int, Scale, scale_)
|
||||
CV_IMPL_PROPERTY(int, Iterations, iterations_)
|
||||
CV_IMPL_PROPERTY(double, Tau, tau_)
|
||||
CV_IMPL_PROPERTY(double, Labmda, lambda_)
|
||||
CV_IMPL_PROPERTY(double, Alpha, alpha_)
|
||||
CV_IMPL_PROPERTY(int, KernelSize, btvKernelSize_)
|
||||
CV_IMPL_PROPERTY(int, BlurKernelSize, blurKernelSize_)
|
||||
CV_IMPL_PROPERTY(double, BlurSigma, blurSigma_)
|
||||
CV_IMPL_PROPERTY(int, TemporalAreaRadius, temporalAreaRadius_)
|
||||
CV_IMPL_PROPERTY_S(Ptr<cv::superres::DenseOpticalFlowExt>, OpticalFlow, opticalFlow_)
|
||||
|
||||
protected:
|
||||
int scale_;
|
||||
int iterations_;
|
||||
@@ -479,7 +490,8 @@ namespace
|
||||
int btvKernelSize_;
|
||||
int blurKernelSize_;
|
||||
double blurSigma_;
|
||||
Ptr<DenseOpticalFlowExt> opticalFlow_;
|
||||
int temporalAreaRadius_; // not used in some implementations
|
||||
Ptr<cv::superres::DenseOpticalFlowExt> opticalFlow_;
|
||||
|
||||
private:
|
||||
bool ocl_process(InputArrayOfArrays src, OutputArray dst, InputArrayOfArrays forwardMotions,
|
||||
@@ -539,6 +551,7 @@ namespace
|
||||
btvKernelSize_ = 7;
|
||||
blurKernelSize_ = 5;
|
||||
blurSigma_ = 0.0;
|
||||
temporalAreaRadius_ = 0;
|
||||
opticalFlow_ = createOptFlow_Farneback();
|
||||
|
||||
curBlurKernelSize_ = -1;
|
||||
@@ -781,12 +794,9 @@ namespace
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
class BTVL1 :
|
||||
public SuperResolution, private BTVL1_Base
|
||||
class BTVL1 : public BTVL1_Base
|
||||
{
|
||||
public:
|
||||
AlgorithmInfo* info() const;
|
||||
|
||||
BTVL1();
|
||||
|
||||
void collectGarbage();
|
||||
@@ -799,8 +809,6 @@ namespace
|
||||
bool ocl_processImpl(Ptr<FrameSource>& frameSource, OutputArray output);
|
||||
|
||||
private:
|
||||
int temporalAreaRadius_;
|
||||
|
||||
void readNextFrame(Ptr<FrameSource>& frameSource);
|
||||
bool ocl_readNextFrame(Ptr<FrameSource>& frameSource);
|
||||
|
||||
@@ -841,18 +849,6 @@ namespace
|
||||
#endif
|
||||
};
|
||||
|
||||
CV_INIT_ALGORITHM(BTVL1, "SuperResolution.BTVL1",
|
||||
obj.info()->addParam(obj, "scale", obj.scale_, false, 0, 0, "Scale factor.");
|
||||
obj.info()->addParam(obj, "iterations", obj.iterations_, false, 0, 0, "Iteration count.");
|
||||
obj.info()->addParam(obj, "tau", obj.tau_, false, 0, 0, "Asymptotic value of steepest descent method.");
|
||||
obj.info()->addParam(obj, "lambda", obj.lambda_, false, 0, 0, "Weight parameter to balance data term and smoothness term.");
|
||||
obj.info()->addParam(obj, "alpha", obj.alpha_, false, 0, 0, "Parameter of spacial distribution in Bilateral-TV.");
|
||||
obj.info()->addParam(obj, "btvKernelSize", obj.btvKernelSize_, false, 0, 0, "Kernel size of Bilateral-TV filter.");
|
||||
obj.info()->addParam(obj, "blurKernelSize", obj.blurKernelSize_, false, 0, 0, "Gaussian blur kernel size.");
|
||||
obj.info()->addParam(obj, "blurSigma", obj.blurSigma_, false, 0, 0, "Gaussian blur sigma.");
|
||||
obj.info()->addParam(obj, "temporalAreaRadius", obj.temporalAreaRadius_, false, 0, 0, "Radius of the temporal search area.");
|
||||
obj.info()->addParam<DenseOpticalFlowExt>(obj, "opticalFlow", obj.opticalFlow_, false, 0, 0, "Dense optical flow algorithm."))
|
||||
|
||||
BTVL1::BTVL1()
|
||||
{
|
||||
temporalAreaRadius_ = 4;
|
||||
@@ -1101,7 +1097,7 @@ namespace
|
||||
}
|
||||
}
|
||||
|
||||
Ptr<SuperResolution> cv::superres::createSuperResolution_BTVL1()
|
||||
Ptr<cv::superres::SuperResolution> cv::superres::createSuperResolution_BTVL1()
|
||||
{
|
||||
return makePtr<BTVL1>();
|
||||
}
|
||||
|
||||
@@ -207,7 +207,7 @@ namespace
|
||||
funcs[src.channels()](src, dst, ksize);
|
||||
}
|
||||
|
||||
class BTVL1_CUDA_Base
|
||||
class BTVL1_CUDA_Base : public cv::superres::SuperResolution
|
||||
{
|
||||
public:
|
||||
BTVL1_CUDA_Base();
|
||||
@@ -218,6 +218,17 @@ namespace
|
||||
|
||||
void collectGarbage();
|
||||
|
||||
CV_IMPL_PROPERTY(int, Scale, scale_)
|
||||
CV_IMPL_PROPERTY(int, Iterations, iterations_)
|
||||
CV_IMPL_PROPERTY(double, Tau, tau_)
|
||||
CV_IMPL_PROPERTY(double, Labmda, lambda_)
|
||||
CV_IMPL_PROPERTY(double, Alpha, alpha_)
|
||||
CV_IMPL_PROPERTY(int, KernelSize, btvKernelSize_)
|
||||
CV_IMPL_PROPERTY(int, BlurKernelSize, blurKernelSize_)
|
||||
CV_IMPL_PROPERTY(double, BlurSigma, blurSigma_)
|
||||
CV_IMPL_PROPERTY(int, TemporalAreaRadius, temporalAreaRadius_)
|
||||
CV_IMPL_PROPERTY_S(Ptr<cv::superres::DenseOpticalFlowExt>, OpticalFlow, opticalFlow_)
|
||||
|
||||
protected:
|
||||
int scale_;
|
||||
int iterations_;
|
||||
@@ -227,7 +238,8 @@ namespace
|
||||
int btvKernelSize_;
|
||||
int blurKernelSize_;
|
||||
double blurSigma_;
|
||||
Ptr<DenseOpticalFlowExt> opticalFlow_;
|
||||
int temporalAreaRadius_;
|
||||
Ptr<cv::superres::DenseOpticalFlowExt> opticalFlow_;
|
||||
|
||||
private:
|
||||
std::vector<Ptr<cuda::Filter> > filters_;
|
||||
@@ -272,6 +284,7 @@ namespace
|
||||
#else
|
||||
opticalFlow_ = createOptFlow_Farneback();
|
||||
#endif
|
||||
temporalAreaRadius_ = 0;
|
||||
|
||||
curBlurKernelSize_ = -1;
|
||||
curBlurSigma_ = -1.0;
|
||||
@@ -401,11 +414,9 @@ namespace
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
class BTVL1_CUDA : public SuperResolution, private BTVL1_CUDA_Base
|
||||
class BTVL1_CUDA : public BTVL1_CUDA_Base
|
||||
{
|
||||
public:
|
||||
AlgorithmInfo* info() const;
|
||||
|
||||
BTVL1_CUDA();
|
||||
|
||||
void collectGarbage();
|
||||
@@ -415,8 +426,6 @@ namespace
|
||||
void processImpl(Ptr<FrameSource>& frameSource, OutputArray output);
|
||||
|
||||
private:
|
||||
int temporalAreaRadius_;
|
||||
|
||||
void readNextFrame(Ptr<FrameSource>& frameSource);
|
||||
void processFrame(int idx);
|
||||
|
||||
@@ -438,18 +447,6 @@ namespace
|
||||
GpuMat finalOutput_;
|
||||
};
|
||||
|
||||
CV_INIT_ALGORITHM(BTVL1_CUDA, "SuperResolution.BTVL1_CUDA",
|
||||
obj.info()->addParam(obj, "scale", obj.scale_, false, 0, 0, "Scale factor.");
|
||||
obj.info()->addParam(obj, "iterations", obj.iterations_, false, 0, 0, "Iteration count.");
|
||||
obj.info()->addParam(obj, "tau", obj.tau_, false, 0, 0, "Asymptotic value of steepest descent method.");
|
||||
obj.info()->addParam(obj, "lambda", obj.lambda_, false, 0, 0, "Weight parameter to balance data term and smoothness term.");
|
||||
obj.info()->addParam(obj, "alpha", obj.alpha_, false, 0, 0, "Parameter of spacial distribution in Bilateral-TV.");
|
||||
obj.info()->addParam(obj, "btvKernelSize", obj.btvKernelSize_, false, 0, 0, "Kernel size of Bilateral-TV filter.");
|
||||
obj.info()->addParam(obj, "blurKernelSize", obj.blurKernelSize_, false, 0, 0, "Gaussian blur kernel size.");
|
||||
obj.info()->addParam(obj, "blurSigma", obj.blurSigma_, false, 0, 0, "Gaussian blur sigma.");
|
||||
obj.info()->addParam(obj, "temporalAreaRadius", obj.temporalAreaRadius_, false, 0, 0, "Radius of the temporal search area.");
|
||||
obj.info()->addParam<DenseOpticalFlowExt>(obj, "opticalFlow", obj.opticalFlow_, false, 0, 0, "Dense optical flow algorithm."));
|
||||
|
||||
BTVL1_CUDA::BTVL1_CUDA()
|
||||
{
|
||||
temporalAreaRadius_ = 4;
|
||||
|
||||
@@ -53,7 +53,7 @@ using namespace cv::superres::detail;
|
||||
|
||||
namespace
|
||||
{
|
||||
class CpuOpticalFlow : public DenseOpticalFlowExt
|
||||
class CpuOpticalFlow : public virtual cv::superres::DenseOpticalFlowExt
|
||||
{
|
||||
public:
|
||||
explicit CpuOpticalFlow(int work_type);
|
||||
@@ -173,12 +173,20 @@ namespace
|
||||
|
||||
namespace
|
||||
{
|
||||
class Farneback : public CpuOpticalFlow
|
||||
class Farneback : public CpuOpticalFlow, public cv::superres::FarnebackOpticalFlow
|
||||
{
|
||||
public:
|
||||
AlgorithmInfo* info() const;
|
||||
|
||||
Farneback();
|
||||
void calc(InputArray frame0, InputArray frame1, OutputArray flow1, OutputArray flow2);
|
||||
void collectGarbage();
|
||||
|
||||
CV_IMPL_PROPERTY(double, PyrScale, pyrScale_)
|
||||
CV_IMPL_PROPERTY(int, LevelsNumber, numLevels_)
|
||||
CV_IMPL_PROPERTY(int, WindowSize, winSize_)
|
||||
CV_IMPL_PROPERTY(int, Iterations, numIters_)
|
||||
CV_IMPL_PROPERTY(int, PolyN, polyN_)
|
||||
CV_IMPL_PROPERTY(double, PolySigma, polySigma_)
|
||||
CV_IMPL_PROPERTY(int, Flags, flags_)
|
||||
|
||||
protected:
|
||||
void impl(InputArray input0, InputArray input1, OutputArray dst);
|
||||
@@ -193,15 +201,6 @@ namespace
|
||||
int flags_;
|
||||
};
|
||||
|
||||
CV_INIT_ALGORITHM(Farneback, "DenseOpticalFlowExt.Farneback",
|
||||
obj.info()->addParam(obj, "pyrScale", obj.pyrScale_);
|
||||
obj.info()->addParam(obj, "numLevels", obj.numLevels_);
|
||||
obj.info()->addParam(obj, "winSize", obj.winSize_);
|
||||
obj.info()->addParam(obj, "numIters", obj.numIters_);
|
||||
obj.info()->addParam(obj, "polyN", obj.polyN_);
|
||||
obj.info()->addParam(obj, "polySigma", obj.polySigma_);
|
||||
obj.info()->addParam(obj, "flags", obj.flags_))
|
||||
|
||||
Farneback::Farneback() : CpuOpticalFlow(CV_8UC1)
|
||||
{
|
||||
pyrScale_ = 0.5;
|
||||
@@ -213,6 +212,16 @@ namespace
|
||||
flags_ = 0;
|
||||
}
|
||||
|
||||
void Farneback::calc(InputArray frame0, InputArray frame1, OutputArray flow1, OutputArray flow2)
|
||||
{
|
||||
CpuOpticalFlow::calc(frame0, frame1, flow1, flow2);
|
||||
}
|
||||
|
||||
void Farneback::collectGarbage()
|
||||
{
|
||||
CpuOpticalFlow::collectGarbage();
|
||||
}
|
||||
|
||||
void Farneback::impl(InputArray input0, InputArray input1, OutputArray dst)
|
||||
{
|
||||
calcOpticalFlowFarneback(input0, input1, (InputOutputArray)dst, pyrScale_,
|
||||
@@ -221,7 +230,7 @@ namespace
|
||||
}
|
||||
}
|
||||
|
||||
Ptr<DenseOpticalFlowExt> cv::superres::createOptFlow_Farneback()
|
||||
Ptr<cv::superres::FarnebackOpticalFlow> cv::superres::createOptFlow_Farneback()
|
||||
{
|
||||
return makePtr<Farneback>();
|
||||
}
|
||||
@@ -319,65 +328,53 @@ Ptr<DenseOpticalFlowExt> cv::superres::createOptFlow_Simple()
|
||||
|
||||
namespace
|
||||
{
|
||||
class DualTVL1 : public CpuOpticalFlow
|
||||
#define CV_WRAP_PROPERTY(type, name, internal_name, internal_obj) \
|
||||
type get##name() const \
|
||||
{ \
|
||||
return internal_obj->get##internal_name(); \
|
||||
} \
|
||||
void set##name(type _name) \
|
||||
{ \
|
||||
internal_obj->set##internal_name(_name); \
|
||||
}
|
||||
|
||||
#define CV_WRAP_SAME_PROPERTY(type, name, internal_obj) CV_WRAP_PROPERTY(type, name, name, internal_obj)
|
||||
|
||||
class DualTVL1 : public CpuOpticalFlow, public virtual cv::superres::DualTVL1OpticalFlow
|
||||
{
|
||||
public:
|
||||
AlgorithmInfo* info() const;
|
||||
|
||||
DualTVL1();
|
||||
|
||||
void calc(InputArray frame0, InputArray frame1, OutputArray flow1, OutputArray flow2);
|
||||
void collectGarbage();
|
||||
|
||||
CV_WRAP_SAME_PROPERTY(double, Tau, alg_)
|
||||
CV_WRAP_SAME_PROPERTY(double, Lambda, alg_)
|
||||
CV_WRAP_SAME_PROPERTY(double, Theta, alg_)
|
||||
CV_WRAP_SAME_PROPERTY(int, ScalesNumber, alg_)
|
||||
CV_WRAP_SAME_PROPERTY(int, WarpingsNumber, alg_)
|
||||
CV_WRAP_SAME_PROPERTY(double, Epsilon, alg_)
|
||||
CV_WRAP_PROPERTY(int, Iterations, OuterIterations, alg_)
|
||||
CV_WRAP_SAME_PROPERTY(bool, UseInitialFlow, alg_)
|
||||
|
||||
protected:
|
||||
void impl(InputArray input0, InputArray input1, OutputArray dst);
|
||||
|
||||
private:
|
||||
double tau_;
|
||||
double lambda_;
|
||||
double theta_;
|
||||
int nscales_;
|
||||
int warps_;
|
||||
double epsilon_;
|
||||
int iterations_;
|
||||
bool useInitialFlow_;
|
||||
|
||||
Ptr<cv::DenseOpticalFlow> alg_;
|
||||
Ptr<cv::DualTVL1OpticalFlow> alg_;
|
||||
};
|
||||
|
||||
CV_INIT_ALGORITHM(DualTVL1, "DenseOpticalFlowExt.DualTVL1",
|
||||
obj.info()->addParam(obj, "tau", obj.tau_);
|
||||
obj.info()->addParam(obj, "lambda", obj.lambda_);
|
||||
obj.info()->addParam(obj, "theta", obj.theta_);
|
||||
obj.info()->addParam(obj, "nscales", obj.nscales_);
|
||||
obj.info()->addParam(obj, "warps", obj.warps_);
|
||||
obj.info()->addParam(obj, "epsilon", obj.epsilon_);
|
||||
obj.info()->addParam(obj, "iterations", obj.iterations_);
|
||||
obj.info()->addParam(obj, "useInitialFlow", obj.useInitialFlow_))
|
||||
|
||||
DualTVL1::DualTVL1() : CpuOpticalFlow(CV_8UC1)
|
||||
{
|
||||
alg_ = cv::createOptFlow_DualTVL1();
|
||||
tau_ = alg_->getDouble("tau");
|
||||
lambda_ = alg_->getDouble("lambda");
|
||||
theta_ = alg_->getDouble("theta");
|
||||
nscales_ = alg_->getInt("nscales");
|
||||
warps_ = alg_->getInt("warps");
|
||||
epsilon_ = alg_->getDouble("epsilon");
|
||||
iterations_ = alg_->getInt("iterations");
|
||||
useInitialFlow_ = alg_->getBool("useInitialFlow");
|
||||
}
|
||||
|
||||
void DualTVL1::calc(InputArray frame0, InputArray frame1, OutputArray flow1, OutputArray flow2)
|
||||
{
|
||||
CpuOpticalFlow::calc(frame0, frame1, flow1, flow2);
|
||||
}
|
||||
|
||||
void DualTVL1::impl(InputArray input0, InputArray input1, OutputArray dst)
|
||||
{
|
||||
alg_->set("tau", tau_);
|
||||
alg_->set("lambda", lambda_);
|
||||
alg_->set("theta", theta_);
|
||||
alg_->set("nscales", nscales_);
|
||||
alg_->set("warps", warps_);
|
||||
alg_->set("epsilon", epsilon_);
|
||||
alg_->set("iterations", iterations_);
|
||||
alg_->set("useInitialFlow", useInitialFlow_);
|
||||
|
||||
alg_->calc(input0, input1, (InputOutputArray)dst);
|
||||
}
|
||||
|
||||
@@ -388,7 +385,7 @@ namespace
|
||||
}
|
||||
}
|
||||
|
||||
Ptr<DenseOpticalFlowExt> cv::superres::createOptFlow_DualTVL1()
|
||||
Ptr<cv::superres::DualTVL1OpticalFlow> cv::superres::createOptFlow_DualTVL1()
|
||||
{
|
||||
return makePtr<DualTVL1>();
|
||||
}
|
||||
@@ -398,35 +395,35 @@ Ptr<DenseOpticalFlowExt> cv::superres::createOptFlow_DualTVL1()
|
||||
|
||||
#ifndef HAVE_OPENCV_CUDAOPTFLOW
|
||||
|
||||
Ptr<DenseOpticalFlowExt> cv::superres::createOptFlow_Farneback_CUDA()
|
||||
Ptr<cv::superres::FarnebackOpticalFlow> cv::superres::createOptFlow_Farneback_CUDA()
|
||||
{
|
||||
CV_Error(cv::Error::StsNotImplemented, "The called functionality is disabled for current build or platform");
|
||||
return Ptr<DenseOpticalFlowExt>();
|
||||
return Ptr<cv::superres::FarnebackOpticalFlow>();
|
||||
}
|
||||
|
||||
Ptr<DenseOpticalFlowExt> cv::superres::createOptFlow_DualTVL1_CUDA()
|
||||
Ptr<cv::superres::DualTVL1OpticalFlow> cv::superres::createOptFlow_DualTVL1_CUDA()
|
||||
{
|
||||
CV_Error(cv::Error::StsNotImplemented, "The called functionality is disabled for current build or platform");
|
||||
return Ptr<DenseOpticalFlowExt>();
|
||||
return Ptr<cv::superres::DualTVL1OpticalFlow>();
|
||||
}
|
||||
|
||||
Ptr<DenseOpticalFlowExt> cv::superres::createOptFlow_Brox_CUDA()
|
||||
Ptr<cv::superres::BroxOpticalFlow> cv::superres::createOptFlow_Brox_CUDA()
|
||||
{
|
||||
CV_Error(cv::Error::StsNotImplemented, "The called functionality is disabled for current build or platform");
|
||||
return Ptr<DenseOpticalFlowExt>();
|
||||
return Ptr<cv::superres::BroxOpticalFlow>();
|
||||
}
|
||||
|
||||
Ptr<DenseOpticalFlowExt> cv::superres::createOptFlow_PyrLK_CUDA()
|
||||
Ptr<cv::superres::PyrLKOpticalFlow> cv::superres::createOptFlow_PyrLK_CUDA()
|
||||
{
|
||||
CV_Error(cv::Error::StsNotImplemented, "The called functionality is disabled for current build or platform");
|
||||
return Ptr<DenseOpticalFlowExt>();
|
||||
return Ptr<cv::superres::PyrLKOpticalFlow>();
|
||||
}
|
||||
|
||||
#else // HAVE_OPENCV_CUDAOPTFLOW
|
||||
|
||||
namespace
|
||||
{
|
||||
class GpuOpticalFlow : public DenseOpticalFlowExt
|
||||
class GpuOpticalFlow : public virtual cv::superres::DenseOpticalFlowExt
|
||||
{
|
||||
public:
|
||||
explicit GpuOpticalFlow(int work_type);
|
||||
@@ -494,15 +491,20 @@ namespace
|
||||
|
||||
namespace
|
||||
{
|
||||
class Brox_CUDA : public GpuOpticalFlow
|
||||
class Brox_CUDA : public GpuOpticalFlow, public virtual cv::superres::BroxOpticalFlow
|
||||
{
|
||||
public:
|
||||
AlgorithmInfo* info() const;
|
||||
|
||||
Brox_CUDA();
|
||||
|
||||
void calc(InputArray frame0, InputArray frame1, OutputArray flow1, OutputArray flow2);
|
||||
void collectGarbage();
|
||||
|
||||
CV_IMPL_PROPERTY(double, Alpha, alpha_)
|
||||
CV_IMPL_PROPERTY(double, Gamma, gamma_)
|
||||
CV_IMPL_PROPERTY(double, ScaleFactor, scaleFactor_)
|
||||
CV_IMPL_PROPERTY(int, InnerIterations, innerIterations_)
|
||||
CV_IMPL_PROPERTY(int, OuterIterations, outerIterations_)
|
||||
CV_IMPL_PROPERTY(int, SolverIterations, solverIterations_)
|
||||
|
||||
protected:
|
||||
void impl(const GpuMat& input0, const GpuMat& input1, GpuMat& dst1, GpuMat& dst2);
|
||||
|
||||
@@ -517,14 +519,6 @@ namespace
|
||||
Ptr<cuda::BroxOpticalFlow> alg_;
|
||||
};
|
||||
|
||||
CV_INIT_ALGORITHM(Brox_CUDA, "DenseOpticalFlowExt.Brox_CUDA",
|
||||
obj.info()->addParam(obj, "alpha", obj.alpha_, false, 0, 0, "Flow smoothness");
|
||||
obj.info()->addParam(obj, "gamma", obj.gamma_, false, 0, 0, "Gradient constancy importance");
|
||||
obj.info()->addParam(obj, "scaleFactor", obj.scaleFactor_, false, 0, 0, "Pyramid scale factor");
|
||||
obj.info()->addParam(obj, "innerIterations", obj.innerIterations_, false, 0, 0, "Number of lagged non-linearity iterations (inner loop)");
|
||||
obj.info()->addParam(obj, "outerIterations", obj.outerIterations_, false, 0, 0, "Number of warping iterations (number of pyramid levels)");
|
||||
obj.info()->addParam(obj, "solverIterations", obj.solverIterations_, false, 0, 0, "Number of linear system solver iterations"))
|
||||
|
||||
Brox_CUDA::Brox_CUDA() : GpuOpticalFlow(CV_32FC1)
|
||||
{
|
||||
alg_ = cuda::BroxOpticalFlow::create(0.197f, 50.0f, 0.8f, 10, 77, 10);
|
||||
@@ -537,6 +531,11 @@ namespace
|
||||
solverIterations_ = alg_->getSolverIterations();
|
||||
}
|
||||
|
||||
void Brox_CUDA::calc(InputArray frame0, InputArray frame1, OutputArray flow1, OutputArray flow2)
|
||||
{
|
||||
GpuOpticalFlow::calc(frame0, frame1, flow1, flow2);
|
||||
}
|
||||
|
||||
void Brox_CUDA::impl(const GpuMat& input0, const GpuMat& input1, GpuMat& dst1, GpuMat& dst2)
|
||||
{
|
||||
alg_->setFlowSmoothness(alpha_);
|
||||
@@ -563,7 +562,7 @@ namespace
|
||||
}
|
||||
}
|
||||
|
||||
Ptr<DenseOpticalFlowExt> cv::superres::createOptFlow_Brox_CUDA()
|
||||
Ptr<cv::superres::BroxOpticalFlow> cv::superres::createOptFlow_Brox_CUDA()
|
||||
{
|
||||
return makePtr<Brox_CUDA>();
|
||||
}
|
||||
@@ -573,15 +572,17 @@ Ptr<DenseOpticalFlowExt> cv::superres::createOptFlow_Brox_CUDA()
|
||||
|
||||
namespace
|
||||
{
|
||||
class PyrLK_CUDA : public GpuOpticalFlow
|
||||
class PyrLK_CUDA : public GpuOpticalFlow, public cv::superres::PyrLKOpticalFlow
|
||||
{
|
||||
public:
|
||||
AlgorithmInfo* info() const;
|
||||
|
||||
PyrLK_CUDA();
|
||||
|
||||
void calc(InputArray frame0, InputArray frame1, OutputArray flow1, OutputArray flow2);
|
||||
void collectGarbage();
|
||||
|
||||
CV_IMPL_PROPERTY(int, WindowSize, winSize_)
|
||||
CV_IMPL_PROPERTY(int, MaxLevel, maxLevel_)
|
||||
CV_IMPL_PROPERTY(int, Iterations, iterations_)
|
||||
|
||||
protected:
|
||||
void impl(const GpuMat& input0, const GpuMat& input1, GpuMat& dst1, GpuMat& dst2);
|
||||
|
||||
@@ -593,11 +594,6 @@ namespace
|
||||
Ptr<cuda::DensePyrLKOpticalFlow> alg_;
|
||||
};
|
||||
|
||||
CV_INIT_ALGORITHM(PyrLK_CUDA, "DenseOpticalFlowExt.PyrLK_CUDA",
|
||||
obj.info()->addParam(obj, "winSize", obj.winSize_);
|
||||
obj.info()->addParam(obj, "maxLevel", obj.maxLevel_);
|
||||
obj.info()->addParam(obj, "iterations", obj.iterations_))
|
||||
|
||||
PyrLK_CUDA::PyrLK_CUDA() : GpuOpticalFlow(CV_8UC1)
|
||||
{
|
||||
alg_ = cuda::DensePyrLKOpticalFlow::create();
|
||||
@@ -607,6 +603,11 @@ namespace
|
||||
iterations_ = alg_->getNumIters();
|
||||
}
|
||||
|
||||
void PyrLK_CUDA::calc(InputArray frame0, InputArray frame1, OutputArray flow1, OutputArray flow2)
|
||||
{
|
||||
GpuOpticalFlow::calc(frame0, frame1, flow1, flow2);
|
||||
}
|
||||
|
||||
void PyrLK_CUDA::impl(const GpuMat& input0, const GpuMat& input1, GpuMat& dst1, GpuMat& dst2)
|
||||
{
|
||||
alg_->setWinSize(Size(winSize_, winSize_));
|
||||
@@ -630,7 +631,7 @@ namespace
|
||||
}
|
||||
}
|
||||
|
||||
Ptr<DenseOpticalFlowExt> cv::superres::createOptFlow_PyrLK_CUDA()
|
||||
Ptr<cv::superres::PyrLKOpticalFlow> cv::superres::createOptFlow_PyrLK_CUDA()
|
||||
{
|
||||
return makePtr<PyrLK_CUDA>();
|
||||
}
|
||||
@@ -640,15 +641,21 @@ Ptr<DenseOpticalFlowExt> cv::superres::createOptFlow_PyrLK_CUDA()
|
||||
|
||||
namespace
|
||||
{
|
||||
class Farneback_CUDA : public GpuOpticalFlow
|
||||
class Farneback_CUDA : public GpuOpticalFlow, public cv::superres::FarnebackOpticalFlow
|
||||
{
|
||||
public:
|
||||
AlgorithmInfo* info() const;
|
||||
|
||||
Farneback_CUDA();
|
||||
|
||||
void calc(InputArray frame0, InputArray frame1, OutputArray flow1, OutputArray flow2);
|
||||
void collectGarbage();
|
||||
|
||||
CV_IMPL_PROPERTY(double, PyrScale, pyrScale_)
|
||||
CV_IMPL_PROPERTY(int, LevelsNumber, numLevels_)
|
||||
CV_IMPL_PROPERTY(int, WindowSize, winSize_)
|
||||
CV_IMPL_PROPERTY(int, Iterations, numIters_)
|
||||
CV_IMPL_PROPERTY(int, PolyN, polyN_)
|
||||
CV_IMPL_PROPERTY(double, PolySigma, polySigma_)
|
||||
CV_IMPL_PROPERTY(int, Flags, flags_)
|
||||
|
||||
protected:
|
||||
void impl(const GpuMat& input0, const GpuMat& input1, GpuMat& dst1, GpuMat& dst2);
|
||||
|
||||
@@ -664,15 +671,6 @@ namespace
|
||||
Ptr<cuda::FarnebackOpticalFlow> alg_;
|
||||
};
|
||||
|
||||
CV_INIT_ALGORITHM(Farneback_CUDA, "DenseOpticalFlowExt.Farneback_CUDA",
|
||||
obj.info()->addParam(obj, "pyrScale", obj.pyrScale_);
|
||||
obj.info()->addParam(obj, "numLevels", obj.numLevels_);
|
||||
obj.info()->addParam(obj, "winSize", obj.winSize_);
|
||||
obj.info()->addParam(obj, "numIters", obj.numIters_);
|
||||
obj.info()->addParam(obj, "polyN", obj.polyN_);
|
||||
obj.info()->addParam(obj, "polySigma", obj.polySigma_);
|
||||
obj.info()->addParam(obj, "flags", obj.flags_))
|
||||
|
||||
Farneback_CUDA::Farneback_CUDA() : GpuOpticalFlow(CV_8UC1)
|
||||
{
|
||||
alg_ = cuda::FarnebackOpticalFlow::create();
|
||||
@@ -686,6 +684,11 @@ namespace
|
||||
flags_ = alg_->getFlags();
|
||||
}
|
||||
|
||||
void Farneback_CUDA::calc(InputArray frame0, InputArray frame1, OutputArray flow1, OutputArray flow2)
|
||||
{
|
||||
GpuOpticalFlow::calc(frame0, frame1, flow1, flow2);
|
||||
}
|
||||
|
||||
void Farneback_CUDA::impl(const GpuMat& input0, const GpuMat& input1, GpuMat& dst1, GpuMat& dst2)
|
||||
{
|
||||
alg_->setPyrScale(pyrScale_);
|
||||
@@ -713,7 +716,7 @@ namespace
|
||||
}
|
||||
}
|
||||
|
||||
Ptr<DenseOpticalFlowExt> cv::superres::createOptFlow_Farneback_CUDA()
|
||||
Ptr<cv::superres::FarnebackOpticalFlow> cv::superres::createOptFlow_Farneback_CUDA()
|
||||
{
|
||||
return makePtr<Farneback_CUDA>();
|
||||
}
|
||||
@@ -723,15 +726,22 @@ Ptr<DenseOpticalFlowExt> cv::superres::createOptFlow_Farneback_CUDA()
|
||||
|
||||
namespace
|
||||
{
|
||||
class DualTVL1_CUDA : public GpuOpticalFlow
|
||||
class DualTVL1_CUDA : public GpuOpticalFlow, public cv::superres::DualTVL1OpticalFlow
|
||||
{
|
||||
public:
|
||||
AlgorithmInfo* info() const;
|
||||
|
||||
DualTVL1_CUDA();
|
||||
|
||||
void calc(InputArray frame0, InputArray frame1, OutputArray flow1, OutputArray flow2);
|
||||
void collectGarbage();
|
||||
|
||||
CV_IMPL_PROPERTY(double, Tau, tau_)
|
||||
CV_IMPL_PROPERTY(double, Lambda, lambda_)
|
||||
CV_IMPL_PROPERTY(double, Theta, theta_)
|
||||
CV_IMPL_PROPERTY(int, ScalesNumber, nscales_)
|
||||
CV_IMPL_PROPERTY(int, WarpingsNumber, warps_)
|
||||
CV_IMPL_PROPERTY(double, Epsilon, epsilon_)
|
||||
CV_IMPL_PROPERTY(int, Iterations, iterations_)
|
||||
CV_IMPL_PROPERTY(bool, UseInitialFlow, useInitialFlow_)
|
||||
|
||||
protected:
|
||||
void impl(const GpuMat& input0, const GpuMat& input1, GpuMat& dst1, GpuMat& dst2);
|
||||
|
||||
@@ -748,16 +758,6 @@ namespace
|
||||
Ptr<cuda::OpticalFlowDual_TVL1> alg_;
|
||||
};
|
||||
|
||||
CV_INIT_ALGORITHM(DualTVL1_CUDA, "DenseOpticalFlowExt.DualTVL1_CUDA",
|
||||
obj.info()->addParam(obj, "tau", obj.tau_);
|
||||
obj.info()->addParam(obj, "lambda", obj.lambda_);
|
||||
obj.info()->addParam(obj, "theta", obj.theta_);
|
||||
obj.info()->addParam(obj, "nscales", obj.nscales_);
|
||||
obj.info()->addParam(obj, "warps", obj.warps_);
|
||||
obj.info()->addParam(obj, "epsilon", obj.epsilon_);
|
||||
obj.info()->addParam(obj, "iterations", obj.iterations_);
|
||||
obj.info()->addParam(obj, "useInitialFlow", obj.useInitialFlow_))
|
||||
|
||||
DualTVL1_CUDA::DualTVL1_CUDA() : GpuOpticalFlow(CV_8UC1)
|
||||
{
|
||||
alg_ = cuda::OpticalFlowDual_TVL1::create();
|
||||
@@ -772,6 +772,11 @@ namespace
|
||||
useInitialFlow_ = alg_->getUseInitialFlow();
|
||||
}
|
||||
|
||||
void DualTVL1_CUDA::calc(InputArray frame0, InputArray frame1, OutputArray flow1, OutputArray flow2)
|
||||
{
|
||||
GpuOpticalFlow::calc(frame0, frame1, flow1, flow2);
|
||||
}
|
||||
|
||||
void DualTVL1_CUDA::impl(const GpuMat& input0, const GpuMat& input1, GpuMat& dst1, GpuMat& dst2)
|
||||
{
|
||||
alg_->setTau(tau_);
|
||||
@@ -800,7 +805,7 @@ namespace
|
||||
}
|
||||
}
|
||||
|
||||
Ptr<DenseOpticalFlowExt> cv::superres::createOptFlow_DualTVL1_CUDA()
|
||||
Ptr<cv::superres::DualTVL1OpticalFlow> cv::superres::createOptFlow_DualTVL1_CUDA()
|
||||
{
|
||||
return makePtr<DualTVL1_CUDA>();
|
||||
}
|
||||
|
||||
@@ -45,11 +45,6 @@
|
||||
using namespace cv;
|
||||
using namespace cv::superres;
|
||||
|
||||
bool cv::superres::initModule_superres()
|
||||
{
|
||||
return !createSuperResolution_BTVL1().empty();
|
||||
}
|
||||
|
||||
cv::superres::SuperResolution::SuperResolution()
|
||||
{
|
||||
frameSource_ = createFrameSource_Empty();
|
||||
|
||||
Reference in New Issue
Block a user