Commit 8af62cd6 authored by Alexander Alekhin's avatar Alexander Alekhin

bgsegm: apply CV_OVERRIDE/CV_FINAL

parent 06de0544
...@@ -196,8 +196,8 @@ class CV_EXPORTS_W BackgroundSubtractorCNT : public BackgroundSubtractor ...@@ -196,8 +196,8 @@ class CV_EXPORTS_W BackgroundSubtractorCNT : public BackgroundSubtractor
{ {
public: public:
// BackgroundSubtractor interface // BackgroundSubtractor interface
CV_WRAP virtual void apply(InputArray image, OutputArray fgmask, double learningRate=-1) = 0; CV_WRAP virtual void apply(InputArray image, OutputArray fgmask, double learningRate=-1) CV_OVERRIDE = 0;
CV_WRAP virtual void getBackgroundImage(OutputArray backgroundImage) const = 0; CV_WRAP virtual void getBackgroundImage(OutputArray backgroundImage) const CV_OVERRIDE = 0;
/** @brief Returns number of frames with same pixel color to consider stable. /** @brief Returns number of frames with same pixel color to consider stable.
*/ */
...@@ -255,9 +255,9 @@ class CV_EXPORTS_W BackgroundSubtractorGSOC : public BackgroundSubtractor ...@@ -255,9 +255,9 @@ class CV_EXPORTS_W BackgroundSubtractorGSOC : public BackgroundSubtractor
{ {
public: public:
// BackgroundSubtractor interface // BackgroundSubtractor interface
CV_WRAP virtual void apply(InputArray image, OutputArray fgmask, double learningRate=-1) = 0; CV_WRAP virtual void apply(InputArray image, OutputArray fgmask, double learningRate=-1) CV_OVERRIDE = 0;
CV_WRAP virtual void getBackgroundImage(OutputArray backgroundImage) const = 0; CV_WRAP virtual void getBackgroundImage(OutputArray backgroundImage) const CV_OVERRIDE = 0;
}; };
/** @brief Background Subtraction using Local SVD Binary Pattern. More details about the algorithm can be found at @cite LGuo2016 /** @brief Background Subtraction using Local SVD Binary Pattern. More details about the algorithm can be found at @cite LGuo2016
...@@ -266,9 +266,9 @@ class CV_EXPORTS_W BackgroundSubtractorLSBP : public BackgroundSubtractor ...@@ -266,9 +266,9 @@ class CV_EXPORTS_W BackgroundSubtractorLSBP : public BackgroundSubtractor
{ {
public: public:
// BackgroundSubtractor interface // BackgroundSubtractor interface
CV_WRAP virtual void apply(InputArray image, OutputArray fgmask, double learningRate=-1) = 0; CV_WRAP virtual void apply(InputArray image, OutputArray fgmask, double learningRate=-1) CV_OVERRIDE = 0;
CV_WRAP virtual void getBackgroundImage(OutputArray backgroundImage) const = 0; CV_WRAP virtual void getBackgroundImage(OutputArray backgroundImage) const CV_OVERRIDE = 0;
}; };
/** @brief This is for calculation of the LSBP descriptors. /** @brief This is for calculation of the LSBP descriptors.
......
...@@ -69,7 +69,7 @@ static const double defaultVarThreshold = 2.5*2.5; ...@@ -69,7 +69,7 @@ static const double defaultVarThreshold = 2.5*2.5;
static const double defaultNoiseSigma = 30*0.5; static const double defaultNoiseSigma = 30*0.5;
static const double defaultInitialWeight = 0.05; static const double defaultInitialWeight = 0.05;
class BackgroundSubtractorMOGImpl : public BackgroundSubtractorMOG class BackgroundSubtractorMOGImpl CV_FINAL : public BackgroundSubtractorMOG
{ {
public: public:
//! the default constructor //! the default constructor
...@@ -102,7 +102,7 @@ public: ...@@ -102,7 +102,7 @@ public:
} }
//! the update operator //! the update operator
virtual void apply(InputArray image, OutputArray fgmask, double learningRate=0); virtual void apply(InputArray image, OutputArray fgmask, double learningRate=0) CV_OVERRIDE;
//! re-initiaization method //! re-initiaization method
virtual void initialize(Size _frameSize, int _frameType) virtual void initialize(Size _frameSize, int _frameType)
...@@ -122,24 +122,24 @@ public: ...@@ -122,24 +122,24 @@ public:
bgmodel = Scalar::all(0); bgmodel = Scalar::all(0);
} }
virtual void getBackgroundImage(OutputArray) const virtual void getBackgroundImage(OutputArray) const CV_OVERRIDE
{ {
CV_Error( Error::StsNotImplemented, "" ); CV_Error( Error::StsNotImplemented, "" );
} }
virtual int getHistory() const { return history; } virtual int getHistory() const CV_OVERRIDE { return history; }
virtual void setHistory(int _nframes) { history = _nframes; } virtual void setHistory(int _nframes) CV_OVERRIDE { history = _nframes; }
virtual int getNMixtures() const { return nmixtures; } virtual int getNMixtures() const CV_OVERRIDE { return nmixtures; }
virtual void setNMixtures(int nmix) { nmixtures = nmix; } virtual void setNMixtures(int nmix) CV_OVERRIDE { nmixtures = nmix; }
virtual double getBackgroundRatio() const { return backgroundRatio; } virtual double getBackgroundRatio() const CV_OVERRIDE { return backgroundRatio; }
virtual void setBackgroundRatio(double _backgroundRatio) { backgroundRatio = _backgroundRatio; } virtual void setBackgroundRatio(double _backgroundRatio) CV_OVERRIDE { backgroundRatio = _backgroundRatio; }
virtual double getNoiseSigma() const { return noiseSigma; } virtual double getNoiseSigma() const CV_OVERRIDE { return noiseSigma; }
virtual void setNoiseSigma(double _noiseSigma) { noiseSigma = _noiseSigma; } virtual void setNoiseSigma(double _noiseSigma) CV_OVERRIDE { noiseSigma = _noiseSigma; }
virtual void write(FileStorage& fs) const virtual void write(FileStorage& fs) const CV_OVERRIDE
{ {
fs << "name" << name_ fs << "name" << name_
<< "history" << history << "history" << history
...@@ -148,7 +148,7 @@ public: ...@@ -148,7 +148,7 @@ public:
<< "noiseSigma" << noiseSigma; << "noiseSigma" << noiseSigma;
} }
virtual void read(const FileNode& fn) virtual void read(const FileNode& fn) CV_OVERRIDE
{ {
CV_Assert( (String)fn["name"] == name_ ); CV_Assert( (String)fn["name"] == name_ );
history = (int)fn["history"]; history = (int)fn["history"];
......
...@@ -57,7 +57,7 @@ namespace cv ...@@ -57,7 +57,7 @@ namespace cv
namespace bgsegm namespace bgsegm
{ {
class BackgroundSubtractorGMGImpl : public BackgroundSubtractorGMG class BackgroundSubtractorGMGImpl CV_FINAL : public BackgroundSubtractorGMG
{ {
public: public:
BackgroundSubtractorGMGImpl() BackgroundSubtractorGMGImpl()
...@@ -96,49 +96,49 @@ public: ...@@ -96,49 +96,49 @@ public:
* @param image Input image * @param image Input image
* @param fgmask Output mask image representing foreground and background pixels * @param fgmask Output mask image representing foreground and background pixels
*/ */
virtual void apply(InputArray image, OutputArray fgmask, double learningRate=-1.0); virtual void apply(InputArray image, OutputArray fgmask, double learningRate=-1.0) CV_OVERRIDE;
/** /**
* Releases all inner buffers. * Releases all inner buffers.
*/ */
void release(); void release();
virtual int getMaxFeatures() const { return maxFeatures; } virtual int getMaxFeatures() const CV_OVERRIDE { return maxFeatures; }
virtual void setMaxFeatures(int _maxFeatures) { maxFeatures = _maxFeatures; } virtual void setMaxFeatures(int _maxFeatures) CV_OVERRIDE { maxFeatures = _maxFeatures; }
virtual double getDefaultLearningRate() const { return learningRate; } virtual double getDefaultLearningRate() const CV_OVERRIDE { return learningRate; }
virtual void setDefaultLearningRate(double lr) { learningRate = lr; } virtual void setDefaultLearningRate(double lr) CV_OVERRIDE { learningRate = lr; }
virtual int getNumFrames() const { return numInitializationFrames; } virtual int getNumFrames() const CV_OVERRIDE { return numInitializationFrames; }
virtual void setNumFrames(int nframes) { numInitializationFrames = nframes; } virtual void setNumFrames(int nframes) CV_OVERRIDE { numInitializationFrames = nframes; }
virtual int getQuantizationLevels() const { return quantizationLevels; } virtual int getQuantizationLevels() const CV_OVERRIDE { return quantizationLevels; }
virtual void setQuantizationLevels(int nlevels) { quantizationLevels = nlevels; } virtual void setQuantizationLevels(int nlevels) CV_OVERRIDE { quantizationLevels = nlevels; }
virtual double getBackgroundPrior() const { return backgroundPrior; } virtual double getBackgroundPrior() const CV_OVERRIDE { return backgroundPrior; }
virtual void setBackgroundPrior(double bgprior) { backgroundPrior = bgprior; } virtual void setBackgroundPrior(double bgprior) CV_OVERRIDE { backgroundPrior = bgprior; }
virtual int getSmoothingRadius() const { return smoothingRadius; } virtual int getSmoothingRadius() const CV_OVERRIDE { return smoothingRadius; }
virtual void setSmoothingRadius(int radius) { smoothingRadius = radius; } virtual void setSmoothingRadius(int radius) CV_OVERRIDE { smoothingRadius = radius; }
virtual double getDecisionThreshold() const { return decisionThreshold; } virtual double getDecisionThreshold() const CV_OVERRIDE { return decisionThreshold; }
virtual void setDecisionThreshold(double thresh) { decisionThreshold = thresh; } virtual void setDecisionThreshold(double thresh) CV_OVERRIDE { decisionThreshold = thresh; }
virtual bool getUpdateBackgroundModel() const { return updateBackgroundModel; } virtual bool getUpdateBackgroundModel() const CV_OVERRIDE { return updateBackgroundModel; }
virtual void setUpdateBackgroundModel(bool update) { updateBackgroundModel = update; } virtual void setUpdateBackgroundModel(bool update) CV_OVERRIDE { updateBackgroundModel = update; }
virtual double getMinVal() const { return minVal_; } virtual double getMinVal() const CV_OVERRIDE { return minVal_; }
virtual void setMinVal(double val) { minVal_ = val; } virtual void setMinVal(double val) CV_OVERRIDE { minVal_ = val; }
virtual double getMaxVal() const { return maxVal_; } virtual double getMaxVal() const CV_OVERRIDE { return maxVal_; }
virtual void setMaxVal(double val) { maxVal_ = val; } virtual void setMaxVal(double val) CV_OVERRIDE { maxVal_ = val; }
virtual void getBackgroundImage(OutputArray backgroundImage) const virtual void getBackgroundImage(OutputArray backgroundImage) const CV_OVERRIDE
{ {
backgroundImage.release(); backgroundImage.release();
} }
virtual void write(FileStorage& fs) const virtual void write(FileStorage& fs) const CV_OVERRIDE
{ {
fs << "name" << name_ fs << "name" << name_
<< "maxFeatures" << maxFeatures << "maxFeatures" << maxFeatures
...@@ -152,7 +152,7 @@ public: ...@@ -152,7 +152,7 @@ public:
// we do not save minVal_ & maxVal_, since they depend on the image type. // we do not save minVal_ & maxVal_, since they depend on the image type.
} }
virtual void read(const FileNode& fn) virtual void read(const FileNode& fn) CV_OVERRIDE
{ {
CV_Assert( (String)fn["name"] == name_ ); CV_Assert( (String)fn["name"] == name_ );
maxFeatures = (int)fn["maxFeatures"]; maxFeatures = (int)fn["maxFeatures"];
...@@ -323,7 +323,7 @@ public: ...@@ -323,7 +323,7 @@ public:
{ {
} }
void operator() (const Range& range) const; void operator() (const Range& range) const CV_OVERRIDE;
private: private:
Mat frame_; Mat frame_;
......
...@@ -364,7 +364,7 @@ private: ...@@ -364,7 +364,7 @@ private:
public: public:
ParallelLocalSVDValues(const Size& _sz, Mat& _localSVDValues, const Mat& _frameGray) : sz(_sz), localSVDValues(_localSVDValues), frameGray(_frameGray) {}; ParallelLocalSVDValues(const Size& _sz, Mat& _localSVDValues, const Mat& _frameGray) : sz(_sz), localSVDValues(_localSVDValues), frameGray(_frameGray) {};
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)
for (int j = 1; j < sz.width - 1; ++j) { for (int j = 1; j < sz.width - 1; ++j) {
localSVDValues.at<float>(i, j) = localSVD( localSVDValues.at<float>(i, j) = localSVD(
...@@ -387,7 +387,7 @@ private: ...@@ -387,7 +387,7 @@ private:
public: public:
ParallelFromLocalSVDValues(const Size& _sz, Mat& _desc, const Mat& _localSVDValues, const Point2i* _LSBPSamplePoints) : sz(_sz), desc(_desc), localSVDValues(_localSVDValues), LSBPSamplePoints(_LSBPSamplePoints) {}; ParallelFromLocalSVDValues(const Size& _sz, Mat& _desc, const Mat& _localSVDValues, const Point2i* _LSBPSamplePoints) : sz(_sz), desc(_desc), localSVDValues(_localSVDValues), LSBPSamplePoints(_LSBPSamplePoints) {};
void operator()(const Range &range) const { void operator()(const Range &range) const CV_OVERRIDE {
for (int index = range.start; index < range.end; ++index) { for (int index = range.start; index < range.end; ++index) {
const int i = index / sz.width, j = index % sz.width; const int i = index / sz.width, j = index % sz.width;
int& descVal = desc.at<int>(i, j); int& descVal = desc.at<int>(i, j);
...@@ -455,7 +455,7 @@ void BackgroundSubtractorLSBPDesc::compute(OutputArray desc, const Mat& frame, c ...@@ -455,7 +455,7 @@ void BackgroundSubtractorLSBPDesc::compute(OutputArray desc, const Mat& frame, c
computeFromLocalSVDValues(desc, localSVDValues, LSBPSamplePoints); computeFromLocalSVDValues(desc, localSVDValues, LSBPSamplePoints);
} }
class BackgroundSubtractorGSOCImpl : public BackgroundSubtractorGSOC { class BackgroundSubtractorGSOCImpl CV_FINAL : public BackgroundSubtractorGSOC {
private: private:
Ptr<BackgroundModelGSOC> backgroundModel; Ptr<BackgroundModelGSOC> backgroundModel;
Ptr<BackgroundModelGSOC> backgroundModelPrev; Ptr<BackgroundModelGSOC> backgroundModelPrev;
...@@ -492,14 +492,14 @@ public: ...@@ -492,14 +492,14 @@ public:
float noiseRemovalThresholdFacBG, float noiseRemovalThresholdFacBG,
float noiseRemovalThresholdFacFG); float noiseRemovalThresholdFacFG);
CV_WRAP virtual void apply(InputArray image, OutputArray fgmask, double learningRate = -1); CV_WRAP virtual void apply(InputArray image, OutputArray fgmask, double learningRate = -1) CV_OVERRIDE;
CV_WRAP virtual void getBackgroundImage(OutputArray backgroundImage) const; CV_WRAP virtual void getBackgroundImage(OutputArray backgroundImage) const CV_OVERRIDE;
friend class ParallelGSOC; friend class ParallelGSOC;
}; };
class BackgroundSubtractorLSBPImpl : public BackgroundSubtractorLSBP { class BackgroundSubtractorLSBPImpl CV_FINAL : public BackgroundSubtractorLSBP {
private: private:
Ptr<BackgroundModelLSBP> backgroundModel; Ptr<BackgroundModelLSBP> backgroundModel;
Ptr<BackgroundModelLSBP> backgroundModelPrev; Ptr<BackgroundModelLSBP> backgroundModelPrev;
...@@ -540,9 +540,9 @@ public: ...@@ -540,9 +540,9 @@ public:
int minCount int minCount
); );
CV_WRAP virtual void apply(InputArray image, OutputArray fgmask, double learningRate = -1); CV_WRAP virtual void apply(InputArray image, OutputArray fgmask, double learningRate = -1) CV_OVERRIDE;
CV_WRAP virtual void getBackgroundImage(OutputArray backgroundImage) const; CV_WRAP virtual void getBackgroundImage(OutputArray backgroundImage) const CV_OVERRIDE;
friend class ParallelLSBP; friend class ParallelLSBP;
}; };
...@@ -561,7 +561,7 @@ public: ...@@ -561,7 +561,7 @@ public:
ParallelGSOC(const Size& _sz, BackgroundSubtractorGSOCImpl* _bgs, const Mat& _frame, double _learningRate, Mat& _fgMask) ParallelGSOC(const Size& _sz, BackgroundSubtractorGSOCImpl* _bgs, const Mat& _frame, double _learningRate, Mat& _fgMask)
: sz(_sz), bgs(_bgs), frame(_frame), learningRate(_learningRate), fgMask(_fgMask) {}; : sz(_sz), bgs(_bgs), frame(_frame), learningRate(_learningRate), fgMask(_fgMask) {};
void operator()(const Range &range) const { void operator()(const Range &range) const CV_OVERRIDE {
BackgroundModelGSOC* backgroundModel = bgs->backgroundModel.get(); BackgroundModelGSOC* backgroundModel = bgs->backgroundModel.get();
Mat& distMovingAvg = bgs->distMovingAvg; Mat& distMovingAvg = bgs->distMovingAvg;
...@@ -621,7 +621,7 @@ public: ...@@ -621,7 +621,7 @@ public:
ParallelLSBP(const Size& _sz, BackgroundSubtractorLSBPImpl* _bgs, const Mat& _frame, double _learningRate, const Mat& _LSBPDesc, Mat& _fgMask) ParallelLSBP(const Size& _sz, BackgroundSubtractorLSBPImpl* _bgs, const Mat& _frame, double _learningRate, const Mat& _LSBPDesc, Mat& _fgMask)
: sz(_sz), bgs(_bgs), frame(_frame), learningRate(_learningRate), LSBPDesc(_LSBPDesc), fgMask(_fgMask) {}; : sz(_sz), bgs(_bgs), frame(_frame), learningRate(_learningRate), LSBPDesc(_LSBPDesc), fgMask(_fgMask) {};
void operator()(const Range &range) const { void operator()(const Range &range) const CV_OVERRIDE {
BackgroundModelLSBP* backgroundModel = bgs->backgroundModel.get(); BackgroundModelLSBP* backgroundModel = bgs->backgroundModel.get();
Mat& T = bgs->T; Mat& T = bgs->T;
Mat& R = bgs->R; Mat& R = bgs->R;
......
...@@ -50,7 +50,7 @@ namespace cv ...@@ -50,7 +50,7 @@ namespace cv
namespace bgsegm namespace bgsegm
{ {
class BackgroundSubtractorCNTImpl: public BackgroundSubtractorCNT class BackgroundSubtractorCNTImpl CV_FINAL : public BackgroundSubtractorCNT
{ {
public: public:
...@@ -60,20 +60,20 @@ public: ...@@ -60,20 +60,20 @@ public:
bool isParallel); bool isParallel);
// BackgroundSubtractor interface // BackgroundSubtractor interface
virtual void apply(InputArray image, OutputArray fgmask, double learningRate); virtual void apply(InputArray image, OutputArray fgmask, double learningRate) CV_OVERRIDE;
virtual void getBackgroundImage(OutputArray backgroundImage) const; virtual void getBackgroundImage(OutputArray backgroundImage) const CV_OVERRIDE;
int getMinPixelStability() const; int getMinPixelStability() const CV_OVERRIDE;
void setMinPixelStability(int value); void setMinPixelStability(int value) CV_OVERRIDE;
int getMaxPixelStability() const; int getMaxPixelStability() const CV_OVERRIDE;
void setMaxPixelStability(int value); void setMaxPixelStability(int value) CV_OVERRIDE;
bool getUseHistory() const; bool getUseHistory() const CV_OVERRIDE;
void setUseHistory(bool value); void setUseHistory(bool value) CV_OVERRIDE;
bool getIsParallel() const; bool getIsParallel() const CV_OVERRIDE;
void setIsParallel(bool value); void setIsParallel(bool value) CV_OVERRIDE;
//! the destructor //! the destructor
virtual ~BackgroundSubtractorCNTImpl() {} virtual ~BackgroundSubtractorCNTImpl() {}
...@@ -185,7 +185,7 @@ struct BGSubtractPixel : public CNTFunctor ...@@ -185,7 +185,7 @@ struct BGSubtractPixel : public CNTFunctor
//! the destructor //! the destructor
virtual ~BGSubtractPixel() {} virtual ~BGSubtractPixel() {}
void operator()(Vec4i &vec, uchar currColor, uchar prevColor, uchar &fgMaskPixelRef) void operator()(Vec4i &vec, uchar currColor, uchar prevColor, uchar &fgMaskPixelRef) CV_OVERRIDE
{ {
int &stabilityRef = vec[0]; int &stabilityRef = vec[0];
int &bgImgRef = vec[3]; int &bgImgRef = vec[3];
...@@ -248,7 +248,7 @@ struct BGSubtractPixelWithHistory : public CNTFunctor ...@@ -248,7 +248,7 @@ struct BGSubtractPixelWithHistory : public CNTFunctor
} }
} }
void operator()(Vec4i &vec, uchar currColor, uchar prevColor, uchar &fgMaskPixelRef) void operator()(Vec4i &vec, uchar currColor, uchar prevColor, uchar &fgMaskPixelRef) CV_OVERRIDE
{ {
int &stabilityRef = vec[0]; int &stabilityRef = vec[0];
int &historyColorRef = vec[1]; int &historyColorRef = vec[1];
...@@ -316,7 +316,7 @@ public: ...@@ -316,7 +316,7 @@ public:
} }
// Iterate rows // Iterate rows
void operator()(const Range& range) const void operator()(const Range& range) const CV_OVERRIDE
{ {
for (int r = range.start; r < range.end; ++r) for (int r = range.start; r < range.end; ++r)
{ {
......
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