c++ - 从视频中提取背景场景

标签 c++ opencv qt-creator

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

最佳答案

看看this OpenCV class .

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,改进的背景自适应高斯混合模型 减法,国际 session 模式识别,英国, 2004 年 8 月, http://www.zoranz.net/Publications/zivkovic2004ICPR.pdf .代码是 非常快并且还执行阴影检测。高斯数 组件按像素调整。

关于c++ - 从视频中提取背景场景,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14607674/

相关文章:

c++ - OpenCV 将 float 据送入图像拼​​接过程

c++ - 返回主窗口/C++后,应用程序正在关闭

c++ - RegExp 查找不以特定单词结尾的特定字符串

c++ - 动态创建指针数组

c++ - 我可以在同一个游戏中使用 Mix_OpenAudio 和 SDL_OpenAudio 吗?

windows - qt创建者错误: program exited with code -1073741819

qt-creator - 在 qmake 中手动配置影子构建

c++ - 如何使用 xcb 正确设置 utf8 窗口标题?

c# - 相机校准和预测屏幕上的眼睛焦点 OpenCV/EmguCV

c++ - 使用 OpenCV 将小图像平铺成大图像