diff --git a/modules/video/doc/motion_analysis_and_object_tracking.rst b/modules/video/doc/motion_analysis_and_object_tracking.rst index 873a4834cb..ef82e33d30 100644 --- a/modules/video/doc/motion_analysis_and_object_tracking.rst +++ b/modules/video/doc/motion_analysis_and_object_tracking.rst @@ -166,13 +166,13 @@ Finds the geometric transform (warp) between two images in terms of the ECC crit :param warpMatrix: floating-point :math:`2\times 3` or :math:`3\times 3` mapping matrix (warp). :param motionType: parameter, specifying the type of motion: - + * **MOTION_TRANSLATION** sets a translational motion model; ``warpMatrix`` is :math:`2\times 3` with the first :math:`2\times 2` part being the unity matrix and the rest two parameters being estimated. - + * **MOTION_EUCLIDEAN** sets a Euclidean (rigid) transformation as motion model; three parameters are estimated; ``warpMatrix`` is :math:`2\times 3`. - + * **MOTION_AFFINE** sets an affine motion model (DEFAULT); six parameters are estimated; ``warpMatrix`` is :math:`2\times 3`. - + * **MOTION_HOMOGRAPHY** sets a homography as a motion model; eight parameters are estimated;``warpMatrix`` is :math:`3\times 3`. :param criteria: parameter, specifying the termination criteria of the ECC algorithm; ``criteria.epsilon`` defines the threshold of the increment in the correlation coefficient between two iterations (a negative ``criteria.epsilon`` makes ``criteria.maxcount`` the only termination criterion). Default values are shown in the declaration above. @@ -501,7 +501,7 @@ Computes a foreground mask. :param image: Next video frame. :param fgmask: The output foreground mask as an 8-bit binary image. - + :param learningRate: The value between 0 and 1 that indicates how fast the background model is learnt. Negative parameter value makes the algorithm to use some automatically chosen learning rate. 0 means that the background model is not updated at all, 1 means that the background model is completely reinitialized from the last frame. BackgroundSubtractor::getBackgroundImage @@ -673,21 +673,21 @@ BackgroundSubtractorMOG2::setShadowValue --------------------------------------------- Sets the shadow value -.. ocv:function:: void BackgroundSubtractorMOG2::setShadowValue(int shadowValue) +.. ocv:function:: void BackgroundSubtractorMOG2::setShadowValue(int value) BackgroundSubtractorMOG2::getShadowThreshold --------------------------------------------- Returns the shadow threshold -.. ocv:function:: int BackgroundSubtractorMOG2::getShadowThreshold() const +.. ocv:function:: double BackgroundSubtractorMOG2::getShadowThreshold() const -A shadow is detected if the pixel is a darker version of the background. The shadow threshold (``Tau`` in the paper) is a threshold defining how much darker the shadow can be. ``Tau= 0.5`` means that if a pixel is more than twice darker then it is not shadow. See Prati, Mikic, Trivedi and Cucchiarra, *Detecting Moving Shadows...*, IEEE PAMI,2003. +A shadow is detected if pixel is a darker version of the background. The shadow threshold (``Tau`` in the paper) is a threshold defining how much darker the shadow can be. ``Tau= 0.5`` means that if a pixel is more than twice darker then it is not shadow. See Prati, Mikic, Trivedi and Cucchiarra, *Detecting Moving Shadows...*, IEEE PAMI,2003. BackgroundSubtractorMOG2::setShadowThreshold --------------------------------------------- Sets the shadow threshold -.. ocv:function:: void BackgroundSubtractorMOG2::setShadowThreshold(int shadowValue) +.. ocv:function:: void BackgroundSubtractorMOG2::setShadowThreshold(double threshold) calcOpticalFlowSF diff --git a/modules/video/include/opencv2/video/background_segm.hpp b/modules/video/include/opencv2/video/background_segm.hpp index 8d73ab5bcd..c963f72350 100644 --- a/modules/video/include/opencv2/video/background_segm.hpp +++ b/modules/video/include/opencv2/video/background_segm.hpp @@ -108,13 +108,13 @@ class BackgroundSubtractorMOG2 : public BackgroundSubtractor { public: virtual int getHistory() const = 0; - virtual void setHistory(int nframes) = 0; + virtual void setHistory(int history) = 0; virtual int getNMixtures() const = 0; - virtual void setNMixtures(int nmix) = 0; + virtual void setNMixtures(int nmixtures) = 0; virtual double getBackgroundRatio() const = 0; - virtual void setBackgroundRatio(double backgroundRatio) = 0; + virtual void setBackgroundRatio(double ratio) = 0; virtual double getVarThreshold() const = 0; virtual void setVarThreshold(double varThreshold) = 0; @@ -135,13 +135,13 @@ public: virtual void setComplexityReductionThreshold(double ct) = 0; virtual bool getDetectShadows() const = 0; - virtual void setDetectShadows(bool detectshadows) = 0; + virtual void setDetectShadows(bool detectShadows) = 0; virtual int getShadowValue() const = 0; virtual void setShadowValue(int value) = 0; virtual double getShadowThreshold() const = 0; - virtual void setShadowThreshold(double value) = 0; + virtual void setShadowThreshold(double threshold) = 0; }; CV_EXPORTS Ptr diff --git a/modules/video/src/bgfg_gaussmix2.cpp b/modules/video/src/bgfg_gaussmix2.cpp index 31b43fcf3b..379d4034cb 100644 --- a/modules/video/src/bgfg_gaussmix2.cpp +++ b/modules/video/src/bgfg_gaussmix2.cpp @@ -245,7 +245,7 @@ public: << "varMax" << fVarMax << "complexityReductionThreshold" << fCT << "detectShadows" << (int)bShadowDetection - << "shadowValue" << nShadowDetection + << "shadowValue" << (int)nShadowDetection << "shadowThreshold" << fTau; } @@ -262,7 +262,7 @@ public: fVarMax = (float)fn["varMax"]; fCT = (float)fn["complexityReductionThreshold"]; bShadowDetection = (int)fn["detectShadows"] != 0; - nShadowDetection = (int)fn["shadowValue"]; + nShadowDetection = saturate_cast((int)fn["shadowValue"]); fTau = (float)fn["shadowThreshold"]; }