diff --git a/modules/bgsegm/include/opencv2/bgsegm.hpp b/modules/bgsegm/include/opencv2/bgsegm.hpp index 011592a44..8ace5d9a5 100644 --- a/modules/bgsegm/include/opencv2/bgsegm.hpp +++ b/modules/bgsegm/include/opencv2/bgsegm.hpp @@ -196,8 +196,8 @@ class CV_EXPORTS_W BackgroundSubtractorCNT : public BackgroundSubtractor { public: // BackgroundSubtractor interface - CV_WRAP virtual void apply(InputArray image, OutputArray fgmask, double learningRate=-1) = 0; - CV_WRAP virtual void getBackgroundImage(OutputArray backgroundImage) const = 0; + CV_WRAP virtual void apply(InputArray image, OutputArray fgmask, double learningRate=-1) CV_OVERRIDE = 0; + CV_WRAP virtual void getBackgroundImage(OutputArray backgroundImage) const CV_OVERRIDE = 0; /** @brief Returns number of frames with same pixel color to consider stable. */ @@ -255,9 +255,9 @@ class CV_EXPORTS_W BackgroundSubtractorGSOC : public BackgroundSubtractor { public: // 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 @@ -266,9 +266,9 @@ class CV_EXPORTS_W BackgroundSubtractorLSBP : public BackgroundSubtractor { public: // 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. diff --git a/modules/bgsegm/src/bgfg_gaussmix.cpp b/modules/bgsegm/src/bgfg_gaussmix.cpp index 9e9d448da..d6c167689 100644 --- a/modules/bgsegm/src/bgfg_gaussmix.cpp +++ b/modules/bgsegm/src/bgfg_gaussmix.cpp @@ -69,7 +69,7 @@ static const double defaultVarThreshold = 2.5*2.5; static const double defaultNoiseSigma = 30*0.5; static const double defaultInitialWeight = 0.05; -class BackgroundSubtractorMOGImpl : public BackgroundSubtractorMOG +class BackgroundSubtractorMOGImpl CV_FINAL : public BackgroundSubtractorMOG { public: //! the default constructor @@ -102,7 +102,7 @@ public: } //! 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 virtual void initialize(Size _frameSize, int _frameType) @@ -122,24 +122,24 @@ public: bgmodel = Scalar::all(0); } - virtual void getBackgroundImage(OutputArray) const + virtual void getBackgroundImage(OutputArray) const CV_OVERRIDE { CV_Error( Error::StsNotImplemented, "" ); } - virtual int getHistory() const { return history; } - virtual void setHistory(int _nframes) { history = _nframes; } + virtual int getHistory() const CV_OVERRIDE { return history; } + virtual void setHistory(int _nframes) CV_OVERRIDE { history = _nframes; } - virtual int getNMixtures() const { return nmixtures; } - virtual void setNMixtures(int nmix) { nmixtures = nmix; } + virtual int getNMixtures() const CV_OVERRIDE { return nmixtures; } + virtual void setNMixtures(int nmix) CV_OVERRIDE { nmixtures = nmix; } - virtual double getBackgroundRatio() const { return backgroundRatio; } - virtual void setBackgroundRatio(double _backgroundRatio) { backgroundRatio = _backgroundRatio; } + virtual double getBackgroundRatio() const CV_OVERRIDE { return backgroundRatio; } + virtual void setBackgroundRatio(double _backgroundRatio) CV_OVERRIDE { backgroundRatio = _backgroundRatio; } - virtual double getNoiseSigma() const { return noiseSigma; } - virtual void setNoiseSigma(double _noiseSigma) { noiseSigma = _noiseSigma; } + virtual double getNoiseSigma() const CV_OVERRIDE { return 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_ << "history" << history @@ -148,7 +148,7 @@ public: << "noiseSigma" << noiseSigma; } - virtual void read(const FileNode& fn) + virtual void read(const FileNode& fn) CV_OVERRIDE { CV_Assert( (String)fn["name"] == name_ ); history = (int)fn["history"]; diff --git a/modules/bgsegm/src/bgfg_gmg.cpp b/modules/bgsegm/src/bgfg_gmg.cpp index 5036f1968..353b8718c 100644 --- a/modules/bgsegm/src/bgfg_gmg.cpp +++ b/modules/bgsegm/src/bgfg_gmg.cpp @@ -57,7 +57,7 @@ namespace cv namespace bgsegm { -class BackgroundSubtractorGMGImpl : public BackgroundSubtractorGMG +class BackgroundSubtractorGMGImpl CV_FINAL : public BackgroundSubtractorGMG { public: BackgroundSubtractorGMGImpl() @@ -96,49 +96,49 @@ public: * @param image Input image * @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. */ void release(); - virtual int getMaxFeatures() const { return maxFeatures; } - virtual void setMaxFeatures(int _maxFeatures) { maxFeatures = _maxFeatures; } + virtual int getMaxFeatures() const CV_OVERRIDE { return maxFeatures; } + virtual void setMaxFeatures(int _maxFeatures) CV_OVERRIDE { maxFeatures = _maxFeatures; } - virtual double getDefaultLearningRate() const { return learningRate; } - virtual void setDefaultLearningRate(double lr) { learningRate = lr; } + virtual double getDefaultLearningRate() const CV_OVERRIDE { return learningRate; } + virtual void setDefaultLearningRate(double lr) CV_OVERRIDE { learningRate = lr; } - virtual int getNumFrames() const { return numInitializationFrames; } - virtual void setNumFrames(int nframes) { numInitializationFrames = nframes; } + virtual int getNumFrames() const CV_OVERRIDE { return numInitializationFrames; } + virtual void setNumFrames(int nframes) CV_OVERRIDE { numInitializationFrames = nframes; } - virtual int getQuantizationLevels() const { return quantizationLevels; } - virtual void setQuantizationLevels(int nlevels) { quantizationLevels = nlevels; } + virtual int getQuantizationLevels() const CV_OVERRIDE { return quantizationLevels; } + virtual void setQuantizationLevels(int nlevels) CV_OVERRIDE { quantizationLevels = nlevels; } - virtual double getBackgroundPrior() const { return backgroundPrior; } - virtual void setBackgroundPrior(double bgprior) { backgroundPrior = bgprior; } + virtual double getBackgroundPrior() const CV_OVERRIDE { return backgroundPrior; } + virtual void setBackgroundPrior(double bgprior) CV_OVERRIDE { backgroundPrior = bgprior; } - virtual int getSmoothingRadius() const { return smoothingRadius; } - virtual void setSmoothingRadius(int radius) { smoothingRadius = radius; } + virtual int getSmoothingRadius() const CV_OVERRIDE { return smoothingRadius; } + virtual void setSmoothingRadius(int radius) CV_OVERRIDE { smoothingRadius = radius; } - virtual double getDecisionThreshold() const { return decisionThreshold; } - virtual void setDecisionThreshold(double thresh) { decisionThreshold = thresh; } + virtual double getDecisionThreshold() const CV_OVERRIDE { return decisionThreshold; } + virtual void setDecisionThreshold(double thresh) CV_OVERRIDE { decisionThreshold = thresh; } - virtual bool getUpdateBackgroundModel() const { return updateBackgroundModel; } - virtual void setUpdateBackgroundModel(bool update) { updateBackgroundModel = update; } + virtual bool getUpdateBackgroundModel() const CV_OVERRIDE { return updateBackgroundModel; } + virtual void setUpdateBackgroundModel(bool update) CV_OVERRIDE { updateBackgroundModel = update; } - virtual double getMinVal() const { return minVal_; } - virtual void setMinVal(double val) { minVal_ = val; } + virtual double getMinVal() const CV_OVERRIDE { return minVal_; } + virtual void setMinVal(double val) CV_OVERRIDE { minVal_ = val; } - virtual double getMaxVal() const { return maxVal_; } - virtual void setMaxVal(double val) { maxVal_ = val; } + virtual double getMaxVal() const CV_OVERRIDE { return maxVal_; } + 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(); } - virtual void write(FileStorage& fs) const + virtual void write(FileStorage& fs) const CV_OVERRIDE { fs << "name" << name_ << "maxFeatures" << maxFeatures @@ -152,7 +152,7 @@ public: // 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_ ); maxFeatures = (int)fn["maxFeatures"]; @@ -323,7 +323,7 @@ public: { } - void operator() (const Range& range) const; + void operator() (const Range& range) const CV_OVERRIDE; private: Mat frame_; diff --git a/modules/bgsegm/src/bgfg_gsoc.cpp b/modules/bgsegm/src/bgfg_gsoc.cpp index 8b5c76e66..f81eca9c8 100644 --- a/modules/bgsegm/src/bgfg_gsoc.cpp +++ b/modules/bgsegm/src/bgfg_gsoc.cpp @@ -364,7 +364,7 @@ private: public: 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 j = 1; j < sz.width - 1; ++j) { localSVDValues.at(i, j) = localSVD( @@ -387,7 +387,7 @@ private: public: 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) { const int i = index / sz.width, j = index % sz.width; int& descVal = desc.at(i, j); @@ -455,7 +455,7 @@ void BackgroundSubtractorLSBPDesc::compute(OutputArray desc, const Mat& frame, c computeFromLocalSVDValues(desc, localSVDValues, LSBPSamplePoints); } -class BackgroundSubtractorGSOCImpl : public BackgroundSubtractorGSOC { +class BackgroundSubtractorGSOCImpl CV_FINAL : public BackgroundSubtractorGSOC { private: Ptr backgroundModel; Ptr backgroundModelPrev; @@ -492,14 +492,14 @@ public: float noiseRemovalThresholdFacBG, 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; }; -class BackgroundSubtractorLSBPImpl : public BackgroundSubtractorLSBP { +class BackgroundSubtractorLSBPImpl CV_FINAL : public BackgroundSubtractorLSBP { private: Ptr backgroundModel; Ptr backgroundModelPrev; @@ -540,9 +540,9 @@ public: 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; }; @@ -561,7 +561,7 @@ public: ParallelGSOC(const Size& _sz, BackgroundSubtractorGSOCImpl* _bgs, const Mat& _frame, double _learningRate, Mat& _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(); Mat& distMovingAvg = bgs->distMovingAvg; @@ -621,7 +621,7 @@ public: 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) {}; - void operator()(const Range &range) const { + void operator()(const Range &range) const CV_OVERRIDE { BackgroundModelLSBP* backgroundModel = bgs->backgroundModel.get(); Mat& T = bgs->T; Mat& R = bgs->R; diff --git a/modules/bgsegm/src/bgfg_subcnt.cpp b/modules/bgsegm/src/bgfg_subcnt.cpp index 1e2a1a3f6..1638de50e 100644 --- a/modules/bgsegm/src/bgfg_subcnt.cpp +++ b/modules/bgsegm/src/bgfg_subcnt.cpp @@ -50,7 +50,7 @@ namespace cv namespace bgsegm { -class BackgroundSubtractorCNTImpl: public BackgroundSubtractorCNT +class BackgroundSubtractorCNTImpl CV_FINAL : public BackgroundSubtractorCNT { public: @@ -60,20 +60,20 @@ public: bool isParallel); // BackgroundSubtractor interface - virtual void apply(InputArray image, OutputArray fgmask, double learningRate); - virtual void getBackgroundImage(OutputArray backgroundImage) const; + virtual void apply(InputArray image, OutputArray fgmask, double learningRate) CV_OVERRIDE; + virtual void getBackgroundImage(OutputArray backgroundImage) const CV_OVERRIDE; - int getMinPixelStability() const; - void setMinPixelStability(int value); + int getMinPixelStability() const CV_OVERRIDE; + void setMinPixelStability(int value) CV_OVERRIDE; - int getMaxPixelStability() const; - void setMaxPixelStability(int value); + int getMaxPixelStability() const CV_OVERRIDE; + void setMaxPixelStability(int value) CV_OVERRIDE; - bool getUseHistory() const; - void setUseHistory(bool value); + bool getUseHistory() const CV_OVERRIDE; + void setUseHistory(bool value) CV_OVERRIDE; - bool getIsParallel() const; - void setIsParallel(bool value); + bool getIsParallel() const CV_OVERRIDE; + void setIsParallel(bool value) CV_OVERRIDE; //! the destructor virtual ~BackgroundSubtractorCNTImpl() {} @@ -185,7 +185,7 @@ struct BGSubtractPixel : public CNTFunctor //! the destructor 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 &bgImgRef = vec[3]; @@ -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 &historyColorRef = vec[1]; @@ -316,7 +316,7 @@ public: } // 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) {