https://www.w3cschool.cn/opencv/opencv-2v342ebv.html
高斯混合模型
https://zhuanlan.zhihu.com/p/28108751
CV :: BackgroundSubtractorMOG2
virtual void cv::BackgroundSubtractorMOG2::apply (InputArray image,
OutputArray fgmask, double learningRate = -1 )
# Python:
fgmask = cv.BackgroundSubtractorMOG2.apply( image[, fgmask[, learningRate]] )
参数介绍:
Parameters
image Next video frame. Floating point frame will be used without scaling and should be in range [0,255]. fgmask The output foreground mask as an 8-bit binary image. 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.
learningRate : 0到1之间的值表示学习背景模型的速度。 负参数值使算法使用一些自动选择的学习速率。 0表示完全不更新背景模型,1表示从最后一帧完全重新初始化背景模型。
是否检测阴影
历史记录的长度
在像素和模型之间的平方马氏距离上确定背景模型是否能很好地描述像素。
此参数不影响背景更新。
def createBackgroundSubtractorMOG2(history=None, varThreshold=None, detectShadows=None): # real signature unknown; restored from __doc__
"""
createBackgroundSubtractorMOG2([, history[, varThreshold[, detectShadows]]]) -> retval
. @brief Creates MOG2 Background Subtractor
.
. @param history Length of the history.
. @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.
. @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.
"""
pass