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.
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__)"
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.
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?