OpenCV库成员——背景/前景分割类

一、相关类

1、背景/前景分割的基类

backgroundSubtractor

2、基于K近邻的背景/前景分割算法

BackgroundSubtractorKNN

3、基于高斯混合的背景/前景分割算法

BackgroundSubtractorMOG2


二、函数

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。

发布了182 篇原创文章 · 获赞 81 · 访问量 7万+

猜你喜欢

转载自blog.csdn.net/qq_41498261/article/details/103657156