diff --git a/Demo.cpp b/Demo.cpp index 99aaf38f33ddfdc4788fc893e53af2cd9558731c..c5abcf7f6dd40a94229e9bbcbc703c7a3a6405f7 100644 --- a/Demo.cpp +++ b/Demo.cpp @@ -67,6 +67,7 @@ along with BGSLibrary. If not, see <http://www.gnu.org/licenses/>. #include "package_bgs/ae/KDE.h" #include "package_bgs/db/IndependentMultimodalBGS.h" #include "package_bgs/sjn/SJN_MultiCueBGS.h" +#include "package_bgs/bl/SigmaDeltaBGS.h" int main(int argc, char **argv) { @@ -156,6 +157,9 @@ int main(int argc, char **argv) /*** SJN Package (thanks to SeungJong Noh) ***/ //bgs = new SJN_MultiCueBGS; + /*** BL Package (thanks to Benjamin Laugraud) ***/ + //bgs = new SigmaDeltaBGS; + int key = 0; while(key != 'q') { diff --git a/Demo.exe b/Demo.exe index 6327c541b6f7d956f397c225b751be690eb54b82..7373b7b91ab8475c7072210665ed3a2878827bd8 100644 Binary files a/Demo.exe and b/Demo.exe differ diff --git a/Demo2.cpp b/Demo2.cpp new file mode 100644 index 0000000000000000000000000000000000000000..af9bb836cf3e0a9d9b92536654b801f2260a7d6b --- /dev/null +++ b/Demo2.cpp @@ -0,0 +1,172 @@ +/* +This file is part of BGSLibrary. + +BGSLibrary is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +BGSLibrary is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with BGSLibrary. If not, see <http://www.gnu.org/licenses/>. +*/ +#include <iostream> +#include <cv.h> +#include <highgui.h> + +#include "package_bgs/FrameDifferenceBGS.h" +#include "package_bgs/StaticFrameDifferenceBGS.h" +#include "package_bgs/WeightedMovingMeanBGS.h" +#include "package_bgs/WeightedMovingVarianceBGS.h" +#include "package_bgs/MixtureOfGaussianV1BGS.h" +#include "package_bgs/MixtureOfGaussianV2BGS.h" +#include "package_bgs/AdaptiveBackgroundLearning.h" +#include "package_bgs/AdaptiveSelectiveBackgroundLearning.h" + +#if CV_MAJOR_VERSION >= 2 && CV_MINOR_VERSION >= 4 && CV_SUBMINOR_VERSION >= 3 +#include "package_bgs/GMG.h" +#endif + +#include "package_bgs/dp/DPAdaptiveMedianBGS.h" +#include "package_bgs/dp/DPGrimsonGMMBGS.h" +#include "package_bgs/dp/DPZivkovicAGMMBGS.h" +#include "package_bgs/dp/DPMeanBGS.h" +#include "package_bgs/dp/DPWrenGABGS.h" +#include "package_bgs/dp/DPPratiMediodBGS.h" +#include "package_bgs/dp/DPEigenbackgroundBGS.h" +#include "package_bgs/dp/DPTextureBGS.h" + +#include "package_bgs/tb/T2FGMM_UM.h" +#include "package_bgs/tb/T2FGMM_UV.h" +#include "package_bgs/tb/T2FMRF_UM.h" +#include "package_bgs/tb/T2FMRF_UV.h" +#include "package_bgs/tb/FuzzySugenoIntegral.h" +#include "package_bgs/tb/FuzzyChoquetIntegral.h" + +#include "package_bgs/lb/LBSimpleGaussian.h" +#include "package_bgs/lb/LBFuzzyGaussian.h" +#include "package_bgs/lb/LBMixtureOfGaussians.h" +#include "package_bgs/lb/LBAdaptiveSOM.h" +#include "package_bgs/lb/LBFuzzyAdaptiveSOM.h" + +#if !defined(_WIN32) +// Currently this method works only on Linux platform. +#include "package_bgs/ck/LbpMrf.h" +#endif + +#include "package_bgs/jmo/MultiLayerBGS.h" +// The PBAS algorithm was removed from BGSLibrary because it is +// based on patented algorithm ViBE +// http://www2.ulg.ac.be/telecom/research/vibe/ +//#include "package_bgs/pt/PixelBasedAdaptiveSegmenter.h" +#include "package_bgs/av/VuMeter.h" +#include "package_bgs/ae/KDE.h" +#include "package_bgs/db/IndependentMultimodalBGS.h" +#include "package_bgs/sjn/SJN_MultiCueBGS.h" +#include "package_bgs/bl/SigmaDeltaBGS.h" + +int main(int argc, char **argv) +{ + std::cout << "Using OpenCV " << CV_MAJOR_VERSION << "." << CV_MINOR_VERSION << "." << CV_SUBMINOR_VERSION << std::endl; + + /* Background Subtraction Methods */ + IBGS *bgs; + + /*** Default Package ***/ + bgs = new FrameDifferenceBGS; + //bgs = new StaticFrameDifferenceBGS; + //bgs = new WeightedMovingMeanBGS; + //bgs = new WeightedMovingVarianceBGS; + //bgs = new MixtureOfGaussianV1BGS; + //bgs = new MixtureOfGaussianV2BGS; + //bgs = new AdaptiveBackgroundLearning; + //bgs = new AdaptiveSelectiveBackgroundLearning; + //bgs = new GMG; + + /*** DP Package (thanks to Donovan Parks) ***/ + //bgs = new DPAdaptiveMedianBGS; + //bgs = new DPGrimsonGMMBGS; + //bgs = new DPZivkovicAGMMBGS; + //bgs = new DPMeanBGS; + //bgs = new DPWrenGABGS; + //bgs = new DPPratiMediodBGS; + //bgs = new DPEigenbackgroundBGS; + //bgs = new DPTextureBGS; + + /*** TB Package (thanks to Thierry Bouwmans, Fida EL BAF and Zhenjie Zhao) ***/ + //bgs = new T2FGMM_UM; + //bgs = new T2FGMM_UV; + //bgs = new T2FMRF_UM; + //bgs = new T2FMRF_UV; + //bgs = new FuzzySugenoIntegral; + //bgs = new FuzzyChoquetIntegral; + + /*** JMO Package (thanks to Jean-Marc Odobez) ***/ + //bgs = new MultiLayerBGS; + + /*** PT Package (thanks to Martin Hofmann, Philipp Tiefenbacher and Gerhard Rigoll) ***/ + //bgs = new PixelBasedAdaptiveSegmenter; + + /*** LB Package (thanks to Laurence Bender) ***/ + //bgs = new LBSimpleGaussian; + //bgs = new LBFuzzyGaussian; + //bgs = new LBMixtureOfGaussians; + //bgs = new LBAdaptiveSOM; + //bgs = new LBFuzzyAdaptiveSOM; + + /*** LBP-MRF Package (thanks to Csaba Kertész) ***/ + //bgs = new LbpMrf; + + /*** AV Package (thanks to Lionel Robinault and Antoine Vacavant) ***/ + //bgs = new VuMeter; + + /*** EG Package (thanks to Ahmed Elgammal) ***/ + //bgs = new KDE; + + /*** DB Package (thanks to Domenico Daniele Bloisi) ***/ + //bgs = new IndependentMultimodalBGS; + + /*** SJN Package (thanks to SeungJong Noh) ***/ + //bgs = new SJN_MultiCueBGS; + + /*** BL Package (thanks to Benjamin Laugraud) ***/ + //bgs = new SigmaDeltaBGS; + + int frameNumber = 1; + int key = 0; + while(key != 'q') + { + std::stringstream ss; + ss << frameNumber; + std::string fileName = "./frames/" + ss.str() + ".png"; + std::cout << "reading " << fileName << std::endl; + + cv::Mat img_input = cv::imread(fileName, CV_LOAD_IMAGE_COLOR); + + if (img_input.empty()) + break; + + cv::imshow("input", img_input); + + cv::Mat img_mask; + cv::Mat img_bkgmodel; + bgs->process(img_input, img_mask, img_bkgmodel); // by default, it shows automatically the foreground mask image + + //if(!img_mask.empty()) + // cv::imshow("Foreground", img_mask); + // do something + + key = cvWaitKey(33); + frameNumber++; + } + cvWaitKey(0); + delete bgs; + + cvDestroyAllWindows(); + + return 0; +} diff --git a/Demo2.exe b/Demo2.exe new file mode 100644 index 0000000000000000000000000000000000000000..dbaa1041f0fbbe1cd0f9780dd77fff4ad15592f3 Binary files /dev/null and b/Demo2.exe differ diff --git a/config/FrameDifferenceBGS.xml b/config/FrameDifferenceBGS.xml new file mode 100644 index 0000000000000000000000000000000000000000..7bb4bea50f9d0f996f781c26e9bc2b4247fbf8b5 --- /dev/null +++ b/config/FrameDifferenceBGS.xml @@ -0,0 +1,6 @@ +<?xml version="1.0"?> +<opencv_storage> +<enableThreshold>1</enableThreshold> +<threshold>15</threshold> +<showOutput>1</showOutput> +</opencv_storage> diff --git a/frames/1.png b/frames/1.png new file mode 100644 index 0000000000000000000000000000000000000000..1a4ed8f93d7c7608e44c0c1eee8671f175d97510 Binary files /dev/null and b/frames/1.png differ diff --git a/frames/10.png b/frames/10.png new file mode 100644 index 0000000000000000000000000000000000000000..9c07ad5665a35b67962c211add74a9833f76c4df Binary files /dev/null and b/frames/10.png differ diff --git a/frames/11.png b/frames/11.png new file mode 100644 index 0000000000000000000000000000000000000000..85f67c257c774ee72abd7ed6007d040978ae1638 Binary files /dev/null and b/frames/11.png differ diff --git a/frames/12.png b/frames/12.png new file mode 100644 index 0000000000000000000000000000000000000000..0783b9a16ccfea475739c76c6b9728c0e019451a Binary files /dev/null and b/frames/12.png differ diff --git a/frames/13.png b/frames/13.png new file mode 100644 index 0000000000000000000000000000000000000000..03708da8d30130acfb7ebfd36e347dceff32d286 Binary files /dev/null and b/frames/13.png differ diff --git a/frames/14.png b/frames/14.png new file mode 100644 index 0000000000000000000000000000000000000000..0d9f183b72d905abce0f1d7d0e4ba703a3aab183 Binary files /dev/null and b/frames/14.png differ diff --git a/frames/15.png b/frames/15.png new file mode 100644 index 0000000000000000000000000000000000000000..921e373c1da9b7429b73a3f6a55b4f7985f6570b Binary files /dev/null and b/frames/15.png differ diff --git a/frames/16.png b/frames/16.png new file mode 100644 index 0000000000000000000000000000000000000000..35724c6a80b1f58934b2bb77f01e6c038645c8d6 Binary files /dev/null and b/frames/16.png differ diff --git a/frames/17.png b/frames/17.png new file mode 100644 index 0000000000000000000000000000000000000000..c7c00dba83f4944f330257a324966556d9a2af9b Binary files /dev/null and b/frames/17.png differ diff --git a/frames/18.png b/frames/18.png new file mode 100644 index 0000000000000000000000000000000000000000..f720f094d52c37e4a66681cee9d569ca755e402c Binary files /dev/null and b/frames/18.png differ diff --git a/frames/19.png b/frames/19.png new file mode 100644 index 0000000000000000000000000000000000000000..f79ba5ef716f40dbe2c71287efab0afc591f424d Binary files /dev/null and b/frames/19.png differ diff --git a/frames/2.png b/frames/2.png new file mode 100644 index 0000000000000000000000000000000000000000..80b69ff2b3ddd06cd6abd3176954ceeef6c9085f Binary files /dev/null and b/frames/2.png differ diff --git a/frames/20.png b/frames/20.png new file mode 100644 index 0000000000000000000000000000000000000000..8fa857f9e9391c98f1b7cd800ccf425ffce774c6 Binary files /dev/null and b/frames/20.png differ diff --git a/frames/21.png b/frames/21.png new file mode 100644 index 0000000000000000000000000000000000000000..4066689da9e99c9557877c4e019c95d2f49c2ef7 Binary files /dev/null and b/frames/21.png differ diff --git a/frames/22.png b/frames/22.png new file mode 100644 index 0000000000000000000000000000000000000000..4eab05935ad942a5b47e27d581bf8b03a0588987 Binary files /dev/null and b/frames/22.png differ diff --git a/frames/23.png b/frames/23.png new file mode 100644 index 0000000000000000000000000000000000000000..95c7ae4a2a4e47663f8a6264a63fb7631e66828c Binary files /dev/null and b/frames/23.png differ diff --git a/frames/24.png b/frames/24.png new file mode 100644 index 0000000000000000000000000000000000000000..e7911f18e2c857f0a0fdd8f9601df0e006abf4b0 Binary files /dev/null and b/frames/24.png differ diff --git a/frames/25.png b/frames/25.png new file mode 100644 index 0000000000000000000000000000000000000000..e622e96e6c24a9d09d40df8cea1a0d31661a0d72 Binary files /dev/null and b/frames/25.png differ diff --git a/frames/26.png b/frames/26.png new file mode 100644 index 0000000000000000000000000000000000000000..75d2365412c18313ea6af382c5df3bd93383edfe Binary files /dev/null and b/frames/26.png differ diff --git a/frames/27.png b/frames/27.png new file mode 100644 index 0000000000000000000000000000000000000000..5293e7ec038fb349e4830dbc10f977cfc9af2387 Binary files /dev/null and b/frames/27.png differ diff --git a/frames/28.png b/frames/28.png new file mode 100644 index 0000000000000000000000000000000000000000..6bc933b3124ff2d0c7680880a787ce8968df378a Binary files /dev/null and b/frames/28.png differ diff --git a/frames/29.png b/frames/29.png new file mode 100644 index 0000000000000000000000000000000000000000..7eaaee299cfd2befad83343a39ad7a9fb588548b Binary files /dev/null and b/frames/29.png differ diff --git a/frames/3.png b/frames/3.png new file mode 100644 index 0000000000000000000000000000000000000000..eb322896c9e700297724c022585bf2ed4bc0e8ee Binary files /dev/null and b/frames/3.png differ diff --git a/frames/30.png b/frames/30.png new file mode 100644 index 0000000000000000000000000000000000000000..c3e1cd0304f2ae22ffea69c680deb4128e8ed3b1 Binary files /dev/null and b/frames/30.png differ diff --git a/frames/31.png b/frames/31.png new file mode 100644 index 0000000000000000000000000000000000000000..6ec4856fbd4c0ed376d26a12a94b02d9c0bf3aad Binary files /dev/null and b/frames/31.png differ diff --git a/frames/32.png b/frames/32.png new file mode 100644 index 0000000000000000000000000000000000000000..8feacd220e70c59f0a07fb452f8f0402ffaf2bd9 Binary files /dev/null and b/frames/32.png differ diff --git a/frames/33.png b/frames/33.png new file mode 100644 index 0000000000000000000000000000000000000000..7d88de32cd05ce981e9799bb9426b5e09b267d37 Binary files /dev/null and b/frames/33.png differ diff --git a/frames/34.png b/frames/34.png new file mode 100644 index 0000000000000000000000000000000000000000..9738ac35797fd92f6f03b1995282726535486109 Binary files /dev/null and b/frames/34.png differ diff --git a/frames/35.png b/frames/35.png new file mode 100644 index 0000000000000000000000000000000000000000..f85022addeb84309f1617303af164004ea89996a Binary files /dev/null and b/frames/35.png differ diff --git a/frames/36.png b/frames/36.png new file mode 100644 index 0000000000000000000000000000000000000000..edbdb627f1a066d773d2234006ca2f5b238291d7 Binary files /dev/null and b/frames/36.png differ diff --git a/frames/37.png b/frames/37.png new file mode 100644 index 0000000000000000000000000000000000000000..b27dacb396cfa0d522a925a91c35b4c6f5367ec0 Binary files /dev/null and b/frames/37.png differ diff --git a/frames/38.png b/frames/38.png new file mode 100644 index 0000000000000000000000000000000000000000..f20555cc48e82c650fa91e3d3b8b3cd9e6d0c2b3 Binary files /dev/null and b/frames/38.png differ diff --git a/frames/39.png b/frames/39.png new file mode 100644 index 0000000000000000000000000000000000000000..29ea25b2d90fdb2bf9cc06b45fd343284e95e7a5 Binary files /dev/null and b/frames/39.png differ diff --git a/frames/4.png b/frames/4.png new file mode 100644 index 0000000000000000000000000000000000000000..a2aa98d09932851785df270c0ff2738bc3d337e9 Binary files /dev/null and b/frames/4.png differ diff --git a/frames/40.png b/frames/40.png new file mode 100644 index 0000000000000000000000000000000000000000..03b5279994d159a8cb9c203003dc0419673eba7f Binary files /dev/null and b/frames/40.png differ diff --git a/frames/41.png b/frames/41.png new file mode 100644 index 0000000000000000000000000000000000000000..976fa7b6446395551217f296d88d4d058b12ea3e Binary files /dev/null and b/frames/41.png differ diff --git a/frames/42.png b/frames/42.png new file mode 100644 index 0000000000000000000000000000000000000000..7d0ed3b876d3767cfb1558df0019f8bc21646245 Binary files /dev/null and b/frames/42.png differ diff --git a/frames/43.png b/frames/43.png new file mode 100644 index 0000000000000000000000000000000000000000..2965fe3099e1986ccf64eb333acbebc95cec8625 Binary files /dev/null and b/frames/43.png differ diff --git a/frames/44.png b/frames/44.png new file mode 100644 index 0000000000000000000000000000000000000000..5166585036e1999f727292d3c8bef500e4054165 Binary files /dev/null and b/frames/44.png differ diff --git a/frames/45.png b/frames/45.png new file mode 100644 index 0000000000000000000000000000000000000000..dbff43f8bb2432ffa2fe039fe1f0d48d6c717995 Binary files /dev/null and b/frames/45.png differ diff --git a/frames/46.png b/frames/46.png new file mode 100644 index 0000000000000000000000000000000000000000..8fe5f5d0ac8d82a377e37b5199ebaa0708a76fe3 Binary files /dev/null and b/frames/46.png differ diff --git a/frames/47.png b/frames/47.png new file mode 100644 index 0000000000000000000000000000000000000000..a8abcbfcce3ff2bae81c12f8f1c9b6da3c4d026d Binary files /dev/null and b/frames/47.png differ diff --git a/frames/48.png b/frames/48.png new file mode 100644 index 0000000000000000000000000000000000000000..8d3b50ea07eae1fdb99be15dc1975bfe37c3978e Binary files /dev/null and b/frames/48.png differ diff --git a/frames/49.png b/frames/49.png new file mode 100644 index 0000000000000000000000000000000000000000..b1a9facec97cff1a7cdc4d361b864a13294a0128 Binary files /dev/null and b/frames/49.png differ diff --git a/frames/5.png b/frames/5.png new file mode 100644 index 0000000000000000000000000000000000000000..51f1c69d5ab594c5c3a380a8cd36427e362fe038 Binary files /dev/null and b/frames/5.png differ diff --git a/frames/50.png b/frames/50.png new file mode 100644 index 0000000000000000000000000000000000000000..0d6d188637f2a77e3d1e4e431ff889fe4002c83a Binary files /dev/null and b/frames/50.png differ diff --git a/frames/51.png b/frames/51.png new file mode 100644 index 0000000000000000000000000000000000000000..a7a9e0fd7e4bf75fecf62591ea308666e2479266 Binary files /dev/null and b/frames/51.png differ diff --git a/frames/6.png b/frames/6.png new file mode 100644 index 0000000000000000000000000000000000000000..26ecff4356bd8680579a66aa9bfe71e92f1258cb Binary files /dev/null and b/frames/6.png differ diff --git a/frames/7.png b/frames/7.png new file mode 100644 index 0000000000000000000000000000000000000000..203d1868d90bcde99b9cae23a9742602e5b18a53 Binary files /dev/null and b/frames/7.png differ diff --git a/frames/8.png b/frames/8.png new file mode 100644 index 0000000000000000000000000000000000000000..400a298793fc758fca9a945c55c23f9a6aec287e Binary files /dev/null and b/frames/8.png differ diff --git a/frames/9.png b/frames/9.png new file mode 100644 index 0000000000000000000000000000000000000000..24efc11379200ddaf471030681f8bee424a6bb37 Binary files /dev/null and b/frames/9.png differ