From 0aaaba08af009f1e86dad63d80b3e8323bec8ddf Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Wed, 21 Mar 2018 16:58:12 +0300 Subject: [PATCH] optflow: apply CV_OVERRIDE/CV_FINAL --- .../include/opencv2/optflow/pcaflow.hpp | 4 +- .../opencv2/optflow/sparse_matching_gpc.hpp | 4 +- modules/optflow/src/deepflow.cpp | 4 +- modules/optflow/src/dis_flow.cpp | 50 +++++++++---------- modules/optflow/src/interfaces.cpp | 12 ++--- modules/optflow/src/simpleflow.cpp | 4 +- modules/optflow/src/sparse_matching_gpc.cpp | 4 +- .../optflow/src/variational_refinement.cpp | 42 ++++++++-------- 8 files changed, 62 insertions(+), 62 deletions(-) diff --git a/modules/optflow/include/opencv2/optflow/pcaflow.hpp b/modules/optflow/include/opencv2/optflow/pcaflow.hpp index 6645363b2..78946f69d 100644 --- a/modules/optflow/include/opencv2/optflow/pcaflow.hpp +++ b/modules/optflow/include/opencv2/optflow/pcaflow.hpp @@ -117,8 +117,8 @@ public: float _sparseRate = 0.024, float _retainedCornersFraction = 0.2, float _occlusionsThreshold = 0.0003, float _dampingFactor = 0.00002, float _claheClip = 14 ); - void calc( InputArray I0, InputArray I1, InputOutputArray flow ); - void collectGarbage(); + void calc( InputArray I0, InputArray I1, InputOutputArray flow ) CV_OVERRIDE; + void collectGarbage() CV_OVERRIDE; private: void findSparseFeatures( UMat &from, UMat &to, std::vector &features, diff --git a/modules/optflow/include/opencv2/optflow/sparse_matching_gpc.hpp b/modules/optflow/include/opencv2/optflow/sparse_matching_gpc.hpp index d75d65fd4..4bd6f53ed 100644 --- a/modules/optflow/include/opencv2/optflow/sparse_matching_gpc.hpp +++ b/modules/optflow/include/opencv2/optflow/sparse_matching_gpc.hpp @@ -182,9 +182,9 @@ private: public: void train( GPCTrainingSamples &samples, const GPCTrainingParams params = GPCTrainingParams() ); - void write( FileStorage &fs ) const; + void write( FileStorage &fs ) const CV_OVERRIDE; - void read( const FileNode &fn ); + void read( const FileNode &fn ) CV_OVERRIDE; unsigned findLeafForPatch( const GPCPatchDescriptor &descr ) const; diff --git a/modules/optflow/src/deepflow.cpp b/modules/optflow/src/deepflow.cpp index 61b510111..92423fa32 100644 --- a/modules/optflow/src/deepflow.cpp +++ b/modules/optflow/src/deepflow.cpp @@ -52,8 +52,8 @@ class OpticalFlowDeepFlow: public DenseOpticalFlow public: OpticalFlowDeepFlow(); - void calc( InputArray I0, InputArray I1, InputOutputArray flow ); - void collectGarbage(); + void calc( InputArray I0, InputArray I1, InputOutputArray flow ) CV_OVERRIDE; + void collectGarbage() CV_OVERRIDE; protected: float sigma; // Gaussian smoothing parameter diff --git a/modules/optflow/src/dis_flow.cpp b/modules/optflow/src/dis_flow.cpp index 5b7f82c93..fd05077a7 100644 --- a/modules/optflow/src/dis_flow.cpp +++ b/modules/optflow/src/dis_flow.cpp @@ -52,13 +52,13 @@ namespace cv namespace optflow { -class DISOpticalFlowImpl : public DISOpticalFlow +class DISOpticalFlowImpl CV_FINAL : public DISOpticalFlow { public: DISOpticalFlowImpl(); - void calc(InputArray I0, InputArray I1, InputOutputArray flow); - void collectGarbage(); + void calc(InputArray I0, InputArray I1, InputOutputArray flow) CV_OVERRIDE; + void collectGarbage() CV_OVERRIDE; protected: //!< algorithm parameters int finest_scale, coarsest_scale; @@ -78,27 +78,27 @@ class DISOpticalFlowImpl : public DISOpticalFlow int ws, hs; //!< sparse flow buffer width and height on the current scale public: - int getFinestScale() const { return finest_scale; } - void setFinestScale(int val) { finest_scale = val; } - int getPatchSize() const { return patch_size; } - void setPatchSize(int val) { patch_size = val; } - int getPatchStride() const { return patch_stride; } - void setPatchStride(int val) { patch_stride = val; } - int getGradientDescentIterations() const { return grad_descent_iter; } - void setGradientDescentIterations(int val) { grad_descent_iter = val; } - int getVariationalRefinementIterations() const { return variational_refinement_iter; } - void setVariationalRefinementIterations(int val) { variational_refinement_iter = val; } - float getVariationalRefinementAlpha() const { return variational_refinement_alpha; } - void setVariationalRefinementAlpha(float val) { variational_refinement_alpha = val; } - float getVariationalRefinementDelta() const { return variational_refinement_delta; } - void setVariationalRefinementDelta(float val) { variational_refinement_delta = val; } - float getVariationalRefinementGamma() const { return variational_refinement_gamma; } - void setVariationalRefinementGamma(float val) { variational_refinement_gamma = val; } + int getFinestScale() const CV_OVERRIDE { return finest_scale; } + void setFinestScale(int val) CV_OVERRIDE { finest_scale = val; } + int getPatchSize() const CV_OVERRIDE { return patch_size; } + void setPatchSize(int val) CV_OVERRIDE { patch_size = val; } + int getPatchStride() const CV_OVERRIDE { return patch_stride; } + void setPatchStride(int val) CV_OVERRIDE { patch_stride = val; } + int getGradientDescentIterations() const CV_OVERRIDE { return grad_descent_iter; } + void setGradientDescentIterations(int val) CV_OVERRIDE { grad_descent_iter = val; } + int getVariationalRefinementIterations() const CV_OVERRIDE { return variational_refinement_iter; } + void setVariationalRefinementIterations(int val) CV_OVERRIDE { variational_refinement_iter = val; } + float getVariationalRefinementAlpha() const CV_OVERRIDE { return variational_refinement_alpha; } + void setVariationalRefinementAlpha(float val) CV_OVERRIDE { variational_refinement_alpha = val; } + float getVariationalRefinementDelta() const CV_OVERRIDE { return variational_refinement_delta; } + void setVariationalRefinementDelta(float val) CV_OVERRIDE { variational_refinement_delta = val; } + float getVariationalRefinementGamma() const CV_OVERRIDE { return variational_refinement_gamma; } + void setVariationalRefinementGamma(float val) CV_OVERRIDE { variational_refinement_gamma = val; } - bool getUseMeanNormalization() const { return use_mean_normalization; } - void setUseMeanNormalization(bool val) { use_mean_normalization = val; } - bool getUseSpatialPropagation() const { return use_spatial_propagation; } - void setUseSpatialPropagation(bool val) { use_spatial_propagation = val; } + bool getUseMeanNormalization() const CV_OVERRIDE { return use_mean_normalization; } + void setUseMeanNormalization(bool val) CV_OVERRIDE { use_mean_normalization = val; } + bool getUseSpatialPropagation() const CV_OVERRIDE { return use_spatial_propagation; } + void setUseSpatialPropagation(bool val) CV_OVERRIDE { use_spatial_propagation = val; } protected: //!< internal buffers vector > I0s; //!< Gaussian pyramid for the current frame @@ -153,7 +153,7 @@ class DISOpticalFlowImpl : public DISOpticalFlow PatchInverseSearch_ParBody(DISOpticalFlowImpl &_dis, int _nstripes, int _hs, Mat &dst_Sx, Mat &dst_Sy, Mat &src_Ux, Mat &src_Uy, Mat &_I0, Mat &_I1, Mat &_I0x, Mat &_I0y, int _num_iter, int _pyr_level); - void operator()(const Range &range) const; + void operator()(const Range &range) const CV_OVERRIDE; }; struct Densification_ParBody : public ParallelLoopBody @@ -165,7 +165,7 @@ class DISOpticalFlowImpl : public DISOpticalFlow Densification_ParBody(DISOpticalFlowImpl &_dis, int _nstripes, int _h, Mat &dst_Ux, Mat &dst_Uy, Mat &src_Sx, Mat &src_Sy, Mat &_I0, Mat &_I1); - void operator()(const Range &range) const; + void operator()(const Range &range) const CV_OVERRIDE; }; #ifdef HAVE_OPENCL diff --git a/modules/optflow/src/interfaces.cpp b/modules/optflow/src/interfaces.cpp index 4d9a1cea8..2f657584d 100644 --- a/modules/optflow/src/interfaces.cpp +++ b/modules/optflow/src/interfaces.cpp @@ -53,8 +53,8 @@ class OpticalFlowSimpleFlow : public DenseOpticalFlow { public: OpticalFlowSimpleFlow(); - void calc(InputArray I0, InputArray I1, InputOutputArray flow); - void collectGarbage(); + void calc(InputArray I0, InputArray I1, InputOutputArray flow) CV_OVERRIDE; + void collectGarbage() CV_OVERRIDE; protected: int layers; @@ -125,8 +125,8 @@ class OpticalFlowFarneback : public DenseOpticalFlow { public: OpticalFlowFarneback(); - void calc(InputArray I0, InputArray I1, InputOutputArray flow); - void collectGarbage(); + void calc(InputArray I0, InputArray I1, InputOutputArray flow) CV_OVERRIDE; + void collectGarbage() CV_OVERRIDE; protected: int numLevels; double pyrScale; @@ -181,8 +181,8 @@ class OpticalFlowSparseToDense : public DenseOpticalFlow { public: OpticalFlowSparseToDense(int _grid_step, int _k, float _sigma, bool _use_post_proc, float _fgs_lambda, float _fgs_sigma); - void calc(InputArray I0, InputArray I1, InputOutputArray flow); - void collectGarbage(); + void calc(InputArray I0, InputArray I1, InputOutputArray flow) CV_OVERRIDE; + void collectGarbage() CV_OVERRIDE; protected: int grid_step; int k; diff --git a/modules/optflow/src/simpleflow.cpp b/modules/optflow/src/simpleflow.cpp index 337ef0073..5067605dc 100644 --- a/modules/optflow/src/simpleflow.cpp +++ b/modules/optflow/src/simpleflow.cpp @@ -136,7 +136,7 @@ public: CV_DbgAssert(joint.cols == src.cols && confidence.cols == src.cols && src.cols == dst.cols + 2 * radius); } - void operator()(const Range &range) const { + void operator()(const Range &range) const CV_OVERRIDE { const int d = 2*radius +1; for (int i = range.start; i < range.end; i++) { SrcVec* dstRow = dst.ptr(i); @@ -296,7 +296,7 @@ public: CV_DbgAssert(prev.cols == next.cols && next.cols == dst.cols + 2 * radius); } - void operator()(const Range &range) const { + void operator()(const Range &range) const CV_OVERRIDE { int d = 2 * radius + 1; Mat weights(d, d, CV_32F); for (int i = range.start; i < range.end; i++) { diff --git a/modules/optflow/src/sparse_matching_gpc.cpp b/modules/optflow/src/sparse_matching_gpc.cpp index 6c485e160..d7b920d14 100644 --- a/modules/optflow/src/sparse_matching_gpc.cpp +++ b/modules/optflow/src/sparse_matching_gpc.cpp @@ -249,7 +249,7 @@ public: ParallelDCTFiller( const Size &_sz, const Mat *_imgCh, std::vector< GPCPatchDescriptor > *_descr ) : sz( _sz ), imgCh( _imgCh ), descr( _descr ){}; - void operator()( const Range &range ) const + void operator()( const Range &range ) const CV_OVERRIDE { for ( int i = range.start; i < range.end; ++i ) { @@ -312,7 +312,7 @@ public: ParallelWHTFiller( const Size &_sz, const Mat *_imgChInt, std::vector< GPCPatchDescriptor > *_descr ) : sz( _sz ), imgChInt( _imgChInt ), descr( _descr ){}; - void operator()( const Range &range ) const + void operator()( const Range &range ) const CV_OVERRIDE { for ( int i = range.start; i < range.end; ++i ) { diff --git a/modules/optflow/src/variational_refinement.cpp b/modules/optflow/src/variational_refinement.cpp index 6353c09a7..d29ae254d 100644 --- a/modules/optflow/src/variational_refinement.cpp +++ b/modules/optflow/src/variational_refinement.cpp @@ -49,14 +49,14 @@ namespace cv namespace optflow { -class VariationalRefinementImpl : public VariationalRefinement +class VariationalRefinementImpl CV_FINAL : public VariationalRefinement { public: VariationalRefinementImpl(); - void calc(InputArray I0, InputArray I1, InputOutputArray flow); - void calcUV(InputArray I0, InputArray I1, InputOutputArray flow_u, InputOutputArray flow_v); - void collectGarbage(); + void calc(InputArray I0, InputArray I1, InputOutputArray flow) CV_OVERRIDE; + void calcUV(InputArray I0, InputArray I1, InputOutputArray flow_u, InputOutputArray flow_v) CV_OVERRIDE; + void collectGarbage() CV_OVERRIDE; protected: //!< algorithm parameters int fixedPointIterations, sorIterations; @@ -65,18 +65,18 @@ class VariationalRefinementImpl : public VariationalRefinement float zeta, epsilon; public: - int getFixedPointIterations() const { return fixedPointIterations; } - void setFixedPointIterations(int val) { fixedPointIterations = val; } - int getSorIterations() const { return sorIterations; } - void setSorIterations(int val) { sorIterations = val; } - float getOmega() const { return omega; } - void setOmega(float val) { omega = val; } - float getAlpha() const { return alpha; } - void setAlpha(float val) { alpha = val; } - float getDelta() const { return delta; } - void setDelta(float val) { delta = val; } - float getGamma() const { return gamma; } - void setGamma(float val) { gamma = val; } + int getFixedPointIterations() const CV_OVERRIDE { return fixedPointIterations; } + void setFixedPointIterations(int val) CV_OVERRIDE { fixedPointIterations = val; } + int getSorIterations() const CV_OVERRIDE { return sorIterations; } + void setSorIterations(int val) CV_OVERRIDE { sorIterations = val; } + float getOmega() const CV_OVERRIDE { return omega; } + void setOmega(float val) CV_OVERRIDE { omega = val; } + float getAlpha() const CV_OVERRIDE { return alpha; } + void setAlpha(float val) CV_OVERRIDE { alpha = val; } + float getDelta() const CV_OVERRIDE { return delta; } + void setDelta(float val) CV_OVERRIDE { delta = val; } + float getGamma() const CV_OVERRIDE { return gamma; } + void setGamma(float val) CV_OVERRIDE { gamma = val; } protected: //!< internal buffers /* This struct defines a special data layout for Mat_. Original buffer is split into two: one for "red" @@ -129,7 +129,7 @@ class VariationalRefinementImpl : public VariationalRefinement ParallelOp_ParBody(VariationalRefinementImpl &_var, vector _ops, vector &_op1s, vector &_op2s, vector &_op3s); - void operator()(const Range &range) const; + void operator()(const Range &range) const CV_OVERRIDE; }; void gradHorizAndSplitOp(void *src, void *dst, void *dst_split) { @@ -160,7 +160,7 @@ class VariationalRefinementImpl : public VariationalRefinement ComputeDataTerm_ParBody(VariationalRefinementImpl &_var, int _nstripes, int _h, RedBlackBuffer &_dW_u, RedBlackBuffer &_dW_v, bool _red_pass); - void operator()(const Range &range) const; + void operator()(const Range &range) const CV_OVERRIDE; }; struct ComputeSmoothnessTermHorPass_ParBody : public ParallelLoopBody @@ -174,7 +174,7 @@ class VariationalRefinementImpl : public VariationalRefinement ComputeSmoothnessTermHorPass_ParBody(VariationalRefinementImpl &_var, int _nstripes, int _h, RedBlackBuffer &_W_u, RedBlackBuffer &_W_v, RedBlackBuffer &_tempW_u, RedBlackBuffer &_tempW_v, bool _red_pass); - void operator()(const Range &range) const; + void operator()(const Range &range) const CV_OVERRIDE; }; struct ComputeSmoothnessTermVertPass_ParBody : public ParallelLoopBody @@ -187,7 +187,7 @@ class VariationalRefinementImpl : public VariationalRefinement ComputeSmoothnessTermVertPass_ParBody(VariationalRefinementImpl &_var, int _nstripes, int _h, RedBlackBuffer &W_u, RedBlackBuffer &_W_v, bool _red_pass); - void operator()(const Range &range) const; + void operator()(const Range &range) const CV_OVERRIDE; }; struct RedBlackSOR_ParBody : public ParallelLoopBody @@ -200,7 +200,7 @@ class VariationalRefinementImpl : public VariationalRefinement RedBlackSOR_ParBody(VariationalRefinementImpl &_var, int _nstripes, int _h, RedBlackBuffer &_dW_u, RedBlackBuffer &_dW_v, bool _red_pass); - void operator()(const Range &range) const; + void operator()(const Range &range) const CV_OVERRIDE; }; };