added docs for MOG_GPU and MOG2_GPU
authorVladislav Vinogradov <no@email>
Mon, 25 Jun 2012 13:19:55 +0000 (13:19 +0000)
committerVladislav Vinogradov <no@email>
Mon, 25 Jun 2012 13:19:55 +0000 (13:19 +0000)
modules/gpu/doc/video.rst

index 882e8d0..02c3ce2 100644 (file)
@@ -389,6 +389,176 @@ Updates the background model and returns foreground regions count.
 \r
 \r
 \r
+gpu::MOG_GPU\r
+------------\r
+.. ocv:class:: gpu::MOG_GPU\r
+\r
+Gaussian Mixture-based Backbround/Foreground Segmentation Algorithm. ::\r
+\r
+    class MOG_GPU\r
+    {\r
+    public:\r
+        MOG_GPU(int nmixtures = -1);\r
+\r
+        void initialize(Size frameSize, int frameType);\r
+\r
+        void operator()(const GpuMat& frame, GpuMat& fgmask, float learningRate = 0.0f, Stream& stream = Stream::Null());\r
+\r
+        void getBackgroundImage(GpuMat& backgroundImage, Stream& stream = Stream::Null()) const;\r
+\r
+        int history;\r
+        float varThreshold;\r
+        float backgroundRatio;\r
+        float noiseSigma;\r
+    };\r
+\r
+  The class discriminates between foreground and background pixels by building and maintaining a model of the background. Any pixel which does not fit this model is then deemed to be foreground. The class implements algorithm described in [MOG]_.\r
+\r
+.. seealso:: :ocv:class:`BackgroundSubtractorMOG`\r
+\r
+\r
+\r
+gpu::MOG_GPU::MOG_GPU\r
+---------------------\r
+The constructor.\r
+\r
+.. ocv:function:: gpu::MOG_GPU::MOG_GPU(int nmixtures = -1)\r
+\r
+    :param nmixtures: Number of Gaussian mixtures.\r
+\r
+Default constructor sets all parameters to default values.\r
+\r
+\r
+\r
+gpu::MOG_GPU::operator()\r
+------------------------\r
+Updates the background model and returns the foreground mask\r
+\r
+.. ocv:function:: void gpu::MOG_GPU::operator()(const GpuMat& frame, GpuMat& fgmask, float learningRate = 0.0f, Stream& stream = Stream::Null())\r
+\r
+    :param frame: Next video frame.\r
+\r
+    :param fgmask: The output foreground mask as an 8-bit binary image.\r
+\r
+    :param stream: Stream for the asynchronous version.\r
+\r
+\r
+\r
+gpu::MOG_GPU::getBackgroundImage\r
+--------------------------------\r
+Computes a background image.\r
+\r
+.. ocv:function:: void gpu::MOG_GPU::getBackgroundImage(GpuMat& backgroundImage, Stream& stream = Stream::Null()) const\r
+\r
+    :param backgroundImage: The output background image.\r
+\r
+    :param stream: Stream for the asynchronous version.\r
+\r
+\r
+\r
+gpu::MOG2_GPU\r
+-------------\r
+.. ocv:class:: gpu::MOG2_GPU\r
+\r
+Gaussian Mixture-based Background/Foreground Segmentation Algorithm. ::\r
+\r
+    class MOG2_GPU\r
+    {\r
+    public:\r
+        MOG2_GPU(int nmixtures = -1);\r
+\r
+        void initialize(Size frameSize, int frameType);\r
+\r
+        void operator()(const GpuMat& frame, GpuMat& fgmask, float learningRate = 0.0f, Stream& stream = Stream::Null());\r
+\r
+        void getBackgroundImage(GpuMat& backgroundImage, Stream& stream = Stream::Null()) const;\r
+\r
+        // parameters\r
+        ...\r
+    };\r
+\r
+  The class discriminates between foreground and background pixels by building and maintaining a model of the background. Any pixel which does not fit this model is then deemed to be foreground. The class implements algorithm described in [MOG2]_.\r
+\r
+  Here are important members of the class that control the algorithm, which you can set after constructing the class instance:\r
+\r
+    .. ocv:member:: float backgroundRatio\r
+\r
+        Threshold defining whether the component is significant enough to be included into the background model ( corresponds to ``TB=1-cf`` from the paper??which paper??). ``cf=0.1 => TB=0.9`` is default. For ``alpha=0.001``, it means that the mode should exist for approximately 105 frames before it is considered foreground.\r
+\r
+    .. ocv:member:: float varThreshold\r
+\r
+        Threshold for the squared Mahalanobis distance that helps decide when a sample is close to the existing components (corresponds to ``Tg``). If it is not close to any component, a new component is generated. ``3 sigma => Tg=3*3=9`` is default. A smaller ``Tg`` value generates more components. A higher ``Tg`` value may result in a small number of components but they can grow too large.\r
+\r
+    .. ocv:member:: float fVarInit\r
+\r
+        Initial variance for the newly generated components. It affects the speed of adaptation. The parameter value is based on your estimate of the typical standard deviation from the images. OpenCV uses 15 as a reasonable value.\r
+\r
+    .. ocv:member:: float fVarMin\r
+\r
+        Parameter used to further control the variance.\r
+\r
+    .. ocv:member:: float fVarMax\r
+\r
+        Parameter used to further control the variance.\r
+\r
+    .. ocv:member:: float fCT\r
+\r
+        Complexity reduction parameter. This parameter defines the number of samples needed to accept to prove the component exists. ``CT=0.05`` is a default value for all the samples. By setting ``CT=0`` you get an algorithm very similar to the standard Stauffer&Grimson algorithm.\r
+\r
+    .. ocv:member:: uchar nShadowDetection\r
+\r
+        The value for marking shadow pixels in the output foreground mask. Default value is 127.\r
+\r
+    .. ocv:member:: float fTau\r
+\r
+        Shadow threshold. The shadow is detected if the pixel is a darker version of the background. ``Tau`` 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 [ShadowDetect]_.\r
+\r
+    .. ocv:member:: bool bShadowDetection\r
+\r
+        Parameter defining whether shadow detection should be enabled.\r
+\r
+.. seealso:: :ocv:class:`BackgroundSubtractorMOG2`\r
+\r
+\r
+\r
+gpu::MOG2_GPU::MOG2_GPU\r
+-----------------------\r
+The constructor.\r
+\r
+.. ocv:function:: gpu::MOG2_GPU::MOG2_GPU(int nmixtures = -1)\r
+\r
+    :param nmixtures: Number of Gaussian mixtures.\r
+\r
+Default constructor sets all parameters to default values.\r
+\r
+\r
+\r
+gpu::MOG2_GPU::operator()\r
+------------------------\r
+Updates the background model and returns the foreground mask\r
+\r
+.. ocv:function:: void gpu::MOG2_GPU::operator()(const GpuMat& frame, GpuMat& fgmask, float learningRate = 0.0f, Stream& stream = Stream::Null())\r
+\r
+    :param frame: Next video frame.\r
+\r
+    :param fgmask: The output foreground mask as an 8-bit binary image.\r
+\r
+    :param stream: Stream for the asynchronous version.\r
+\r
+\r
+\r
+gpu::MOG2_GPU::getBackgroundImage\r
+---------------------------------\r
+Computes a background image.\r
+\r
+.. ocv:function:: void gpu::MOG2_GPU::getBackgroundImage(GpuMat& backgroundImage, Stream& stream = Stream::Null()) const\r
+\r
+    :param backgroundImage: The output background image.\r
+\r
+    :param stream: Stream for the asynchronous version.\r
+\r
+\r
+\r
 gpu::VideoWriter_GPU\r
 ---------------------\r
 Video writer class.\r
