superres: apply CV_OVERRIDE/CV_FINAL

pull/11093/head
Alexander Alekhin 7 years ago
parent 4a0fa57614
commit a8eb3e1b29
  1. 4
      modules/superres/include/opencv2/superres.hpp
  2. 44
      modules/superres/src/btv_l1.cpp
  3. 30
      modules/superres/src/btv_l1_cuda.cpp
  4. 10
      modules/superres/src/frame_source.cpp
  5. 141
      modules/superres/src/optical_flow.cpp

@ -97,8 +97,8 @@ namespace cv
@param frame Output result
*/
void nextFrame(OutputArray frame);
void reset();
void nextFrame(OutputArray frame) CV_OVERRIDE;
void reset() CV_OVERRIDE;
/** @brief Clear all inner buffers.
*/

@ -363,7 +363,7 @@ namespace
template <typename T>
struct BtvRegularizationBody : ParallelLoopBody
{
void operator ()(const Range& range) const;
void operator ()(const Range& range) const CV_OVERRIDE;
Mat src;
mutable Mat dst;
@ -470,18 +470,28 @@ namespace
void process(InputArrayOfArrays src, OutputArray dst, InputArrayOfArrays forwardMotions,
InputArrayOfArrays backwardMotions, int baseIdx);
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_)
void collectGarbage() CV_OVERRIDE;
inline int getScale() const CV_OVERRIDE { return scale_; }
inline void setScale(int val) CV_OVERRIDE { scale_ = val; }
inline int getIterations() const CV_OVERRIDE { return iterations_; }
inline void setIterations(int val) CV_OVERRIDE { iterations_ = val; }
inline double getTau() const CV_OVERRIDE { return tau_; }
inline void setTau(double val) CV_OVERRIDE { tau_ = val; }
inline double getLabmda() const CV_OVERRIDE { return lambda_; }
inline void setLabmda(double val) CV_OVERRIDE { lambda_ = val; }
inline double getAlpha() const CV_OVERRIDE { return alpha_; }
inline void setAlpha(double val) CV_OVERRIDE { alpha_ = val; }
inline int getKernelSize() const CV_OVERRIDE { return btvKernelSize_; }
inline void setKernelSize(int val) CV_OVERRIDE { btvKernelSize_ = val; }
inline int getBlurKernelSize() const CV_OVERRIDE { return blurKernelSize_; }
inline void setBlurKernelSize(int val) CV_OVERRIDE { blurKernelSize_ = val; }
inline double getBlurSigma() const CV_OVERRIDE { return blurSigma_; }
inline void setBlurSigma(double val) CV_OVERRIDE { blurSigma_ = val; }
inline int getTemporalAreaRadius() const CV_OVERRIDE { return temporalAreaRadius_; }
inline void setTemporalAreaRadius(int val) CV_OVERRIDE { temporalAreaRadius_ = val; }
inline Ptr<cv::superres::DenseOpticalFlowExt> getOpticalFlow() const CV_OVERRIDE { return opticalFlow_; }
inline void setOpticalFlow(const Ptr<cv::superres::DenseOpticalFlowExt>& val) CV_OVERRIDE { opticalFlow_ = val; }
protected:
int scale_;
@ -798,18 +808,18 @@ namespace
////////////////////////////////////////////////////////////////////
class BTVL1 : public BTVL1_Base
class BTVL1 CV_FINAL : public BTVL1_Base
{
public:
BTVL1();
void collectGarbage();
void collectGarbage() CV_OVERRIDE;
protected:
void initImpl(Ptr<FrameSource>& frameSource);
void initImpl(Ptr<FrameSource>& frameSource) CV_OVERRIDE;
bool ocl_initImpl(Ptr<FrameSource>& frameSource);
void processImpl(Ptr<FrameSource>& frameSource, OutputArray output);
void processImpl(Ptr<FrameSource>& frameSource, OutputArray output) CV_OVERRIDE;
bool ocl_processImpl(Ptr<FrameSource>& frameSource, OutputArray output);
private:

@ -218,16 +218,26 @@ 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_)
inline int getScale() const CV_OVERRIDE { return scale_; }
inline void setScale(int val) CV_OVERRIDE { scale_ = val; }
inline int getIterations() const CV_OVERRIDE { return iterations_; }
inline void setIterations(int val) CV_OVERRIDE { iterations_ = val; }
inline double getTau() const CV_OVERRIDE { return tau_; }
inline void setTau(double val) CV_OVERRIDE { tau_ = val; }
inline double getLabmda() const CV_OVERRIDE { return lambda_; }
inline void setLabmda(double val) CV_OVERRIDE { lambda_ = val; }
inline double getAlpha() const CV_OVERRIDE { return alpha_; }
inline void setAlpha(double val) CV_OVERRIDE { alpha_ = val; }
inline int getKernelSize() const CV_OVERRIDE { return btvKernelSize_; }
inline void setKernelSize(int val) CV_OVERRIDE { btvKernelSize_ = val; }
inline int getBlurKernelSize() const CV_OVERRIDE { return blurKernelSize_; }
inline void setBlurKernelSize(int val) CV_OVERRIDE { blurKernelSize_ = val; }
inline double getBlurSigma() const CV_OVERRIDE { return blurSigma_; }
inline void setBlurSigma(double val) CV_OVERRIDE { blurSigma_ = val; }
inline int getTemporalAreaRadius() const CV_OVERRIDE { return temporalAreaRadius_; }
inline void setTemporalAreaRadius(int val) CV_OVERRIDE { temporalAreaRadius_ = val; }
inline Ptr<cv::superres::DenseOpticalFlowExt> getOpticalFlow() const CV_OVERRIDE { return opticalFlow_; }
inline void setOpticalFlow(const Ptr<cv::superres::DenseOpticalFlowExt>& val) CV_OVERRIDE { opticalFlow_ = val; }
protected:
int scale_;

