0

我正在使用 Qt 和 opencv 进行视频处理项目。作为处理步骤,我需要从人类经过的视频(实时流)中提取背景。我需要知道 Opencv 是否具有从视频中提取静态对象的内置函数?

4

2 回答 2

3

看看这个 OpenCV 类

cv::Mat original;     // your frame
cv::Mat foreground;   // your foreground
cv::Mat background;   // your background

cv::BackgroundSubtractorMOG2 mog;

mog.history = 150;            // How many frames should be used for calculation
mog.nShadowDetection = false; // There are a lot of parameters to adjust

mog(original,foreground,0.01);  // Binary foreground saved in "foreground"

mog.getBackgroundImage(background); // Output the current background of the model

该类实现了高斯混合模型背景减法,如下所述:

Z.Zivkovic,改进的背景减除自适应高斯混合模型,国际会议模式识别,英国,2004 年 8 月, http: //www.zoranz.net/Publications/zivkovic2004ICPR.pdf 。该代码非常快并且还执行阴影检测。每个像素调整高斯分量的数量。

于 2013-01-30T20:02:54.187 回答
0

最快最简单的方法是使用前几帧的中值

您可以使用第一个背景图像的更新过程来考虑新的静态对象更复杂的方法,例如针式分量分析-高斯混合-自组织背景减法和 CNN 可以解决您的问题,但不适合流式传输,除非您正在使用特殊的硬件 FPGA 或 GPU

于 2017-08-03T19:09:23.190 回答