@@ -610,6 +780,8 @@ Class for reading video from files.
 \r
 .. ocv:class:: gpu::VideoReader_GPU\r
 \r
+.. note:: Currently only Windows and Linux platforms are supported.\r
+\r
 \r
 \r
 gpu::VideoReader_GPU::Codec\r
@@ -827,3 +999,6 @@ Parse next video frame. Implementation must call this method after new frame was
 \r
 .. [Brox2004] T. Brox, A. Bruhn, N. Papenberg, J. Weickert. *High accuracy optical flow estimation based on a theory for warping*. ECCV 2004.\r
 .. [FGD2003] Liyuan Li, Weimin Huang, Irene Y.H. Gu, and Qi Tian. *Foreground Object Detection from Videos Containing Complex Background*. ACM MM2003 9p, 2003.\r
+.. [MOG] P. KadewTraKuPong and R. Bowden, *An improved adaptive background mixture model for real-time tracking with shadow detection*, Proc. 2nd European Workshop on Advanced Video-Based Surveillance Systems, 2001\r
+.. [MOG2] Z.Zivkovic, *Improved adaptive Gausian mixture model for background subtraction*, International Conference Pattern Recognition, UK, August, 2004\r
+.. [ShadowDetect] Prati, Mikic, Trivedi and Cucchiarra, *Detecting Moving Shadows...*, IEEE PAMI, 2003\r