一、相关类
1、背景/前景分割的基类
2、基于K近邻的背景/前景分割算法
3、基于高斯混合的背景/前景分割算法
二、函数
1、创建KNN背景减法器
Ptr<BackgroundSubtractorKNN> cv::createBackgroundSubtractorKNN (
int history=500,
double dist2Threshold=400.0,
bool detectShadows=true
)
Python:
retval=cv.createBackgroundSubtractorKNN([, history[, dist2Threshold[, detectShadows]]] )
history:
影响背景模型的帧数目。
dist2Threshold:
像素与样本之间的平方距离的阈值,以确定像素是否接近该样本。此参数不影响后台更新。
detectShadows:
如果为true,则算法将检测阴影并对其进行标记。它会稍微降低速度,因此,如果不需要此功能,请将参数设置为false。
2、创建MOG2背景减法器
Ptr<BackgroundSubtractorMOG2> cv::createBackgroundSubtractorMOG2 (
int history = 500,
double varThreshold = 16,
bool detectShadows = true
)
Python:
retval=cv.createBackgroundSubtractorMOG2( [, history[, varThreshold[, detectShadows]]] )
history:
影响背景模型的帧数目。
varThreshold:
像素与模型之间的Mahalanobis距离平方的阈值,以确定背景模型是否很好地描述了像素。此参数不影响后台更新。
detectShadows:
如果为true,则算法将检测阴影并对其进行标记。它会稍微降低速度,因此,如果不需要此功能,请将参数设置为false。