OpenCV C++ 中的 createBackgroundSubtractorKNN 参数是什么?

What are createBackgroundSubtractorKNN parameters in OpenCV C++?

我需要

参数的解释
createBackgroundSubtractorKNN(int history=500, double dist2Threshold=400.0, bool detectShadows=true)

history、dist2Threshold 和 detectShadows 如何影响背景减法器?

有时,理解函数参数的最简单方法是亲自动手。这是我可以通过阅读 documentation 并测试函数得出的结论:

  • history是用来建立后台统计模型的帧数。值越小,背景的变化越快被模型考虑,因此被认为是背景。反之亦然。
  • dist2Threshold 是一个 阈值 来定义 像素是否不同于 背景或不是。该值越小,运动检测越灵敏。反之亦然。
  • detectShadows : 如果设置为 true,阴影将在生成的掩码[=31] 上以 gray 显示=]. (示例如下)

希望我的解释对您有所帮助,并且您现在更清楚了。