基于高斯混合模型的背景/前景分割算法。更多...
#include <opencv2/video/background_segm.hpp>
基于高斯混合模型的背景/前景分割算法。
该类实现了 [327] 和 [326] 中描述的高斯混合模型背景减除算法。
◆ apply()
| virtual void cv::BackgroundSubtractorMOG2::apply |
( |
InputArray | image, |
|
|
OutputArray | fgmask, |
|
|
double | learningRate = -1 ) |
|
纯虚函数 |
| Python |
|---|
| cv.BackgroundSubtractorMOG2.apply( | image[, fgmask[, learningRate]] | ) -> | fgmask |
计算前景掩码。
- 参数
-
| image | 下一视频帧。浮点帧将不进行缩放使用,其范围应在 \([0,255]\) 内。 |
| fgmask | 作为 8 位二进制图像的输出前景掩码。 |
| learningRate | 介于 0 和 1 之间的值,表示背景模型的学习速度。负参数值表示算法将使用自动选择的学习率。0 表示背景模型完全不更新,1 表示背景模型从最后一帧完全重新初始化。 |
实现 cv::BackgroundSubtractor。
◆ getBackgroundRatio()
| virtual double cv::BackgroundSubtractorMOG2::getBackgroundRatio |
( |
| ) |
const |
|
纯虚函数 |
| Python |
|---|
| cv.BackgroundSubtractorMOG2.getBackgroundRatio( | | ) -> | retval |
返回算法的“背景比率”参数。
如果一个前景像素在约 backgroundRatio*history 帧内保持半恒定值,则被视为背景,并作为新分量的中心添加到模型中。这对应于论文中的 TB 参数。
◆ getComplexityReductionThreshold()
| virtual double cv::BackgroundSubtractorMOG2::getComplexityReductionThreshold |
( |
| ) |
const |
|
纯虚函数 |
| Python |
|---|
| cv.BackgroundSubtractorMOG2.getComplexityReductionThreshold( | | ) -> | retval |
返回复杂度降低阈值。
此参数定义了接受以证明组件存在的样本数量。CT=0.05 是所有样本的默认值。通过设置 CT=0,您将获得与标准 Stauffer&Grimson 算法非常相似的算法。
◆ getDetectShadows()
| virtual bool cv::BackgroundSubtractorMOG2::getDetectShadows |
( |
| ) |
const |
|
纯虚函数 |
| Python |
|---|
| cv.BackgroundSubtractorMOG2.getDetectShadows( | | ) -> | retval |
返回阴影检测标志。
如果为 true,算法将检测并标记阴影。详情请参见 createBackgroundSubtractorMOG2。
◆ getHistory()
| virtual int cv::BackgroundSubtractorMOG2::getHistory |
( |
| ) |
const |
|
纯虚函数 |
| Python |
|---|
| cv.BackgroundSubtractorMOG2.getHistory( | | ) -> | retval |
◆ getNMixtures()
| virtual int cv::BackgroundSubtractorMOG2::getNMixtures |
( |
| ) |
const |
|
纯虚函数 |
| Python |
|---|
| cv.BackgroundSubtractorMOG2.getNMixtures( | | ) -> | retval |
◆ getShadowThreshold()
| virtual double cv::BackgroundSubtractorMOG2::getShadowThreshold |
( |
| ) |
const |
|
纯虚函数 |
| Python |
|---|
| cv.BackgroundSubtractorMOG2.getShadowThreshold( | | ) -> | retval |
返回阴影阈值。
如果像素是背景的较暗版本,则检测到阴影。阴影阈值(论文中的 Tau)定义了阴影可以有多暗。Tau=0.5 意味着如果像素暗度超过两倍,则它不是阴影。参见 Prati, Mikic, Trivedi and Cucchiara, Detecting Moving Shadows...*, IEEE PAMI,2003。
◆ getShadowValue()
| virtual int cv::BackgroundSubtractorMOG2::getShadowValue |
( |
| ) |
const |
|
纯虚函数 |
| Python |
|---|
| cv.BackgroundSubtractorMOG2.getShadowValue( | | ) -> | retval |
返回阴影值。
阴影值是用于在前景掩码中标记阴影的值。默认值为 127。掩码中的值 0 始终表示背景,255 表示前景。
◆ getVarInit()
| virtual double cv::BackgroundSubtractorMOG2::getVarInit |
( |
| ) |
const |
|
纯虚函数 |
| Python |
|---|
| cv.BackgroundSubtractorMOG2.getVarInit( | | ) -> | retval |
◆ getVarMax()
| virtual double cv::BackgroundSubtractorMOG2::getVarMax |
( |
| ) |
const |
|
纯虚函数 |
| Python |
|---|
| cv.BackgroundSubtractorMOG2.getVarMax( | | ) -> | retval |
◆ getVarMin()
| virtual double cv::BackgroundSubtractorMOG2::getVarMin |
( |
| ) |
const |
|
纯虚函数 |
| Python |
|---|
| cv.BackgroundSubtractorMOG2.getVarMin( | | ) -> | retval |
◆ getVarThreshold()
| virtual double cv::BackgroundSubtractorMOG2::getVarThreshold |
( |
| ) |
const |
|
纯虚函数 |
| Python |
|---|
| cv.BackgroundSubtractorMOG2.getVarThreshold( | | ) -> | retval |
返回像素-模型匹配的方差阈值。
马氏距离平方上的主要阈值,用于判断样本是否被背景模型很好地描述。与论文中的 Cthr 相关。
◆ getVarThresholdGen()
| virtual double cv::BackgroundSubtractorMOG2::getVarThresholdGen |
( |
| ) |
const |
|
纯虚函数 |
| Python |
|---|
| cv.BackgroundSubtractorMOG2.getVarThresholdGen( | | ) -> | retval |
返回用于生成新混合分量的像素模型匹配的方差阈值。
马氏距离平方的阈值,用于帮助判断样本何时接近现有分量(对应于论文中的 Tg)。如果像素不接近任何分量,则被视为前景或作为新分量添加。3 sigma => Tg=3*3=9 是默认值。较小的 Tg 值会生成更多分量。较大的 Tg 值可能会导致分量数量较少,但它们可能变得太大。
◆ setBackgroundRatio()
| virtual void cv::BackgroundSubtractorMOG2::setBackgroundRatio |
( |
double | ratio | ) |
|
|
纯虚函数 |
| Python |
|---|
| cv.BackgroundSubtractorMOG2.setBackgroundRatio( | ratio | ) -> | 无 |
◆ setComplexityReductionThreshold()
| virtual void cv::BackgroundSubtractorMOG2::setComplexityReductionThreshold |
( |
double | ct | ) |
|
|
纯虚函数 |
| Python |
|---|
| cv.BackgroundSubtractorMOG2.setComplexityReductionThreshold( | ct | ) -> | 无 |
◆ setDetectShadows()
| virtual void cv::BackgroundSubtractorMOG2::setDetectShadows |
( |
bool | detectShadows | ) |
|
|
纯虚函数 |
| Python |
|---|
| cv.BackgroundSubtractorMOG2.setDetectShadows( | detectShadows | ) -> | 无 |
◆ setHistory()
| virtual void cv::BackgroundSubtractorMOG2::setHistory |
( |
int | history | ) |
|
|
纯虚函数 |
| Python |
|---|
| cv.BackgroundSubtractorMOG2.setHistory( | history | ) -> | 无 |
◆ setNMixtures()
| virtual void cv::BackgroundSubtractorMOG2::setNMixtures |
( |
int | nmixtures | ) |
|
|
纯虚函数 |
| Python |
|---|
| cv.BackgroundSubtractorMOG2.setNMixtures( | nmixtures | ) -> | 无 |
设置背景模型中的高斯分量数量。
需要重新初始化模型以保留内存。
◆ setShadowThreshold()
| virtual void cv::BackgroundSubtractorMOG2::setShadowThreshold |
( |
double | RANSAC参数。它是点到像素中对极线的最大距离,超过此距离的点将被视为异常值,不用于计算最终的基本矩阵。它可以设置为1-3左右,具体取决于点定位的精度、图像分辨率和图像噪声。 | ) |
|
|
纯虚函数 |
| Python |
|---|
| cv.BackgroundSubtractorMOG2.setShadowThreshold( | RANSAC参数。它是点到像素中对极线的最大距离,超过此距离的点将被视为异常值,不用于计算最终的基本矩阵。它可以设置为1-3左右,具体取决于点定位的精度、图像分辨率和图像噪声。 | ) -> | 无 |
◆ setShadowValue()
| virtual void cv::BackgroundSubtractorMOG2::setShadowValue |
( |
int | 值 | ) |
|
|
纯虚函数 |
| Python |
|---|
| cv.BackgroundSubtractorMOG2.setShadowValue( | 值 | ) -> | 无 |
◆ setVarInit()
| virtual void cv::BackgroundSubtractorMOG2::setVarInit |
( |
double | varInit | ) |
|
|
纯虚函数 |
| Python |
|---|
| cv.BackgroundSubtractorMOG2.setVarInit( | varInit | ) -> | 无 |
◆ setVarMax()
| virtual void cv::BackgroundSubtractorMOG2::setVarMax |
( |
double | varMax | ) |
|
|
纯虚函数 |
| Python |
|---|
| cv.BackgroundSubtractorMOG2.setVarMax( | varMax | ) -> | 无 |
◆ setVarMin()
| virtual void cv::BackgroundSubtractorMOG2::setVarMin |
( |
double | varMin | ) |
|
|
纯虚函数 |
| Python |
|---|
| cv.BackgroundSubtractorMOG2.setVarMin( | varMin | ) -> | 无 |
◆ setVarThreshold()
| virtual void cv::BackgroundSubtractorMOG2::setVarThreshold |
( |
double | varThreshold | ) |
|
|
纯虚函数 |
| Python |
|---|
| cv.BackgroundSubtractorMOG2.setVarThreshold( | varThreshold | ) -> | 无 |
◆ setVarThresholdGen()
| virtual void cv::BackgroundSubtractorMOG2::setVarThresholdGen |
( |
double | varThresholdGen | ) |
|
|
纯虚函数 |
| Python |
|---|
| cv.BackgroundSubtractorMOG2.setVarThresholdGen( | varThresholdGen | ) -> | 无 |
此类的文档生成自以下文件