From 40dd25d6c2bbdbf662e91a16ddc0464f1c6a109e Mon Sep 17 00:00:00 2001 From: Vadim Pisarevsky Date: Fri, 22 Mar 2013 01:29:33 +0400 Subject: [PATCH] restored CV_EXPORTS_W in the background subtraction classes --- modules/python/src2/cv2.cpp | 3 + .../include/opencv2/video/background_segm.hpp | 122 ++++++++++----------- 2 files changed, 64 insertions(+), 61 deletions(-) diff --git a/modules/python/src2/cv2.cpp b/modules/python/src2/cv2.cpp index 8f4e3ee..ff4cc71 100644 --- a/modules/python/src2/cv2.cpp +++ b/modules/python/src2/cv2.cpp @@ -126,6 +126,9 @@ typedef Ptr Ptr_DescriptorExtractor; typedef Ptr Ptr_Feature2D; typedef Ptr Ptr_DescriptorMatcher; typedef Ptr Ptr_BackgroundSubtractor; +typedef Ptr Ptr_BackgroundSubtractorMOG; +typedef Ptr Ptr_BackgroundSubtractorMOG2; +typedef Ptr Ptr_BackgroundSubtractorGMG; typedef Ptr Ptr_ChannelFeatureBuilder; diff --git a/modules/video/include/opencv2/video/background_segm.hpp b/modules/video/include/opencv2/video/background_segm.hpp index c963f72..d43157b 100644 --- a/modules/video/include/opencv2/video/background_segm.hpp +++ b/modules/video/include/opencv2/video/background_segm.hpp @@ -55,14 +55,14 @@ namespace cv The class is only used to define the common interface for the whole family of background/foreground segmentation algorithms. */ -class BackgroundSubtractor : public Algorithm +class CV_EXPORTS_W BackgroundSubtractor : public Algorithm { public: //! the update operator that takes the next video frame and returns the current foreground mask as 8-bit binary image. - virtual void apply(InputArray image, OutputArray fgmask, double learningRate=-1) = 0; + CV_WRAP virtual void apply(InputArray image, OutputArray fgmask, double learningRate=-1) = 0; //! computes a background image - virtual void getBackgroundImage(OutputArray backgroundImage) const = 0; + CV_WRAP virtual void getBackgroundImage(OutputArray backgroundImage) const = 0; }; @@ -76,23 +76,23 @@ public: http://personal.ee.surrey.ac.uk/Personal/R.Bowden/publications/avbs01/avbs01.pdf */ -class BackgroundSubtractorMOG : public BackgroundSubtractor +class CV_EXPORTS_W BackgroundSubtractorMOG : public BackgroundSubtractor { public: - virtual int getHistory() const = 0; - virtual void setHistory(int nframes) = 0; + CV_WRAP virtual int getHistory() const = 0; + CV_WRAP virtual void setHistory(int nframes) = 0; - virtual int getNMixtures() const = 0; - virtual void setNMixtures(int nmix) = 0; + CV_WRAP virtual int getNMixtures() const = 0; + CV_WRAP virtual void setNMixtures(int nmix) = 0; - virtual double getBackgroundRatio() const = 0; - virtual void setBackgroundRatio(double backgroundRatio) = 0; + CV_WRAP virtual double getBackgroundRatio() const = 0; + CV_WRAP virtual void setBackgroundRatio(double backgroundRatio) = 0; - virtual double getNoiseSigma() const = 0; - virtual void setNoiseSigma(double noiseSigma) = 0; + CV_WRAP virtual double getNoiseSigma() const = 0; + CV_WRAP virtual void setNoiseSigma(double noiseSigma) = 0; }; -CV_EXPORTS Ptr +CV_EXPORTS_W Ptr createBackgroundSubtractorMOG(int history=200, int nmixtures=5, double backgroundRatio=0.7, double noiseSigma=0); @@ -104,47 +104,47 @@ CV_EXPORTS Ptr International Conference Pattern Recognition, UK, August, 2004. http://www.zoranz.net/Publications/zivkovic2004ICPR.pdf */ -class BackgroundSubtractorMOG2 : public BackgroundSubtractor +class CV_EXPORTS_W BackgroundSubtractorMOG2 : public BackgroundSubtractor { public: - virtual int getHistory() const = 0; - virtual void setHistory(int history) = 0; + CV_WRAP virtual int getHistory() const = 0; + CV_WRAP virtual void setHistory(int history) = 0; - virtual int getNMixtures() const = 0; - virtual void setNMixtures(int nmixtures) = 0; + CV_WRAP virtual int getNMixtures() const = 0; + CV_WRAP virtual void setNMixtures(int nmixtures) = 0; - virtual double getBackgroundRatio() const = 0; - virtual void setBackgroundRatio(double ratio) = 0; + CV_WRAP virtual double getBackgroundRatio() const = 0; + CV_WRAP virtual void setBackgroundRatio(double ratio) = 0; - virtual double getVarThreshold() const = 0; - virtual void setVarThreshold(double varThreshold) = 0; + CV_WRAP virtual double getVarThreshold() const = 0; + CV_WRAP virtual void setVarThreshold(double varThreshold) = 0; - virtual double getVarThresholdGen() const = 0; - virtual void setVarThresholdGen(double varThresholdGen) = 0; + CV_WRAP virtual double getVarThresholdGen() const = 0; + CV_WRAP virtual void setVarThresholdGen(double varThresholdGen) = 0; - virtual double getVarInit() const = 0; - virtual void setVarInit(double varInit) = 0; + CV_WRAP virtual double getVarInit() const = 0; + CV_WRAP virtual void setVarInit(double varInit) = 0; - virtual double getVarMin() const = 0; - virtual void setVarMin(double varMin) = 0; + CV_WRAP virtual double getVarMin() const = 0; + CV_WRAP virtual void setVarMin(double varMin) = 0; - virtual double getVarMax() const = 0; - virtual void setVarMax(double varMax) = 0; + CV_WRAP virtual double getVarMax() const = 0; + CV_WRAP virtual void setVarMax(double varMax) = 0; - virtual double getComplexityReductionThreshold() const = 0; - virtual void setComplexityReductionThreshold(double ct) = 0; + CV_WRAP virtual double getComplexityReductionThreshold() const = 0; + CV_WRAP virtual void setComplexityReductionThreshold(double ct) = 0; - virtual bool getDetectShadows() const = 0; - virtual void setDetectShadows(bool detectShadows) = 0; + CV_WRAP virtual bool getDetectShadows() const = 0; + CV_WRAP virtual void setDetectShadows(bool detectShadows) = 0; - virtual int getShadowValue() const = 0; - virtual void setShadowValue(int value) = 0; + CV_WRAP virtual int getShadowValue() const = 0; + CV_WRAP virtual void setShadowValue(int value) = 0; - virtual double getShadowThreshold() const = 0; - virtual void setShadowThreshold(double threshold) = 0; + CV_WRAP virtual double getShadowThreshold() const = 0; + CV_WRAP virtual void setShadowThreshold(double threshold) = 0; }; -CV_EXPORTS Ptr +CV_EXPORTS_W Ptr createBackgroundSubtractorMOG2(int history=500, double varThreshold=16, bool detectShadows=true); @@ -155,42 +155,42 @@ CV_EXPORTS Ptr * Variable-Lighting Conditions for a Responsive Audio Art Installation," A. Godbehere, * A. Matsukawa, K. Goldberg, American Control Conference, Montreal, June 2012. */ -class BackgroundSubtractorGMG : public BackgroundSubtractor +class CV_EXPORTS_W BackgroundSubtractorGMG : public BackgroundSubtractor { public: - virtual int getMaxFeatures() const = 0; - virtual void setMaxFeatures(int maxFeatures) = 0; + CV_WRAP virtual int getMaxFeatures() const = 0; + CV_WRAP virtual void setMaxFeatures(int maxFeatures) = 0; - virtual double getDefaultLearningRate() const = 0; - virtual void setDefaultLearningRate(double lr) = 0; + CV_WRAP virtual double getDefaultLearningRate() const = 0; + CV_WRAP virtual void setDefaultLearningRate(double lr) = 0; - virtual int getNumFrames() const = 0; - virtual void setNumFrames(int nframes) = 0; + CV_WRAP virtual int getNumFrames() const = 0; + CV_WRAP virtual void setNumFrames(int nframes) = 0; - virtual int getQuantizationLevels() const = 0; - virtual void setQuantizationLevels(int nlevels) = 0; + CV_WRAP virtual int getQuantizationLevels() const = 0; + CV_WRAP virtual void setQuantizationLevels(int nlevels) = 0; - virtual double getBackgroundPrior() const = 0; - virtual void setBackgroundPrior(double bgprior) = 0; + CV_WRAP virtual double getBackgroundPrior() const = 0; + CV_WRAP virtual void setBackgroundPrior(double bgprior) = 0; - virtual int getSmoothingRadius() const = 0; - virtual void setSmoothingRadius(int radius) = 0; + CV_WRAP virtual int getSmoothingRadius() const = 0; + CV_WRAP virtual void setSmoothingRadius(int radius) = 0; - virtual double getDecisionThreshold() const = 0; - virtual void setDecisionThreshold(double thresh) = 0; + CV_WRAP virtual double getDecisionThreshold() const = 0; + CV_WRAP virtual void setDecisionThreshold(double thresh) = 0; - virtual bool getUpdateBackgroundModel() const = 0; - virtual void setUpdateBackgroundModel(bool update) = 0; + CV_WRAP virtual bool getUpdateBackgroundModel() const = 0; + CV_WRAP virtual void setUpdateBackgroundModel(bool update) = 0; - virtual double getMinVal() const = 0; - virtual void setMinVal(double val) = 0; + CV_WRAP virtual double getMinVal() const = 0; + CV_WRAP virtual void setMinVal(double val) = 0; - virtual double getMaxVal() const = 0; - virtual void setMaxVal(double val) = 0; + CV_WRAP virtual double getMaxVal() const = 0; + CV_WRAP virtual void setMaxVal(double val) = 0; }; -CV_EXPORTS Ptr createBackgroundSubtractorGMG(int initializationFrames=120, +CV_EXPORTS_W Ptr createBackgroundSubtractorGMG(int initializationFrames=120, double decisionThreshold=0.8); } -- 2.7.4