opencv BackgroundSubtractorMOG2重要方法

BackgroundSubtractorMOG2 重要方法

1. BackgroundSubtractorMOG2 的构造函数

    C++: BackgroundSubtractorMOG2::BackgroundSubtractorMOG2()

  采用默认值进行构造BackgroundSubtractorMOG2的对象。

   C++: BackgroundSubtractorMOG2:: BackgroundSubtractorMOG2(int history, float varThreshold, bool bShadowDetection=true)

    采用指定值进行构造BackgroundSubtractorMOG2的对象。

    参数说明:  

Parameters:
  • history – Length of the history.
  • varThreshold – Threshold on the squared Mahalanobis distance to decide whether it is well described by the background model (see Cthr??). This parameter does not affect the background update. A typical value could be 4 sigma, that is, varThreshold=4*4=16; (see Tb??).
  • bShadowDetection – Parameter defining whether shadow detection should be enabled (true or false).

 

 

2. BackgroundSubtractorMOG2 的operate

    C++: void BackgroundSubtractorMOG2::operator()(InputArray image, OutputArray fgmask, double learningRate=-1)

  参数说明:  参数image为待处理的图像;fgmask得到的前景图像(二值化都的);learningRate(0~1)配置背景更新方法,0表示不更新,1表示根据最后一帧更新,负数表示自动更新,(0~1)数字越大,背景更新越快。

Parameters:
  • image – Next video frame.
  • 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.

以上理解如果做错,欢迎交流。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值