@ -58,8 +58,8 @@ namespace
class EmptyFrameSource : public FrameSource
{
public:
void nextFrame(OutputArray frame);
void reset();
void nextFrame(OutputArray frame) CV_OVERRIDE;
void reset() CV_OVERRIDE;
};
void EmptyFrameSource::nextFrame(OutputArray frame)
@ -103,7 +103,7 @@ namespace
class CaptureFrameSource : public FrameSource
{
public:
void nextFrame(OutputArray frame);
void nextFrame(OutputArray frame) CV_OVERRIDE;
protected:
VideoCapture vc_;
@ -135,7 +135,7 @@ namespace
public:
VideoFrameSource(const String& fileName);
void reset();
void reset() CV_OVERRIDE;
private:
String fileName_;
@ -158,7 +158,7 @@ namespace
public:
CameraFrameSource(int deviceId);
void reset();
void reset() CV_OVERRIDE;
private:
int deviceId_;

@ -58,8 +58,8 @@ namespace
public:
explicit CpuOpticalFlow(int work_type);
void calc(InputArray frame0, InputArray frame1, OutputArray flow1, OutputArray flow2);
void collectGarbage();
void calc(InputArray frame0, InputArray frame1, OutputArray flow1, OutputArray flow2) CV_OVERRIDE;
void collectGarbage() CV_OVERRIDE;
protected:
virtual void impl(InputArray input0, InputArray input1, OutputArray dst) = 0;
@ -179,23 +179,30 @@ namespace
namespace
{
class Farneback : public CpuOpticalFlow, public cv::superres::FarnebackOpticalFlow
class Farneback CV_FINAL : public CpuOpticalFlow, public cv::superres::FarnebackOpticalFlow
{
public:
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_)
void calc(InputArray frame0, InputArray frame1, OutputArray flow1, OutputArray flow2) CV_OVERRIDE;
void collectGarbage() CV_OVERRIDE;
inline double getPyrScale() const CV_OVERRIDE { return pyrScale_; }
inline void setPyrScale(double val) CV_OVERRIDE { pyrScale_ = val; }
inline int getLevelsNumber() const CV_OVERRIDE { return numLevels_; }
inline void setLevelsNumber(int val) CV_OVERRIDE { numLevels_ = val; }
inline int getWindowSize() const CV_OVERRIDE { return winSize_; }
inline void setWindowSize(int val) CV_OVERRIDE { winSize_ = val; }
inline int getIterations() const CV_OVERRIDE { return numIters_; }
inline void setIterations(int val) CV_OVERRIDE { numIters_ = val; }
inline int getPolyN() const CV_OVERRIDE { return polyN_; }
inline void setPolyN(int val) CV_OVERRIDE { polyN_ = val; }
inline double getPolySigma() const CV_OVERRIDE { return polySigma_; }
inline void setPolySigma(double val) CV_OVERRIDE { polySigma_ = val; }
inline int getFlags() const CV_OVERRIDE { return flags_; }
inline void setFlags(int val) CV_OVERRIDE { flags_ = val; }
protected:
void impl(InputArray input0, InputArray input1, OutputArray dst);
void impl(InputArray input0, InputArray input1, OutputArray dst) CV_OVERRIDE;
private:
double pyrScale_;
@ -336,24 +343,32 @@ Ptr<DenseOpticalFlowExt> cv::superres::createOptFlow_Simple()
namespace
{
class DualTVL1 : public CpuOpticalFlow, public virtual cv::superres::DualTVL1OpticalFlow
class DualTVL1 CV_FINAL : public CpuOpticalFlow, public virtual cv::superres::DualTVL1OpticalFlow
{
public:
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_))
void calc(InputArray frame0, InputArray frame1, OutputArray flow1, OutputArray flow2) CV_OVERRIDE;
void collectGarbage() CV_OVERRIDE;
inline double getTau() const CV_OVERRIDE { return (*alg_).getTau(); }
inline void setTau(double val) CV_OVERRIDE { (*alg_).setTau(val); }
inline double getLambda() const CV_OVERRIDE { return (*alg_).getLambda(); }
inline void setLambda(double val) CV_OVERRIDE { (*alg_).setLambda(val); }
inline double getTheta() const CV_OVERRIDE { return (*alg_).getTheta(); }
inline void setTheta(double val) CV_OVERRIDE { (*alg_).setTheta(val); }
inline int getScalesNumber() const CV_OVERRIDE { return (*alg_).getScalesNumber(); }
inline void setScalesNumber(int val) CV_OVERRIDE { (*alg_).setScalesNumber(val); }
inline int getWarpingsNumber() const CV_OVERRIDE { return (*alg_).getWarpingsNumber(); }
inline void setWarpingsNumber(int val) CV_OVERRIDE { (*alg_).setWarpingsNumber(val); }
inline double getEpsilon() const CV_OVERRIDE { return (*alg_).getEpsilon(); }
inline void setEpsilon(double val) CV_OVERRIDE { (*alg_).setEpsilon(val); }
inline int getIterations() const CV_OVERRIDE { return (*alg_).getOuterIterations(); }
inline void setIterations(int val) CV_OVERRIDE { (*alg_).setOuterIterations(val); }
inline bool getUseInitialFlow() const CV_OVERRIDE { return (*alg_).getUseInitialFlow(); }
inline void setUseInitialFlow(bool val) CV_OVERRIDE { (*alg_).setUseInitialFlow(val); }
protected:
void impl(InputArray input0, InputArray input1, OutputArray dst);
void impl(InputArray input0, InputArray input1, OutputArray dst) CV_OVERRIDE;
private:
Ptr<cv::DualTVL1OpticalFlow> alg_;
@ -498,12 +513,18 @@ namespace
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_)
inline double getAlpha() const CV_OVERRIDE { return alpha_; }
inline void setAlpha(double val) CV_OVERRIDE { alpha_ = val; }
inline double getGamma() const CV_OVERRIDE { return gamma_; }
inline void setGamma(double val) CV_OVERRIDE { gamma_ = val; }
inline double getScaleFactor() const CV_OVERRIDE { return scaleFactor_; }
inline void setScaleFactor(double val) CV_OVERRIDE { scaleFactor_ = val; }
inline int getInnerIterations() const CV_OVERRIDE { return innerIterations_; }
inline void setInnerIterations(int val) CV_OVERRIDE { innerIterations_ = val; }
inline int getOuterIterations() const CV_OVERRIDE { return outerIterations_; }
inline void setOuterIterations(int val) CV_OVERRIDE { outerIterations_ = val; }
inline int getSolverIterations() const CV_OVERRIDE { return solverIterations_; }
inline void setSolverIterations(int val) CV_OVERRIDE { solverIterations_ = val; }
protected:
void impl(const GpuMat& input0, const GpuMat& input1, GpuMat& dst1, GpuMat& dst2);
@ -579,9 +600,12 @@ namespace
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_)
inline int getWindowSize() const CV_OVERRIDE { return winSize_; }
inline void setWindowSize(int val) CV_OVERRIDE { winSize_ = val; }
inline int getMaxLevel() const CV_OVERRIDE { return maxLevel_; }
inline void setMaxLevel(int val) CV_OVERRIDE { maxLevel_ = val; }
inline int getIterations() const CV_OVERRIDE { return iterations_; }
inline void setIterations(int val) CV_OVERRIDE { iterations_ = val; }
protected:
void impl(const GpuMat& input0, const GpuMat& input1, GpuMat& dst1, GpuMat& dst2);
@ -648,13 +672,20 @@ namespace
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_)
inline double getPyrScale() const CV_OVERRIDE { return pyrScale_; }
inline void setPyrScale(double val) CV_OVERRIDE { pyrScale_ = val; }
inline int getLevelsNumber() const CV_OVERRIDE { return numLevels_; }
inline void setLevelsNumber(int val) CV_OVERRIDE { numLevels_ = val; }
inline int getWindowSize() const CV_OVERRIDE { return winSize_; }
inline void setWindowSize(int val) CV_OVERRIDE { winSize_ = val; }
inline int getIterations() const CV_OVERRIDE { return numIters_; }
inline void setIterations(int val) CV_OVERRIDE { numIters_ = val; }
inline int getPolyN() const CV_OVERRIDE { return polyN_; }
inline void setPolyN(int val) CV_OVERRIDE { polyN_ = val; }
inline double getPolySigma() const CV_OVERRIDE { return polySigma_; }
inline void setPolySigma(double val) CV_OVERRIDE { polySigma_ = val; }
inline int getFlags() const CV_OVERRIDE { return flags_; }
inline void setFlags(int val) CV_OVERRIDE { flags_ = val; }
protected:
void impl(const GpuMat& input0, const GpuMat& input1, GpuMat& dst1, GpuMat& dst2);
@ -733,14 +764,22 @@ namespace
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_)
inline double getTau() const CV_OVERRIDE { return tau_; }
inline void setTau(double val) CV_OVERRIDE { tau_ = val; }
inline double getLambda() const CV_OVERRIDE { return lambda_; }
inline void setLambda(double val) CV_OVERRIDE { lambda_ = val; }
inline double getTheta() const CV_OVERRIDE { return theta_; }
inline void setTheta(double val) CV_OVERRIDE { theta_ = val; }
inline int getScalesNumber() const CV_OVERRIDE { return nscales_; }
inline void setScalesNumber(int val) CV_OVERRIDE { nscales_ = val; }
inline int getWarpingsNumber() const CV_OVERRIDE { return warps_; }
inline void setWarpingsNumber(int val) CV_OVERRIDE { warps_ = val; }
inline double getEpsilon() const CV_OVERRIDE { return epsilon_; }
inline void setEpsilon(double val) CV_OVERRIDE { epsilon_ = val; }
inline int getIterations() const CV_OVERRIDE { return iterations_; }
inline void setIterations(int val) CV_OVERRIDE { iterations_ = val; }
inline bool getUseInitialFlow() const CV_OVERRIDE { return useInitialFlow_; }
inline void setUseInitialFlow(bool val) CV_OVERRIDE { useInitialFlow_ = val; }
protected:
void impl(const GpuMat& input0, const GpuMat& input1, GpuMat& dst1, GpuMat& dst2);

Loading…
Cancel
Save