问题描述
我使用OpenCV2.2使用Background Subtraction的方法来实现移动对象检测。我使用高斯混合模型(GMM)方法来建模背景参考图像。
I'm using OpenCV2.2 to implement moving objects detection with the method of Background Subtraction. And I use the Gaussian Mixture Model(GMM) method to model the background reference image.
我通过使用OpenCV2.2中提供的类cv :: BackgroundSubtractorMOG直接获取前景像素(或前景蒙版)。它的方便,但由cv :: BackgroundSubtractorMOG返回的前景掩码不如我预期的好。另外,看来cv :: BackgroundSubtractorMOG比在C语言中用OpenCV1.0提供的GMM方法更差。
I directly get the foreground pixels(or foreground mask) by using the class cv::BackgroundSubtractorMOG provided in OpenCV2.2. It's convenient but the foreground mask returned by cv::BackgroundSubtractorMOG is not as good as I expected. In addition, it seems that cv::BackgroundSubtractorMOG performs poorer than the method of GMM wrote in C language provided in OpenCV1.0.
以下是我在OpenCV2中的代码。 2:
The following is my code in OpenCV2.2:
cv::BackgroundSubtractorMOG mog;
mog(frame, fgMask, 0.01);
那么,我使用的方法是否错误?
So, did I use the method in a wrong way?
顺便说一句,cv :: BackgroundSubtractorMOG是否对前景像素执行阴影去除?
By the way, does cv::BackgroundSubtractorMOG perform shadow removal on the foreground pixels?
非常感谢。
推荐答案
您不是定义任何参数,因此使用默认参数创建。 您有每个参数的说明,也许只是那。尝试使用3,4 5高斯。
When you create mog, you are not defining any parameters, so it is created with default parameters. Here you have a description of each parameter, maybe is just that. Try with 3, 4 5 Gaussians.
此函数不执行阴影去除,但您有其他功能。祝你好运!
This function does not perforn shadow-removal but you have this other function that does. Good luck!
这篇关于如何在OpenCV中使用cv :: BackgroundSubtractorMOG?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!