1

我一直在测试两种不同的高斯混合 (MOG) 背景减法实现。一个是使用 opncv2.1.0,cvCreateGaussianBGModel + cvUpdateBGStatModel,另一个是使用 opencv 2.4.3,BackgroundSubtractorMOG2 类。

Now, 2.4.3 provide a parameter called bShadowDetect, to identify the shadow area by gray   color. But my experience with this implementation is, it does not provide the accuracy of   shadow detection. It varies according to the parameter fTau. The other issue with this   implementation is performance hit. For 640 X 480 resolution video, it is generating below 5   fps, By switching to release mode of project I get improvement upto 7 to 8 FPS.  

The another implementation of MOG is using 2.1.0. I have configured GaussianBG state   Model 's paramenters and then I am calling cvUpdateBGStatModel each time I receive a new   frame.  

For performance improvement, I have converted my frames to gray frames before I send it   for state update. My best performance till now is using opencv 2.1.0 and which is around 30   FPS for 640 X 480 resolution frames. So, currently I am preferring opencv 2.1.0 version's   MOG for background subtraction. But Here I come to face the issue of shadow removal. Here,   I want to detect only moving object. that is without shadow, and draw a rectangle to   highlight.   

Any help in this context will be grateful. 

提前致谢。

4

2 回答 2

0

我在项目中实现的背景减法代码是我自己的。我没有使用这些内置函数,因为它们中的许多都非常慢。

我所做的是:-

  1. 考虑一个像素,如果它的值在大约 15-20 帧左右没有变化,那么该像素对应于背景像素。我们将该像素保存在图像中。我们将这个过程迭代超过 10000 帧以覆盖完整的图像。(使用我们得到了没有前景物体的背景的近似图像)

  2. 为了去除背景,我所做的是,我将每个像素的 R、G、B 值与对应于背景图像的像素进行比较。(取像​​素的 R、G、B 值之间差异的平均平方)如果该值小于阈值(您应该使用滑块设置),那么该像素对应于背景,然后我所做的是我拍摄了另一张图像并将对应的像素设为黑色,否则该像素对应到前景对象并将其 RGB 值复制到我们的新图像中。这个过程在所有像素上迭代。(通过这种方式,您可以从前景中移除背景)

  3. 要检测阴影,您可以使用滑块根据需要更改阈值。

于 2012-12-10T10:54:41.563 回答
0

许多最近的阴影检测算法都有一种基于 OpenCV 的替代实现,可提供更高质量的阴影检测:

http://arma.sourceforge.net/shadows/

还有一篇相关的期刊文章,描述了所有已实现的算法及其各种权衡(例如质量与速度)。

于 2013-12-02T04:49:00.417 回答