【问题标题】:OpenCV Background Substraction c++OpenCV背景减法c ++
【发布时间】:2015-11-28 14:09:22
【问题描述】:

我已经创建了一个背景 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"

有谁知道我该如何处理这个问题?我想更改阈值,因为它返回一个掩码,它并不总是检测到我的移动对象(例如,如果它们的颜色接近背景颜色)。

谢谢!

【问题讨论】:

    标签: c++ opencv background-subtraction


    【解决方案1】:

    这是因为BackgroundSubtractorMOG 没有名为varThreshold 的参数。您可能想在BackgroundSubtractorMOG2 上设置此参数。

    BackgroundSubtractorMOG 的参数为:

    "history"
    "nmixtures"
    "backgroundRatio"
    "noiseSigma"
    

    BackgroundSubtractorMOG2 是:

    "history"
    "nmixtures"
    "varThreshold"
    "detectShadows"
    "backgroundRatio"
    "varThresholdGen"
    "fVarInit"
    "fVarMin"
    "fVarMax"
    "fCT"
    "nShadowDetection"
    "fTau"
    

    您可以在video_init.cpp 中找到这些信息(检查 OpenCV 版本 2.4.9)。


    你也可以直接在构造函数中设置一些参数,这可能是最安全的方式。

    【讨论】:

    • 谢谢!您能否编写一个示例行如何更改值(例如noiseSigma)以及使用哪个命令? pMog.set 不起作用。也许是因为
    猜你喜欢
    • 2011-12-19
    • 1970-01-01
    • 2014-04-03
    • 2016-06-19
    • 2011-12-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多