1
/*M///////////////////////////////////////////////////////////////////////////////////////
3
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
5
// By downloading, copying, installing or using the software you agree to this license.
6
// If you do not agree to this license, do not download, install,
7
// copy or use the software.
11
// For Open Source Computer Vision Library
13
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
14
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
15
// Third party copyrights are property of their respective owners.
17
// Redistribution and use in source and binary forms, with or without modification,
18
// are permitted provided that the following conditions are met:
20
// * Redistribution's of source code must retain the above copyright notice,
21
// this list of conditions and the following disclaimer.
23
// * Redistribution's in binary form must reproduce the above copyright notice,
24
// this list of conditions and the following disclaimer in the documentation
25
// and/or other materials provided with the distribution.
27
// * The name of the copyright holders may not be used to endorse or promote products
28
// derived from this software without specific prior written permission.
30
// This software is provided by the copyright holders and contributors "as is" and
31
// any express or implied warranties, including, but not limited to, the implied
32
// warranties of merchantability and fitness for a particular purpose are disclaimed.
33
// In no event shall the Intel Corporation or contributors be liable for any direct,
34
// indirect, incidental, special, exemplary, or consequential damages
35
// (including, but not limited to, procurement of substitute goods or services;
36
// loss of use, data, or profits; or business interruption) however caused
37
// and on any theory of liability, whether in contract, strict liability,
38
// or tort (including negligence or otherwise) arising in any way out of
39
// the use of this software, even if advised of the possibility of such damage.
43
#ifndef __OPENCV_CUDABGSEGM_HPP__
44
#define __OPENCV_CUDABGSEGM_HPP__
47
# error cudabgsegm.hpp header must be compiled as C++
50
#include "opencv2/core/cuda.hpp"
51
#include "opencv2/video/background_segm.hpp"
56
@defgroup cudabgsegm Background Segmentation
60
namespace cv { namespace cuda {
62
//! @addtogroup cudabgsegm
65
////////////////////////////////////////////////////
68
/** @brief Gaussian Mixture-based Background/Foreground Segmentation Algorithm.
70
The class discriminates between foreground and background pixels by building and maintaining a model
71
of the background. Any pixel which does not fit this model is then deemed to be foreground. The
72
class implements algorithm described in @cite MOG2001 .
74
@sa BackgroundSubtractorMOG
77
- An example on gaussian mixture based background/foreground segmantation can be found at
78
opencv_source_code/samples/gpu/bgfg_segm.cpp
80
class CV_EXPORTS BackgroundSubtractorMOG : public cv::BackgroundSubtractor
84
using cv::BackgroundSubtractor::apply;
85
virtual void apply(InputArray image, OutputArray fgmask, double learningRate, Stream& stream) = 0;
87
using cv::BackgroundSubtractor::getBackgroundImage;
88
virtual void getBackgroundImage(OutputArray backgroundImage, Stream& stream) const = 0;
90
virtual int getHistory() const = 0;
91
virtual void setHistory(int nframes) = 0;
93
virtual int getNMixtures() const = 0;
94
virtual void setNMixtures(int nmix) = 0;
96
virtual double getBackgroundRatio() const = 0;
97
virtual void setBackgroundRatio(double backgroundRatio) = 0;
99
virtual double getNoiseSigma() const = 0;
100
virtual void setNoiseSigma(double noiseSigma) = 0;
103
/** @brief Creates mixture-of-gaussian background subtractor
105
@param history Length of the history.
106
@param nmixtures Number of Gaussian mixtures.
107
@param backgroundRatio Background ratio.
108
@param noiseSigma Noise strength (standard deviation of the brightness or each color channel). 0
109
means some automatic value.
111
CV_EXPORTS Ptr<cuda::BackgroundSubtractorMOG>
112
createBackgroundSubtractorMOG(int history = 200, int nmixtures = 5,
113
double backgroundRatio = 0.7, double noiseSigma = 0);
115
////////////////////////////////////////////////////
118
/** @brief Gaussian Mixture-based Background/Foreground Segmentation Algorithm.
120
The class discriminates between foreground and background pixels by building and maintaining a model
121
of the background. Any pixel which does not fit this model is then deemed to be foreground. The
122
class implements algorithm described in @cite Zivkovic2004 .
124
@sa BackgroundSubtractorMOG2
126
class CV_EXPORTS BackgroundSubtractorMOG2 : public cv::BackgroundSubtractorMOG2
129
using cv::BackgroundSubtractorMOG2::apply;
130
using cv::BackgroundSubtractorMOG2::getBackgroundImage;
132
virtual void apply(InputArray image, OutputArray fgmask, double learningRate, Stream& stream) = 0;
134
virtual void getBackgroundImage(OutputArray backgroundImage, Stream& stream) const = 0;
137
/** @brief Creates MOG2 Background Subtractor
139
@param history Length of the history.
140
@param varThreshold Threshold on the squared Mahalanobis distance between the pixel and the model
141
to decide whether a pixel is well described by the background model. This parameter does not
142
affect the background update.
143
@param detectShadows If true, the algorithm will detect shadows and mark them. It decreases the
144
speed a bit, so if you do not need this feature, set the parameter to false.
146
CV_EXPORTS Ptr<cuda::BackgroundSubtractorMOG2>
147
createBackgroundSubtractorMOG2(int history = 500, double varThreshold = 16,
148
bool detectShadows = true);
152
}} // namespace cv { namespace cuda {
154
#endif /* __OPENCV_CUDABGSEGM_HPP__ */