[英]OpenCV Background Substraction c++
I've create a background Subsctractor (MOG) and now, I want to change some parameters: 我创建了一个后台Subsctractor(MOG),现在,我想更改一些参数:
Ptr< BackgroundSubtractor> pMOG, pMOG2;
pMOG = new BackgroundSubtractorMOG();
pMOG.set("varThreshold",5); //does't work
pMOG->operator()(inputImage, outputImage); //works, but the output is not enought "sensitive"
Has anyone an idea how I could deal with this? 有谁知道如何处理这个问题? I want to change the threshold value, because it returns an mask, that does not always detect my moving objects (eg if their color is nearly the backgrounds color).
我想更改阈值,因为它返回一个掩码,它并不总是检测我的移动物体(例如,如果它们的颜色几乎是背景颜色)。
Thanks! 谢谢!
That's because BackgroundSubtractorMOG
doesn't have a parameter named varThreshold
. 那是因为
BackgroundSubtractorMOG
没有名为varThreshold
的参数。 You probably wanted to set this parameter on BackgroundSubtractorMOG2
. 您可能想在
BackgroundSubtractorMOG2
上设置此参数。
The parameters for BackgroundSubtractorMOG
are: BackgroundSubtractorMOG
的参数是:
"history"
"nmixtures"
"backgroundRatio"
"noiseSigma"
while for BackgroundSubtractorMOG2
are: 而对于
BackgroundSubtractorMOG2
则是:
"history"
"nmixtures"
"varThreshold"
"detectShadows"
"backgroundRatio"
"varThresholdGen"
"fVarInit"
"fVarMin"
"fVarMax"
"fCT"
"nShadowDetection"
"fTau"
You can find these info in video_init.cpp (checked for OpenCV version 2.4.9). 您可以在video_init.cpp中找到这些信息(检查OpenCV版本2.4.9)。
You can also set some parameters directly into the constructor, which is probably the safest way. 您还可以将一些参数直接设置到构造函数中,这可能是最安全的方法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.