mirror of
https://github.com/opencv/opencv_contrib.git
synced 2025-10-20 21:40:49 +08:00
optflow: apply CV_OVERRIDE/CV_FINAL
This commit is contained in:
@@ -117,8 +117,8 @@ public:
|
|||||||
float _sparseRate = 0.024, float _retainedCornersFraction = 0.2,
|
float _sparseRate = 0.024, float _retainedCornersFraction = 0.2,
|
||||||
float _occlusionsThreshold = 0.0003, float _dampingFactor = 0.00002, float _claheClip = 14 );
|
float _occlusionsThreshold = 0.0003, float _dampingFactor = 0.00002, float _claheClip = 14 );
|
||||||
|
|
||||||
void calc( InputArray I0, InputArray I1, InputOutputArray flow );
|
void calc( InputArray I0, InputArray I1, InputOutputArray flow ) CV_OVERRIDE;
|
||||||
void collectGarbage();
|
void collectGarbage() CV_OVERRIDE;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void findSparseFeatures( UMat &from, UMat &to, std::vector<Point2f> &features,
|
void findSparseFeatures( UMat &from, UMat &to, std::vector<Point2f> &features,
|
||||||
|
@@ -182,9 +182,9 @@ private:
|
|||||||
public:
|
public:
|
||||||
void train( GPCTrainingSamples &samples, const GPCTrainingParams params = GPCTrainingParams() );
|
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;
|
unsigned findLeafForPatch( const GPCPatchDescriptor &descr ) const;
|
||||||
|
|
||||||
|
@@ -52,8 +52,8 @@ class OpticalFlowDeepFlow: public DenseOpticalFlow
|
|||||||
public:
|
public:
|
||||||
OpticalFlowDeepFlow();
|
OpticalFlowDeepFlow();
|
||||||
|
|
||||||
void calc( InputArray I0, InputArray I1, InputOutputArray flow );
|
void calc( InputArray I0, InputArray I1, InputOutputArray flow ) CV_OVERRIDE;
|
||||||
void collectGarbage();
|
void collectGarbage() CV_OVERRIDE;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
float sigma; // Gaussian smoothing parameter
|
float sigma; // Gaussian smoothing parameter
|
||||||
|
@@ -52,13 +52,13 @@ namespace cv
|
|||||||
namespace optflow
|
namespace optflow
|
||||||
{
|
{
|
||||||
|
|
||||||
class DISOpticalFlowImpl : public DISOpticalFlow
|
class DISOpticalFlowImpl CV_FINAL : public DISOpticalFlow
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DISOpticalFlowImpl();
|
DISOpticalFlowImpl();
|
||||||
|
|
||||||
void calc(InputArray I0, InputArray I1, InputOutputArray flow);
|
void calc(InputArray I0, InputArray I1, InputOutputArray flow) CV_OVERRIDE;
|
||||||
void collectGarbage();
|
void collectGarbage() CV_OVERRIDE;
|
||||||
|
|
||||||
protected: //!< algorithm parameters
|
protected: //!< algorithm parameters
|
||||||
int finest_scale, coarsest_scale;
|
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
|
int ws, hs; //!< sparse flow buffer width and height on the current scale
|
||||||
|
|
||||||
public:
|
public:
|
||||||
int getFinestScale() const { return finest_scale; }
|
int getFinestScale() const CV_OVERRIDE { return finest_scale; }
|
||||||
void setFinestScale(int val) { finest_scale = val; }
|
void setFinestScale(int val) CV_OVERRIDE { finest_scale = val; }
|
||||||
int getPatchSize() const { return patch_size; }
|
int getPatchSize() const CV_OVERRIDE { return patch_size; }
|
||||||
void setPatchSize(int val) { patch_size = val; }
|
void setPatchSize(int val) CV_OVERRIDE { patch_size = val; }
|
||||||
int getPatchStride() const { return patch_stride; }
|
int getPatchStride() const CV_OVERRIDE { return patch_stride; }
|
||||||
void setPatchStride(int val) { patch_stride = val; }
|
void setPatchStride(int val) CV_OVERRIDE { patch_stride = val; }
|
||||||
int getGradientDescentIterations() const { return grad_descent_iter; }
|
int getGradientDescentIterations() const CV_OVERRIDE { return grad_descent_iter; }
|
||||||
void setGradientDescentIterations(int val) { grad_descent_iter = val; }
|
void setGradientDescentIterations(int val) CV_OVERRIDE { grad_descent_iter = val; }
|
||||||
int getVariationalRefinementIterations() const { return variational_refinement_iter; }
|
int getVariationalRefinementIterations() const CV_OVERRIDE { return variational_refinement_iter; }
|
||||||
void setVariationalRefinementIterations(int val) { variational_refinement_iter = val; }
|
void setVariationalRefinementIterations(int val) CV_OVERRIDE { variational_refinement_iter = val; }
|
||||||
float getVariationalRefinementAlpha() const { return variational_refinement_alpha; }
|
float getVariationalRefinementAlpha() const CV_OVERRIDE { return variational_refinement_alpha; }
|
||||||
void setVariationalRefinementAlpha(float val) { variational_refinement_alpha = val; }
|
void setVariationalRefinementAlpha(float val) CV_OVERRIDE { variational_refinement_alpha = val; }
|
||||||
float getVariationalRefinementDelta() const { return variational_refinement_delta; }
|
float getVariationalRefinementDelta() const CV_OVERRIDE { return variational_refinement_delta; }
|
||||||
void setVariationalRefinementDelta(float val) { variational_refinement_delta = val; }
|
void setVariationalRefinementDelta(float val) CV_OVERRIDE { variational_refinement_delta = val; }
|
||||||
float getVariationalRefinementGamma() const { return variational_refinement_gamma; }
|
float getVariationalRefinementGamma() const CV_OVERRIDE { return variational_refinement_gamma; }
|
||||||
void setVariationalRefinementGamma(float val) { variational_refinement_gamma = val; }
|
void setVariationalRefinementGamma(float val) CV_OVERRIDE { variational_refinement_gamma = val; }
|
||||||
|
|
||||||
bool getUseMeanNormalization() const { return use_mean_normalization; }
|
bool getUseMeanNormalization() const CV_OVERRIDE { return use_mean_normalization; }
|
||||||
void setUseMeanNormalization(bool val) { use_mean_normalization = val; }
|
void setUseMeanNormalization(bool val) CV_OVERRIDE { use_mean_normalization = val; }
|
||||||
bool getUseSpatialPropagation() const { return use_spatial_propagation; }
|
bool getUseSpatialPropagation() const CV_OVERRIDE { return use_spatial_propagation; }
|
||||||
void setUseSpatialPropagation(bool val) { use_spatial_propagation = val; }
|
void setUseSpatialPropagation(bool val) CV_OVERRIDE { use_spatial_propagation = val; }
|
||||||
|
|
||||||
protected: //!< internal buffers
|
protected: //!< internal buffers
|
||||||
vector<Mat_<uchar> > I0s; //!< Gaussian pyramid for the current frame
|
vector<Mat_<uchar> > 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,
|
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,
|
Mat &src_Ux, Mat &src_Uy, Mat &_I0, Mat &_I1, Mat &_I0x, Mat &_I0y, int _num_iter,
|
||||||
int _pyr_level);
|
int _pyr_level);
|
||||||
void operator()(const Range &range) const;
|
void operator()(const Range &range) const CV_OVERRIDE;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Densification_ParBody : public ParallelLoopBody
|
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,
|
Densification_ParBody(DISOpticalFlowImpl &_dis, int _nstripes, int _h, Mat &dst_Ux, Mat &dst_Uy, Mat &src_Sx,
|
||||||
Mat &src_Sy, Mat &_I0, Mat &_I1);
|
Mat &src_Sy, Mat &_I0, Mat &_I1);
|
||||||
void operator()(const Range &range) const;
|
void operator()(const Range &range) const CV_OVERRIDE;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef HAVE_OPENCL
|
#ifdef HAVE_OPENCL
|
||||||
|
@@ -53,8 +53,8 @@ class OpticalFlowSimpleFlow : public DenseOpticalFlow
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
OpticalFlowSimpleFlow();
|
OpticalFlowSimpleFlow();
|
||||||
void calc(InputArray I0, InputArray I1, InputOutputArray flow);
|
void calc(InputArray I0, InputArray I1, InputOutputArray flow) CV_OVERRIDE;
|
||||||
void collectGarbage();
|
void collectGarbage() CV_OVERRIDE;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int layers;
|
int layers;
|
||||||
@@ -125,8 +125,8 @@ class OpticalFlowFarneback : public DenseOpticalFlow
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
OpticalFlowFarneback();
|
OpticalFlowFarneback();
|
||||||
void calc(InputArray I0, InputArray I1, InputOutputArray flow);
|
void calc(InputArray I0, InputArray I1, InputOutputArray flow) CV_OVERRIDE;
|
||||||
void collectGarbage();
|
void collectGarbage() CV_OVERRIDE;
|
||||||
protected:
|
protected:
|
||||||
int numLevels;
|
int numLevels;
|
||||||
double pyrScale;
|
double pyrScale;
|
||||||
@@ -181,8 +181,8 @@ class OpticalFlowSparseToDense : public DenseOpticalFlow
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
OpticalFlowSparseToDense(int _grid_step, int _k, float _sigma, bool _use_post_proc, float _fgs_lambda, float _fgs_sigma);
|
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 calc(InputArray I0, InputArray I1, InputOutputArray flow) CV_OVERRIDE;
|
||||||
void collectGarbage();
|
void collectGarbage() CV_OVERRIDE;
|
||||||
protected:
|
protected:
|
||||||
int grid_step;
|
int grid_step;
|
||||||
int k;
|
int k;
|
||||||
|
@@ -136,7 +136,7 @@ public:
|
|||||||
CV_DbgAssert(joint.cols == src.cols && confidence.cols == src.cols && src.cols == dst.cols + 2 * radius);
|
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;
|
const int d = 2*radius +1;
|
||||||
for (int i = range.start; i < range.end; i++) {
|
for (int i = range.start; i < range.end; i++) {
|
||||||
SrcVec* dstRow = dst.ptr<SrcVec>(i);
|
SrcVec* dstRow = dst.ptr<SrcVec>(i);
|
||||||
@@ -296,7 +296,7 @@ public:
|
|||||||
CV_DbgAssert(prev.cols == next.cols && next.cols == dst.cols + 2 * radius);
|
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;
|
int d = 2 * radius + 1;
|
||||||
Mat weights(d, d, CV_32F);
|
Mat weights(d, d, CV_32F);
|
||||||
for (int i = range.start; i < range.end; i++) {
|
for (int i = range.start; i < range.end; i++) {
|
||||||
|
@@ -249,7 +249,7 @@ public:
|
|||||||
ParallelDCTFiller( const Size &_sz, const Mat *_imgCh, std::vector< GPCPatchDescriptor > *_descr )
|
ParallelDCTFiller( const Size &_sz, const Mat *_imgCh, std::vector< GPCPatchDescriptor > *_descr )
|
||||||
: sz( _sz ), imgCh( _imgCh ), descr( _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 )
|
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 )
|
ParallelWHTFiller( const Size &_sz, const Mat *_imgChInt, std::vector< GPCPatchDescriptor > *_descr )
|
||||||
: sz( _sz ), imgChInt( _imgChInt ), descr( _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 )
|
for ( int i = range.start; i < range.end; ++i )
|
||||||
{
|
{
|
||||||
|
@@ -49,14 +49,14 @@ namespace cv
|
|||||||
namespace optflow
|
namespace optflow
|
||||||
{
|
{
|
||||||
|
|
||||||
class VariationalRefinementImpl : public VariationalRefinement
|
class VariationalRefinementImpl CV_FINAL : public VariationalRefinement
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
VariationalRefinementImpl();
|
VariationalRefinementImpl();
|
||||||
|
|
||||||
void calc(InputArray I0, InputArray I1, InputOutputArray flow);
|
void calc(InputArray I0, InputArray I1, InputOutputArray flow) CV_OVERRIDE;
|
||||||
void calcUV(InputArray I0, InputArray I1, InputOutputArray flow_u, InputOutputArray flow_v);
|
void calcUV(InputArray I0, InputArray I1, InputOutputArray flow_u, InputOutputArray flow_v) CV_OVERRIDE;
|
||||||
void collectGarbage();
|
void collectGarbage() CV_OVERRIDE;
|
||||||
|
|
||||||
protected: //!< algorithm parameters
|
protected: //!< algorithm parameters
|
||||||
int fixedPointIterations, sorIterations;
|
int fixedPointIterations, sorIterations;
|
||||||
@@ -65,18 +65,18 @@ class VariationalRefinementImpl : public VariationalRefinement
|
|||||||
float zeta, epsilon;
|
float zeta, epsilon;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
int getFixedPointIterations() const { return fixedPointIterations; }
|
int getFixedPointIterations() const CV_OVERRIDE { return fixedPointIterations; }
|
||||||
void setFixedPointIterations(int val) { fixedPointIterations = val; }
|
void setFixedPointIterations(int val) CV_OVERRIDE { fixedPointIterations = val; }
|
||||||
int getSorIterations() const { return sorIterations; }
|
int getSorIterations() const CV_OVERRIDE { return sorIterations; }
|
||||||
void setSorIterations(int val) { sorIterations = val; }
|
void setSorIterations(int val) CV_OVERRIDE { sorIterations = val; }
|
||||||
float getOmega() const { return omega; }
|
float getOmega() const CV_OVERRIDE { return omega; }
|
||||||
void setOmega(float val) { omega = val; }
|
void setOmega(float val) CV_OVERRIDE { omega = val; }
|
||||||
float getAlpha() const { return alpha; }
|
float getAlpha() const CV_OVERRIDE { return alpha; }
|
||||||
void setAlpha(float val) { alpha = val; }
|
void setAlpha(float val) CV_OVERRIDE { alpha = val; }
|
||||||
float getDelta() const { return delta; }
|
float getDelta() const CV_OVERRIDE { return delta; }
|
||||||
void setDelta(float val) { delta = val; }
|
void setDelta(float val) CV_OVERRIDE { delta = val; }
|
||||||
float getGamma() const { return gamma; }
|
float getGamma() const CV_OVERRIDE { return gamma; }
|
||||||
void setGamma(float val) { gamma = val; }
|
void setGamma(float val) CV_OVERRIDE { gamma = val; }
|
||||||
|
|
||||||
protected: //!< internal buffers
|
protected: //!< internal buffers
|
||||||
/* This struct defines a special data layout for Mat_<float>. Original buffer is split into two: one for "red"
|
/* This struct defines a special data layout for Mat_<float>. Original buffer is split into two: one for "red"
|
||||||
@@ -129,7 +129,7 @@ class VariationalRefinementImpl : public VariationalRefinement
|
|||||||
|
|
||||||
ParallelOp_ParBody(VariationalRefinementImpl &_var, vector<Op> _ops, vector<void *> &_op1s,
|
ParallelOp_ParBody(VariationalRefinementImpl &_var, vector<Op> _ops, vector<void *> &_op1s,
|
||||||
vector<void *> &_op2s, vector<void *> &_op3s);
|
vector<void *> &_op2s, vector<void *> &_op3s);
|
||||||
void operator()(const Range &range) const;
|
void operator()(const Range &range) const CV_OVERRIDE;
|
||||||
};
|
};
|
||||||
void gradHorizAndSplitOp(void *src, void *dst, void *dst_split)
|
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,
|
ComputeDataTerm_ParBody(VariationalRefinementImpl &_var, int _nstripes, int _h, RedBlackBuffer &_dW_u,
|
||||||
RedBlackBuffer &_dW_v, bool _red_pass);
|
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
|
struct ComputeSmoothnessTermHorPass_ParBody : public ParallelLoopBody
|
||||||
@@ -174,7 +174,7 @@ class VariationalRefinementImpl : public VariationalRefinement
|
|||||||
ComputeSmoothnessTermHorPass_ParBody(VariationalRefinementImpl &_var, int _nstripes, int _h,
|
ComputeSmoothnessTermHorPass_ParBody(VariationalRefinementImpl &_var, int _nstripes, int _h,
|
||||||
RedBlackBuffer &_W_u, RedBlackBuffer &_W_v, RedBlackBuffer &_tempW_u,
|
RedBlackBuffer &_W_u, RedBlackBuffer &_W_v, RedBlackBuffer &_tempW_u,
|
||||||
RedBlackBuffer &_tempW_v, bool _red_pass);
|
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
|
struct ComputeSmoothnessTermVertPass_ParBody : public ParallelLoopBody
|
||||||
@@ -187,7 +187,7 @@ class VariationalRefinementImpl : public VariationalRefinement
|
|||||||
|
|
||||||
ComputeSmoothnessTermVertPass_ParBody(VariationalRefinementImpl &_var, int _nstripes, int _h,
|
ComputeSmoothnessTermVertPass_ParBody(VariationalRefinementImpl &_var, int _nstripes, int _h,
|
||||||
RedBlackBuffer &W_u, RedBlackBuffer &_W_v, bool _red_pass);
|
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
|
struct RedBlackSOR_ParBody : public ParallelLoopBody
|
||||||
@@ -200,7 +200,7 @@ class VariationalRefinementImpl : public VariationalRefinement
|
|||||||
|
|
||||||
RedBlackSOR_ParBody(VariationalRefinementImpl &_var, int _nstripes, int _h, RedBlackBuffer &_dW_u,
|
RedBlackSOR_ParBody(VariationalRefinementImpl &_var, int _nstripes, int _h, RedBlackBuffer &_dW_u,
|
||||||
RedBlackBuffer &_dW_v, bool _red_pass);
|
RedBlackBuffer &_dW_v, bool _red_pass);
|
||||||
void operator()(const Range &range) const;
|
void operator()(const Range &range) const CV_OVERRIDE;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user