为什么createBackgroundSubtractorGMG被认为已过时,如何使用它 [英] Why is createBackgroundSubtractorGMG considered obsolete, and how can I use it

查看:1349
本文介绍了为什么createBackgroundSubtractorGMG被认为已过时,如何使用它的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对OpenCV和一般的图像处理还是比较陌生的.我正在研究背景减法,以方便进行运动跟踪(人数统计).查看有关背景扣除的openCV文档,GMG给出了不错的结果.另外,当观看比较这些方法的视频时,我觉得GMG可以提供最好的结果,至少出于我的目的.

I am rather new to OpenCV and image processing in general. I am looking into background subtraction to facilitate motion tracking (people counting). Looking at the openCV documentation on background subtracting, GMG gives rather nice results. Also when looking at a video comparing the methods, I feel that GMG gives the best results, at least for my purpose.

我因此安装了要与python3一起使用的最新版本的opencv:

I installed the latest version of opencv to use with python3 thus:

git clone --depth=1 https://github.com/Itseez/opencv.git
cd opencv
mkdir build
cd build
cmake -DBUILD_opencv_python3=YES -DBUILD_opencv_python2=NO -DINSTALL_PYTHON_EXAMPLES=YES -DPYTHON3_EXECUTABLE=/usr/local/bin/python3 -DPYTHON3_INCLUDE_DIR=/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/include/python3.4m -DPYTHON3_LIBRARY=/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/libpython3.4.dylib -DPYTHON3_NUMPY_INCLUDE_DIRS=/usr/local/lib/python3.4/site-packages/numpy/core/include/ -DPYTHON3_PACKAGES_PATH=/usr/local/lib/python3.4/site-packages/ ..
make -j8
make install
python3 -c "import cv2; print(cv2.__version__)"

最后一行告诉我,我现在正在运行3.0.0-dev.根据​​此问题cv2.createBackgroundSubtractorGMG应该在此版本中可用,但不是;确实,在opencv主版本中已经过时了.

the last line tells me I'm now running 3.0.0-dev. According to this question, cv2.createBackgroundSubtractorGMG ought to be available in this version, however it's not; and indeed, it seems to have been moved to obsolete in opencv master.

足够有趣的是,在我自己的测试中,当前的createBackgroundSubtractorKNNcreateBackgroundSubtractorMOG2(3.0.0-dev)版本比我以前在opencv2中测试的版本(MOGMOG2)更好.因此,GMG算法可能已被应用到其中.或者,如果不是,为什么现在认为GMG版本已过时?以及如何才能使用过时的版本(在python3上)以比较结果?

Interestingly enough, in my own tests the current (3.0.0-dev) versions of createBackgroundSubtractorKNN and createBackgroundSubtractorMOG2 work much better than the ones I tested before (MOG and MOG2) in opencv2. So possibly the GMG algorithm got moved into those. Or, if not, why is the GMG version considered obsolete now? And how can I get the obsolete version to work (on python3), to compare the results?

推荐答案

我认为它已经过时了……它只是移到了

I don't think it is obsolete... it was just moved to the contrib repository. You have to install it with OpenCV and then it is available under cv2.bgsegm. Follow the link for build instructions.

这篇关于为什么createBackgroundSubtractorGMG被认为已过时,如何使用它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