background_segmentation.rst 5.2 KB
Newer Older
1 2 3 4 5 6 7
Background Segmentation
=======================

.. highlight:: cpp



V
Vladislav Vinogradov 已提交
8 9 10
gpu::BackgroundSubtractorMOG
----------------------------
Gaussian Mixture-based Background/Foreground Segmentation Algorithm.
11

V
Vladislav Vinogradov 已提交
12
.. ocv:class:: gpu::BackgroundSubtractorMOG : public cv::BackgroundSubtractorMOG
13 14 15 16 17 18 19

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 [MOG2001]_.

.. seealso:: :ocv:class:`BackgroundSubtractorMOG`



V
Vladislav Vinogradov 已提交
20 21 22
gpu::createBackgroundSubtractorMOG
----------------------------------
Creates mixture-of-gaussian background subtractor
23

V
Vladislav Vinogradov 已提交
24
.. ocv:function:: Ptr<gpu::BackgroundSubtractorMOG> gpu::createBackgroundSubtractorMOG(int history=200, int nmixtures=5, double backgroundRatio=0.7, double noiseSigma=0)
25

V
Vladislav Vinogradov 已提交
26
    :param history: Length of the history.
27

V
Vladislav Vinogradov 已提交
28
    :param nmixtures: Number of Gaussian mixtures.
29

V
Vladislav Vinogradov 已提交
30
    :param backgroundRatio: Background ratio.
31

V
Vladislav Vinogradov 已提交
32
    :param noiseSigma: Noise strength (standard deviation of the brightness or each color channel). 0 means some automatic value.
33 34 35



V
Vladislav Vinogradov 已提交
36 37 38
gpu::BackgroundSubtractorMOG2
-----------------------------
Gaussian Mixture-based Background/Foreground Segmentation Algorithm.
39

V
Vladislav Vinogradov 已提交
40
.. ocv:class:: gpu::BackgroundSubtractorMOG2 : public cv::BackgroundSubtractorMOG2
41

V
Vladislav Vinogradov 已提交
42
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 [MOG2004]_.
43 44 45 46 47

.. seealso:: :ocv:class:`BackgroundSubtractorMOG2`



V
Vladislav Vinogradov 已提交
48 49 50
gpu::createBackgroundSubtractorMOG2
-----------------------------------
Creates MOG2 Background Subtractor
51

V
Vladislav Vinogradov 已提交
52
.. ocv:function:: Ptr<gpu::BackgroundSubtractorMOG2> gpu::createBackgroundSubtractorMOG2( int history=500, double varThreshold=16, bool detectShadows=true )
53

V
Vladislav Vinogradov 已提交
54
  :param history: Length of the history.
55

V
Vladislav Vinogradov 已提交
56
  :param varThreshold: Threshold on the squared Mahalanobis distance between the pixel and the model to decide whether a pixel is well described by the background model. This parameter does not affect the background update.
57

V
Vladislav Vinogradov 已提交
58
  :param detectShadows: If true, the algorithm will detect shadows and mark them. It decreases the speed a bit, so if you do not need this feature, set the parameter to false.
59 60 61



V
Vladislav Vinogradov 已提交
62 63 64
gpu::BackgroundSubtractorGMG
----------------------------
Background/Foreground Segmentation Algorithm.
65

V
Vladislav Vinogradov 已提交
66
.. ocv:class:: gpu::BackgroundSubtractorGMG : public cv::BackgroundSubtractorGMG
67

V
Vladislav Vinogradov 已提交
68
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 [GMG2012]_.
69 70 71



V
Vladislav Vinogradov 已提交
72 73 74
gpu::createBackgroundSubtractorGMG
----------------------------------
Creates GMG Background Subtractor
75

V
Vladislav Vinogradov 已提交
76
.. ocv:function:: Ptr<gpu::BackgroundSubtractorGMG> gpu::createBackgroundSubtractorGMG(int initializationFrames = 120, double decisionThreshold = 0.8)
77

V
Vladislav Vinogradov 已提交
78
    :param initializationFrames: Number of frames of video to use to initialize histograms.
79

V
Vladislav Vinogradov 已提交
80
    :param decisionThreshold: Value above which pixel is determined to be FG.
81 82 83



V
Vladislav Vinogradov 已提交
84 85
gpu::BackgroundSubtractorFGD
----------------------------
86

V
Vladislav Vinogradov 已提交
87
.. ocv:class:: gpu::BackgroundSubtractorFGD : public cv::BackgroundSubtractor
88

V
Vladislav Vinogradov 已提交
89
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 [FGD2003]_. ::
90

V
Vladislav Vinogradov 已提交
91
    class CV_EXPORTS BackgroundSubtractorFGD : public cv::BackgroundSubtractor
92 93
    {
    public:
V
Vladislav Vinogradov 已提交
94
        virtual void getForegroundRegions(OutputArrayOfArrays foreground_regions) = 0;
95 96
    };

V
Vladislav Vinogradov 已提交
97
.. seealso:: :ocv:class:`BackgroundSubtractor`
98 99 100



V
Vladislav Vinogradov 已提交
101 102 103
gpu::BackgroundSubtractorFGD::getForegroundRegions
--------------------------------------------------
Returns the output foreground regions calculated by :ocv:func:`findContours`.
104

V
Vladislav Vinogradov 已提交
105
.. ocv:function:: void gpu::BackgroundSubtractorFGD::getForegroundRegions(OutputArrayOfArrays foreground_regions)
106

V
Vladislav Vinogradov 已提交
107
    :params foreground_regions: Output array (CPU memory).
108 109 110



V
Vladislav Vinogradov 已提交
111 112 113
gpu::createBackgroundSubtractorFGD
----------------------------------
Creates FGD Background Subtractor
114

V
Vladislav Vinogradov 已提交
115
.. ocv:function:: Ptr<gpu::BackgroundSubtractorGMG> gpu::createBackgroundSubtractorFGD(const FGDParams& params = FGDParams())
116

V
Vladislav Vinogradov 已提交
117
    :param params: Algorithm's parameters. See [FGD2003]_ for explanation.
118 119 120 121 122 123 124



.. [FGD2003] Liyuan Li, Weimin Huang, Irene Y.H. Gu, and Qi Tian. *Foreground Object Detection from Videos Containing Complex Background*. ACM MM2003 9p, 2003.
.. [MOG2001] 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
.. [MOG2004] Z. Zivkovic. *Improved adaptive Gausian mixture model for background subtraction*. International Conference Pattern Recognition, UK, August, 2004
.. [GMG2012] A. Godbehere, A. Matsukawa and K. Goldberg. *Visual Tracking of Human Visitors under Variable-Lighting Conditions for a Responsive Audio Art Installation*. American Control Conference, Montreal, June 2012