背景建模技术(六):帧处理(FrameProcessor)模块
前面几篇文章简单介绍了BgsLibrary的入口函数、视频分析和视频捕获模块,本文将简单介绍帧处理模块,即对每一帧进行处理的函数,也就是真正调用背景建模算法的接口处。
下面贴出源码供大家分析:
- #include "FrameProcessor.h"
 - #include <iomanip>
 - namespace bgslibrary
 - {
 - FrameProcessor::FrameProcessor() : firstTime(true), frameNumber(0), duration(0), tictoc(""), frameToStop(0)
 - {
 - std::cout << "FrameProcessor()" << std::endl;
 - loadConfig();
 - saveConfig();
 - }
 - FrameProcessor::~FrameProcessor()
 - {
 - std::cout << "~FrameProcessor()" << std::endl;
 - }
 - void FrameProcessor::init()
 - {
 - if (enablePreProcessor)
 - preProcessor = new PreProcessor;
 - if (enableFrameDifferenceBGS)
 - frameDifference = new FrameDifferenceBGS;
 - if (enableStaticFrameDifferenceBGS)
 - staticFrameDifference = new StaticFrameDifferenceBGS;
 - if (enableWeightedMovingMeanBGS)
 - weightedMovingMean = new WeightedMovingMeanBGS;
 - if (enableWeightedMovingVarianceBGS)
 - weightedMovingVariance = new WeightedMovingVarianceBGS;
 - if (enableMixtureOfGaussianV1BGS)
 - mixtureOfGaussianV1BGS = new MixtureOfGaussianV1BGS;
 - if (enableMixtureOfGaussianV2BGS)
 - mixtureOfGaussianV2BGS = new MixtureOfGaussianV2BGS;
 - if (enableAdaptiveBackgroundLearning)
 - adaptiveBackgroundLearning = new AdaptiveBackgroundLearning;
 - #if CV_MAJOR_VERSION >= 2 && CV_MINOR_VERSION >= 4 && CV_SUBMINOR_VERSION >= 3
 - if (enableGMG)
 - gmg = new GMG;
 - #endif
 - if (enableDPAdaptiveMedianBGS)
 - adaptiveMedian = new DPAdaptiveMedianBGS;
 - if (enableDPGrimsonGMMBGS)
 - grimsonGMM = new DPGrimsonGMMBGS;
 - if (enableDPZivkovicAGMMBGS)
 - zivkovicAGMM = new DPZivkovicAGMMBGS;
 - if (enableDPMeanBGS)
 - temporalMean = new DPMeanBGS;
 - if (enableDPWrenGABGS)
 - wrenGA = new DPWrenGABGS;
 - if (enableDPPratiMediodBGS)
 - pratiMediod = new DPPratiMediodBGS;
 - if (enableDPEigenbackgroundBGS)
 - eigenBackground = new DPEigenbackgroundBGS;
 - if (enableDPTextureBGS)
 - textureBGS = new DPTextureBGS;
 - if (enableT2FGMM_UM)
 - type2FuzzyGMM_UM = new T2FGMM_UM;
 - if (enableT2FGMM_UV)
 - type2FuzzyGMM_UV = new T2FGMM_UV;
 - if (enableT2FMRF_UM)
 - type2FuzzyMRF_UM = new T2FMRF_UM;
 - if (enableT2FMRF_UV)
 - type2FuzzyMRF_UV = new T2FMRF_UV;
 - if (enableFuzzySugenoIntegral)
 - fuzzySugenoIntegral = new FuzzySugenoIntegral;
 - if (enableFuzzyChoquetIntegral)
 - fuzzyChoquetIntegral = new FuzzyChoquetIntegral;
 - if (enableLBSimpleGaussian)
 - lbSimpleGaussian = new LBSimpleGaussian;
 - if (enableLBFuzzyGaussian)
 - lbFuzzyGaussian = new LBFuzzyGaussian;
 - if (enableLBMixtureOfGaussians)
 - lbMixtureOfGaussians = new LBMixtureOfGaussians;
 - if (enableLBAdaptiveSOM)
 - lbAdaptiveSOM = new LBAdaptiveSOM;
 - if (enableLBFuzzyAdaptiveSOM)
 - lbFuzzyAdaptiveSOM = new LBFuzzyAdaptiveSOM;
 - if (enableLbpMrf)
 - lbpMrf = new LbpMrf;
 - if(enableMultiLayerBGS)
 - multiLayerBGS = new MultiLayerBGS;
 - //if(enablePBAS)
 - // pixelBasedAdaptiveSegmenter = new PixelBasedAdaptiveSegmenter;
 - if (enableVuMeter)
 - vuMeter = new VuMeter;
 - if (enableKDE)
 - kde = new KDE;
 - if (enableIMBS)
 - imbs = new IndependentMultimodalBGS;
 - if (enableMultiCueBGS)
 - mcbgs = new SJN_MultiCueBGS;
 - if (enableSigmaDeltaBGS)
 - sdbgs = new SigmaDeltaBGS;
 - if (enableSuBSENSEBGS)
 - ssbgs = new SuBSENSEBGS;
 - if (enableLOBSTERBGS)
 - lobgs = new LOBSTERBGS;
 - if (enableForegroundMaskAnalysis)
 - foregroundMaskAnalysis = new ForegroundMaskAnalysis;
 - }
 - void FrameProcessor::process(std::string name, IBGS *bgs, const cv::Mat &img_input, cv::Mat &img_bgs)
 - {
 - if (tictoc == name)
 - tic(name);
 - cv::Mat img_bkgmodel;
 - bgs->process(img_input, img_bgs, img_bkgmodel);//直接调用各种背景建模算法
 - if (tictoc == name)
 - toc();
 - }
 - void FrameProcessor::process(const cv::Mat &img_input)
 - {
 - frameNumber++;
 - ///enablePreProcessor///
 - if (enablePreProcessor)
 - preProcessor->process(img_input, img_prep);
 - /******************************************************************/
 - /*根据config文件使能各种背景建模算法,可以同时使用多种背景建模算法*/
 - /******************************************************************/
 - ///1:Frame Difference
 - if (enableFrameDifferenceBGS)
 - process("FrameDifferenceBGS", frameDifference, img_prep, img_framediff);
 - ///2:Static Frame Difference
 - if (enableStaticFrameDifferenceBGS)
 - process("StaticFrameDifferenceBGS", staticFrameDifference, img_prep, img_staticfdiff);
 - ///3:Weighted Moving Mean
 - if (enableWeightedMovingMeanBGS)
 - process("WeightedMovingMeanBGS", weightedMovingMean, img_prep, img_wmovmean);
 - ///4:Weighted Moving Variance
 - if (enableWeightedMovingVarianceBGS)
 - process("WeightedMovingVarianceBGS", weightedMovingVariance, img_prep, img_movvar);
 - ///5:Gaussian Mixture Model
 - if (enableMixtureOfGaussianV1BGS)
 - process("MixtureOfGaussianV1BGS", mixtureOfGaussianV1BGS, img_prep, img_mog1);
 - ///6:Gaussian Mixture Model
 - if (enableMixtureOfGaussianV2BGS)
 - process("MixtureOfGaussianV2BGS", mixtureOfGaussianV2BGS, img_prep, img_mog2);
 - ///7:Adaptive Background Learning
 - if (enableAdaptiveBackgroundLearning)
 - process("AdaptiveBackgroundLearning", adaptiveBackgroundLearning, img_prep, img_bkgl_fgmask);
 - ///8:GMG
 - #if CV_MAJOR_VERSION >= 2 && CV_MINOR_VERSION >= 4 && CV_SUBMINOR_VERSION >= 3
 - if (enableGMG)
 - process("GMG", gmg, img_prep, img_gmg);
 - #endif
 - ///9:Adaptive Median
 - if (enableDPAdaptiveMedianBGS)
 - process("DPAdaptiveMedianBGS", adaptiveMedian, img_prep, img_adpmed);
 - ///10:Gaussian Mixture Model
 - if (enableDPGrimsonGMMBGS)
 - process("DPGrimsonGMMBGS", grimsonGMM, img_prep, img_grigmm);
 - ///11:Gaussian Mixture Model
 - if (enableDPZivkovicAGMMBGS)
 - process("DPZivkovicAGMMBGS", zivkovicAGMM, img_prep, img_zivgmm);
 - ///12:Temporal Mean
 - if (enableDPMeanBGS)
 - process("DPMeanBGS", temporalMean, img_prep, img_tmpmean);
 - ///13:Gaussian Average
 - if (enableDPWrenGABGS)
 - process("DPWrenGABGS", wrenGA, img_prep, img_wrenga);
 - ///14:Temporal Median
 - if (enableDPPratiMediodBGS)
 - process("DPPratiMediodBGS", pratiMediod, img_prep, img_pramed);
 - ///15:Eigen background / SL-PCA
 - if (enableDPEigenbackgroundBGS)
 - process("DPEigenbackgroundBGS", eigenBackground, img_prep, img_eigbkg);
 - ///16:Texture BGS
 - if (enableDPTextureBGS)
 - process("DPTextureBGS", textureBGS, img_prep, img_texbgs);
 - ///17:Type-2 Fuzzy GMM-UM
 - if (enableT2FGMM_UM)
 - process("T2FGMM_UM", type2FuzzyGMM_UM, img_prep, img_t2fgmm_um);
 - ///18:Type-2 Fuzzy GMM-UV
 - if (enableT2FGMM_UV)
 - process("T2FGMM_UV", type2FuzzyGMM_UV, img_prep, img_t2fgmm_uv);
 - ///19:Type-2 Fuzzy GMM-UM with MRF
 - if (enableT2FMRF_UM)
 - process("T2FMRF_UM", type2FuzzyMRF_UM, img_prep, img_t2fmrf_um);
 - ///20:Type-2 Fuzzy GMM-UV with MRF
 - if (enableT2FMRF_UV)
 - process("T2FMRF_UV", type2FuzzyMRF_UV, img_prep, img_t2fmrf_uv);
 - ///21:Fuzzy Sugeno Integral
 - if (enableFuzzySugenoIntegral)
 - process("FuzzySugenoIntegral", fuzzySugenoIntegral, img_prep, img_fsi);
 - ///22:Fuzzy Choquet Integral
 - if (enableFuzzyChoquetIntegral)
 - process("FuzzyChoquetIntegral", fuzzyChoquetIntegral, img_prep, img_fci);
 - ///23:Simple Gaussian
 - if (enableLBSimpleGaussian)
 - process("LBSimpleGaussian", lbSimpleGaussian, img_prep, img_lb_sg);
 - ///24:Fuzzy Gaussian of Laurence Bender
 - if (enableLBFuzzyGaussian)
 - process("LBFuzzyGaussian", lbFuzzyGaussian, img_prep, img_lb_fg);
 - ///25:Gaussian Mixture Model
 - if (enableLBMixtureOfGaussians)
 - process("LBMixtureOfGaussians", lbMixtureOfGaussians, img_prep, img_lb_mog);
 - ///26:Adaptive SOM
 - if (enableLBAdaptiveSOM)
 - process("LBAdaptiveSOM", lbAdaptiveSOM, img_prep, img_lb_som);
 - ///27:Fuzzy Adaptive SOM
 - if (enableLBFuzzyAdaptiveSOM)
 - process("LBFuzzyAdaptiveSOM", lbFuzzyAdaptiveSOM, img_prep, img_lb_fsom);
 - ///28:LbpMrf
 - if (enableLbpMrf)
 - process("LbpMrf", lbpMrf, img_prep, img_lbp_mrf);
 - ///29:Multi-Layer BGS
 - if(enableMultiLayerBGS)
 - {
 - multiLayerBGS->setStatus(MultiLayerBGS::MLBGS_LEARN);
 - //multiLayerBGS->setStatus(MultiLayerBGS::MLBGS_DETECT);
 - process("MultiLayerBGS", multiLayerBGS, img_prep, img_mlbgs);
 - }
 - ///30:Pixel-Based Adaptive Segmenter
 - //if(enablePBAS)
 - // process("PBAS", pixelBasedAdaptiveSegmenter, img_prep, img_pt_pbas);
 - ///31:VuMeter
 - if (enableVuMeter)
 - process("VuMeter", vuMeter, img_prep, img_vumeter);
 - ///32:Kernel Density Estimation
 - if (enableKDE)
 - process("KDE", kde, img_prep, img_kde);
 - ///33:Independent Multimodal BGS
 - if (enableIMBS)
 - process("IMBS", imbs, img_prep, img_imbs);
 - ///34:MultiCue BGS
 - if (enableMultiCueBGS)
 - process("MultiCueBGS", mcbgs, img_prep, img_mcbgs);
 - ///35:Sigma-Delta
 - if (enableSigmaDeltaBGS)
 - process("SigmaDeltaBGS", sdbgs, img_prep, img_sdbgs);
 - ///36:SuBSENSE
 - if (enableSuBSENSEBGS)
 - process("SuBSENSEBGS", ssbgs, img_prep, img_ssbgs);
 - ///37:LOBSTER
 - if (enableLOBSTERBGS)
 - process("LOBSTERBGS", lobgs, img_prep, img_lobgs);
 - ///enableForegroundMaskAnalysis///
 - if (enableForegroundMaskAnalysis)
 - {
 - foregroundMaskAnalysis->stopAt = frameToStop;
 - foregroundMaskAnalysis->img_ref_path = imgref;
 - foregroundMaskAnalysis->process(frameNumber, "FrameDifferenceBGS", img_framediff);
 - foregroundMaskAnalysis->process(frameNumber, "StaticFrameDifferenceBGS", img_staticfdiff);
 - foregroundMaskAnalysis->process(frameNumber, "WeightedMovingMeanBGS", img_wmovmean);
 - foregroundMaskAnalysis->process(frameNumber, "WeightedMovingVarianceBGS", img_movvar);
 - foregroundMaskAnalysis->process(frameNumber, "MixtureOfGaussianV1BGS", img_mog1);
 - foregroundMaskAnalysis->process(frameNumber, "MixtureOfGaussianV2BGS", img_mog2);
 - foregroundMaskAnalysis->process(frameNumber, "AdaptiveBackgroundLearning", img_bkgl_fgmask);
 - #if CV_MAJOR_VERSION >= 2 && CV_MINOR_VERSION >= 4 && CV_SUBMINOR_VERSION >= 3
 - foregroundMaskAnalysis->process(frameNumber, "GMG", img_gmg);
 - #endif
 - foregroundMaskAnalysis->process(frameNumber, "DPAdaptiveMedianBGS", img_adpmed);
 - foregroundMaskAnalysis->process(frameNumber, "DPGrimsonGMMBGS", img_grigmm);
 - foregroundMaskAnalysis->process(frameNumber, "DPZivkovicAGMMBGS", img_zivgmm);
 - foregroundMaskAnalysis->process(frameNumber, "DPMeanBGS", img_tmpmean);
 - foregroundMaskAnalysis->process(frameNumber, "DPWrenGABGS", img_wrenga);
 - foregroundMaskAnalysis->process(frameNumber, "DPPratiMediodBGS", img_pramed);
 - foregroundMaskAnalysis->process(frameNumber, "DPEigenbackgroundBGS", img_eigbkg);
 - foregroundMaskAnalysis->process(frameNumber, "DPTextureBGS", img_texbgs);
 - foregroundMaskAnalysis->process(frameNumber, "T2FGMM_UM", img_t2fgmm_um);
 - foregroundMaskAnalysis->process(frameNumber, "T2FGMM_UV", img_t2fgmm_uv);
 - foregroundMaskAnalysis->process(frameNumber, "T2FMRF_UM", img_t2fmrf_um);
 - foregroundMaskAnalysis->process(frameNumber, "T2FMRF_UV", img_t2fmrf_uv);
 - foregroundMaskAnalysis->process(frameNumber, "FuzzySugenoIntegral", img_fsi);
 - foregroundMaskAnalysis->process(frameNumber, "FuzzyChoquetIntegral", img_fci);
 - foregroundMaskAnalysis->process(frameNumber, "LBSimpleGaussian", img_lb_sg);
 - foregroundMaskAnalysis->process(frameNumber, "LBFuzzyGaussian", img_lb_fg);
 - foregroundMaskAnalysis->process(frameNumber, "LBMixtureOfGaussians", img_lb_mog);
 - foregroundMaskAnalysis->process(frameNumber, "LBAdaptiveSOM", img_lb_som);
 - foregroundMaskAnalysis->process(frameNumber, "LBFuzzyAdaptiveSOM", img_lb_fsom);
 - foregroundMaskAnalysis->process(frameNumber, "LbpMrf", img_lbp_mrf);
 - foregroundMaskAnalysis->process(frameNumber, "MultiLayerBGS", img_mlbgs);
 - //foregroundMaskAnalysis->process(frameNumber, "PBAS", img_pt_pbas);
 - foregroundMaskAnalysis->process(frameNumber, "VuMeter", img_vumeter);
 - foregroundMaskAnalysis->process(frameNumber, "KDE", img_kde);
 - foregroundMaskAnalysis->process(frameNumber, "IMBS", img_imbs);
 - foregroundMaskAnalysis->process(frameNumber, "MultiCueBGS", img_mcbgs);
 - foregroundMaskAnalysis->process(frameNumber, "SigmaDeltaBGS", img_sdbgs);
 - foregroundMaskAnalysis->process(frameNumber, "SuBSENSEBGS", img_ssbgs);
 - foregroundMaskAnalysis->process(frameNumber, "LOBSTERBGS", img_lobgs);
 - }
 - firstTime = false;
 - }
 - void FrameProcessor::finish(void)
 - {
 - /*if(enableMultiLayerBGS)
 - multiLayerBGS->finish();
 - if(enableLBSimpleGaussian)
 - lbSimpleGaussian->finish();
 - if(enableLBFuzzyGaussian)
 - lbFuzzyGaussian->finish();
 - if(enableLBMixtureOfGaussians)
 - lbMixtureOfGaussians->finish();
 - if(enableLBAdaptiveSOM)
 - lbAdaptiveSOM->finish();
 - if(enableLBFuzzyAdaptiveSOM)
 - lbFuzzyAdaptiveSOM->finish();*/
 - if (enableForegroundMaskAnalysis)
 - delete foregroundMaskAnalysis;
 - if (enableLOBSTERBGS)
 - delete lobgs;
 - if (enableSuBSENSEBGS)
 - delete ssbgs;
 - if (enableSigmaDeltaBGS)
 - delete sdbgs;
 - if (enableMultiCueBGS)
 - delete mcbgs;
 - if (enableIMBS)
 - delete imbs;
 - if (enableKDE)
 - delete kde;
 - if (enableVuMeter)
 - delete vuMeter;
 - //if(enablePBAS)
 - // delete pixelBasedAdaptiveSegmenter;
 - if (enableMultiLayerBGS)
 - delete multiLayerBGS;
 - if (enableLBFuzzyAdaptiveSOM)
 - delete lbFuzzyAdaptiveSOM;
 - if (enableLBAdaptiveSOM)
 - delete lbAdaptiveSOM;
 - if (enableLBMixtureOfGaussians)
 - delete lbMixtureOfGaussians;
 - if (enableLBFuzzyGaussian)
 - delete lbFuzzyGaussian;
 - if (enableLBSimpleGaussian)
 - delete lbSimpleGaussian;
 - #if !defined(_WIN32)
 - if (enableLbpMrf)
 - delete lbpMrf;
 - #endif
 - if(enableFuzzyChoquetIntegral)
 - delete fuzzyChoquetIntegral;
 - if (enableFuzzySugenoIntegral)
 - delete fuzzySugenoIntegral;
 - if (enableT2FMRF_UV)
 - delete type2FuzzyMRF_UV;
 - if (enableT2FMRF_UM)
 - delete type2FuzzyMRF_UM;
 - if (enableT2FGMM_UV)
 - delete type2FuzzyGMM_UV;
 - if (enableT2FGMM_UM)
 - delete type2FuzzyGMM_UM;
 - if (enableDPTextureBGS)
 - delete textureBGS;
 - if (enableDPEigenbackgroundBGS)
 - delete eigenBackground;
 - if (enableDPPratiMediodBGS)
 - delete pratiMediod;
 - if (enableDPWrenGABGS)
 - delete wrenGA;
 - if (enableDPMeanBGS)
 - delete temporalMean;
 - if (enableDPZivkovicAGMMBGS)
 - delete zivkovicAGMM;
 - if (enableDPGrimsonGMMBGS)
 - delete grimsonGMM;
 - if (enableDPAdaptiveMedianBGS)
 - delete adaptiveMedian;
 - #if CV_MAJOR_VERSION >= 2 && CV_MINOR_VERSION >= 4 && CV_SUBMINOR_VERSION >= 3
 - if (enableGMG)
 - delete gmg;
 - #endif
 - if (enableAdaptiveBackgroundLearning)
 - delete adaptiveBackgroundLearning;
 - if (enableMixtureOfGaussianV2BGS)
 - delete mixtureOfGaussianV2BGS;
 - if (enableMixtureOfGaussianV1BGS)
 - delete mixtureOfGaussianV1BGS;
 - if (enableWeightedMovingVarianceBGS)
 - delete weightedMovingVariance;
 - if (enableWeightedMovingMeanBGS)
 - delete weightedMovingMean;
 - if (enableStaticFrameDifferenceBGS)
 - delete staticFrameDifference;
 - if (enableFrameDifferenceBGS)
 - delete frameDifference;
 - if (enablePreProcessor)
 - delete preProcessor;
 - }
 - void FrameProcessor::tic(std::string value)
 - {
 - processname = value;
 - duration = static_cast<double>(cv::getTickCount());
 - }
 - void FrameProcessor::toc()
 - {
 - duration = (static_cast<double>(cv::getTickCount()) - duration) / cv::getTickFrequency();
 - std::cout << processname << "\ttime(sec):" << std::fixed << std::setprecision(6) << duration << std::endl;
 - }
 - void FrameProcessor::saveConfig()
 - {
 - CvFileStorage* fs = cvOpenFileStorage("./config/FrameProcessor.xml", 0, CV_STORAGE_WRITE);
 - cvWriteString(fs, "tictoc", tictoc.c_str());
 - cvWriteInt(fs, "enablePreProcessor", enablePreProcessor);
 - cvWriteInt(fs, "enableForegroundMaskAnalysis", enableForegroundMaskAnalysis);
 - cvWriteInt(fs, "enableFrameDifferenceBGS", enableFrameDifferenceBGS);
 - cvWriteInt(fs, "enableStaticFrameDifferenceBGS", enableStaticFrameDifferenceBGS);
 - cvWriteInt(fs, "enableWeightedMovingMeanBGS", enableWeightedMovingMeanBGS);
 - cvWriteInt(fs, "enableWeightedMovingVarianceBGS", enableWeightedMovingVarianceBGS);
 - cvWriteInt(fs, "enableMixtureOfGaussianV1BGS", enableMixtureOfGaussianV1BGS);
 - cvWriteInt(fs, "enableMixtureOfGaussianV2BGS", enableMixtureOfGaussianV2BGS);
 - cvWriteInt(fs, "enableAdaptiveBackgroundLearning", enableAdaptiveBackgroundLearning);
 - #if CV_MAJOR_VERSION >= 2 && CV_MINOR_VERSION >= 4 && CV_SUBMINOR_VERSION >= 3
 - cvWriteInt(fs, "enableGMG", enableGMG);
 - #endif
 - cvWriteInt(fs, "enableDPAdaptiveMedianBGS", enableDPAdaptiveMedianBGS);
 - cvWriteInt(fs, "enableDPGrimsonGMMBGS", enableDPGrimsonGMMBGS);
 - cvWriteInt(fs, "enableDPZivkovicAGMMBGS", enableDPZivkovicAGMMBGS);
 - cvWriteInt(fs, "enableDPMeanBGS", enableDPMeanBGS);
 - cvWriteInt(fs, "enableDPWrenGABGS", enableDPWrenGABGS);
 - cvWriteInt(fs, "enableDPPratiMediodBGS", enableDPPratiMediodBGS);
 - cvWriteInt(fs, "enableDPEigenbackgroundBGS", enableDPEigenbackgroundBGS);
 - cvWriteInt(fs, "enableDPTextureBGS", enableDPTextureBGS);
 - cvWriteInt(fs, "enableT2FGMM_UM", enableT2FGMM_UM);
 - cvWriteInt(fs, "enableT2FGMM_UV", enableT2FGMM_UV);
 - cvWriteInt(fs, "enableT2FMRF_UM", enableT2FMRF_UM);
 - cvWriteInt(fs, "enableT2FMRF_UV", enableT2FMRF_UV);
 - cvWriteInt(fs, "enableFuzzySugenoIntegral", enableFuzzySugenoIntegral);
 - cvWriteInt(fs, "enableFuzzyChoquetIntegral", enableFuzzyChoquetIntegral);
 - cvWriteInt(fs, "enableLBSimpleGaussian", enableLBSimpleGaussian);
 - cvWriteInt(fs, "enableLBFuzzyGaussian", enableLBFuzzyGaussian);
 - cvWriteInt(fs, "enableLBMixtureOfGaussians", enableLBMixtureOfGaussians);
 - cvWriteInt(fs, "enableLBAdaptiveSOM", enableLBAdaptiveSOM);
 - cvWriteInt(fs, "enableLBFuzzyAdaptiveSOM", enableLBFuzzyAdaptiveSOM);
 - cvWriteInt(fs, "enableLbpMrf", enableLbpMrf);
 - cvWriteInt(fs, "enableMultiLayerBGS", enableMultiLayerBGS);
 - //cvWriteInt(fs, "enablePBAS", enablePBAS);
 - cvWriteInt(fs, "enableVuMeter", enableVuMeter);
 - cvWriteInt(fs, "enableKDE", enableKDE);
 - cvWriteInt(fs, "enableIMBS", enableIMBS);
 - cvWriteInt(fs, "enableMultiCueBGS", enableMultiCueBGS);
 - cvWriteInt(fs, "enableSigmaDeltaBGS", enableSigmaDeltaBGS);
 - cvWriteInt(fs, "enableSuBSENSEBGS", enableSuBSENSEBGS);
 - cvWriteInt(fs, "enableLOBSTERBGS", enableLOBSTERBGS);
 - cvReleaseFileStorage(&fs);
 - }
 - void FrameProcessor::loadConfig()
 - {
 - CvFileStorage* fs = cvOpenFileStorage("./config/FrameProcessor.xml", 0, CV_STORAGE_READ);
 - tictoc = cvReadStringByName(fs, 0, "tictoc", "");
 - enablePreProcessor = cvReadIntByName(fs, 0, "enablePreProcessor", true);
 - enableForegroundMaskAnalysis = cvReadIntByName(fs, 0, "enableForegroundMaskAnalysis", false);
 - enableFrameDifferenceBGS = cvReadIntByName(fs, 0, "enableFrameDifferenceBGS", false);
 - enableStaticFrameDifferenceBGS = cvReadIntByName(fs, 0, "enableStaticFrameDifferenceBGS", false);
 - enableWeightedMovingMeanBGS = cvReadIntByName(fs, 0, "enableWeightedMovingMeanBGS", false);
 - enableWeightedMovingVarianceBGS = cvReadIntByName(fs, 0, "enableWeightedMovingVarianceBGS", false);
 - enableMixtureOfGaussianV1BGS = cvReadIntByName(fs, 0, "enableMixtureOfGaussianV1BGS", false);
 - enableMixtureOfGaussianV2BGS = cvReadIntByName(fs, 0, "enableMixtureOfGaussianV2BGS", false);
 - enableAdaptiveBackgroundLearning = cvReadIntByName(fs, 0, "enableAdaptiveBackgroundLearning", false);
 - #if CV_MAJOR_VERSION >= 2 && CV_MINOR_VERSION >= 4 && CV_SUBMINOR_VERSION >= 3
 - enableGMG = cvReadIntByName(fs, 0, "enableGMG", false);
 - #endif
 - enableDPAdaptiveMedianBGS = cvReadIntByName(fs, 0, "enableDPAdaptiveMedianBGS", false);
 - enableDPGrimsonGMMBGS = cvReadIntByName(fs, 0, "enableDPGrimsonGMMBGS", false);
 - enableDPZivkovicAGMMBGS = cvReadIntByName(fs, 0, "enableDPZivkovicAGMMBGS", false);
 - enableDPMeanBGS = cvReadIntByName(fs, 0, "enableDPMeanBGS", false);
 - enableDPWrenGABGS = cvReadIntByName(fs, 0, "enableDPWrenGABGS", false);
 - enableDPPratiMediodBGS = cvReadIntByName(fs, 0, "enableDPPratiMediodBGS", false);
 - enableDPEigenbackgroundBGS = cvReadIntByName(fs, 0, "enableDPEigenbackgroundBGS", false);
 - enableDPTextureBGS = cvReadIntByName(fs, 0, "enableDPTextureBGS", false);
 - enableT2FGMM_UM = cvReadIntByName(fs, 0, "enableT2FGMM_UM", false);
 - enableT2FGMM_UV = cvReadIntByName(fs, 0, "enableT2FGMM_UV", false);
 - enableT2FMRF_UM = cvReadIntByName(fs, 0, "enableT2FMRF_UM", false);
 - enableT2FMRF_UV = cvReadIntByName(fs, 0, "enableT2FMRF_UV", false);
 - enableFuzzySugenoIntegral = cvReadIntByName(fs, 0, "enableFuzzySugenoIntegral", false);
 - enableFuzzyChoquetIntegral = cvReadIntByName(fs, 0, "enableFuzzyChoquetIntegral", false);
 - enableLBSimpleGaussian = cvReadIntByName(fs, 0, "enableLBSimpleGaussian", false);
 - enableLBFuzzyGaussian = cvReadIntByName(fs, 0, "enableLBFuzzyGaussian", false);
 - enableLBMixtureOfGaussians = cvReadIntByName(fs, 0, "enableLBMixtureOfGaussians", false);
 - enableLBAdaptiveSOM = cvReadIntByName(fs, 0, "enableLBAdaptiveSOM", false);
 - enableLBFuzzyAdaptiveSOM = cvReadIntByName(fs, 0, "enableLBFuzzyAdaptiveSOM", false);
 - enableLbpMrf = cvReadIntByName(fs, 0, "enableLbpMrf", false);
 - enableMultiLayerBGS = cvReadIntByName(fs, 0, "enableMultiLayerBGS", false);
 - //enablePBAS = cvReadIntByName(fs, 0, "enablePBAS", false);
 - enableVuMeter = cvReadIntByName(fs, 0, "enableVuMeter", false);
 - enableKDE = cvReadIntByName(fs, 0, "enableKDE", false);
 - enableIMBS = cvReadIntByName(fs, 0, "enableIMBS", false);
 - enableMultiCueBGS = cvReadIntByName(fs, 0, "enableMultiCueBGS", false);
 - enableSigmaDeltaBGS = cvReadIntByName(fs, 0, "enableSigmaDeltaBGS", false);
 - enableSuBSENSEBGS = cvReadIntByName(fs, 0, "enableSuBSENSEBGS", false);
 - enableLOBSTERBGS = cvReadIntByName(fs, 0, "enableLOBSTERBGS", false);
 - cvReleaseFileStorage(&fs);
 - }
 - }
 
其实,从源码中可以看出,本函数所做的工作并不多,主要就是调用背景建模算法的接口,其接口处是:bgs->process(img_input, img_bgs, img_bkgmodel);
下面给出此段代码的大致流程框架图:
背景建模技术(六):帧处理(FrameProcessor)模块的更多相关文章
- 背景建模技术(三):背景减法库(BGS Library)的基本框架与入口函数main()的功能
		
背景减法库(BGS Library = background subtraction library)包含了37种背景建模算法,也是目前国际上关于背景建模技术研究最全也最权威的资料.本文将更加详细的介 ...
 - 背景建模技术(二):BgsLibrary的框架、背景建模的37种算法性能分析、背景建模技术的挑战
		
背景建模技术(二):BgsLibrary的框架.背景建模的37种算法性能分析.背景建模技术的挑战 1.基于MFC的BgsLibrary软件下载 下载地址:http://download.csdn.ne ...
 - 背景建模技术(七):预处理(PreProcessor)模块
		
预处理(PreProcessor)模块是BgsLibrary中一个必选的模块,是真正进入背景建模算法的“预处理”过程,其主要功能包括‘去模糊’.‘获得灰度图’.'应用Canny算子‘等可选模块. 下面 ...
 - 背景建模技术(五):视频捕获(VideoCapture)模块
		
本次对“视频捕获(VideoCapture)模块”做出分析,给出源代码和对应的程序流程框架. 视频捕获模块的主要功能是设置视频或相机参数,并读取设置配置参数,最后进入帧处理模块的process进程,该 ...
 - 背景建模技术(四):视频分析(VideoAnalysis)模块
		
视频分析模块主要包含两个函数,一个是VideoAnalysis::setup(....),其主要功能就是确定测试的视频是视频文件或摄像头输入亦或是采用命令行参数:第二个函数是VideoAnalysis ...
 - 【计算机视觉】背景建模--Vibe 算法优缺点分析
		
一.Vibe 算法的优点 Vibe背景建模为运动目标检测研究邻域开拓了新思路,是一种新颖.快速及有效的运动目标检测算法.其优点有以下两点: 1.思想简单,易于实现.Vibe通常随机选取邻域20个样本为 ...
 - 浅析软件工程中的UML建模技术
		
一.基本信息 标题:浅析软件工程中的UML建模技术 时间:2018 出版源:电子世界 领域分类:软件工程:UML建模技术:需求分析 二.研究背景 问题定义:软件工程中UML建模技术的研究 难点:明确软 ...
 - 背景建模或前景检測之PBAS
		
申明,本文非笔者原创,原文转载自:http://blog.csdn.net/kcust/article/details/9931575 Pixel-Based Adaptive Segmenter(P ...
 - 【计算机视觉】背景建模之PBAS
		
本文是根据M. Hofmann等人在2012年的IEEE Workshop on Change Detection上发表的"Background Segmentation with Feed ...
 
随机推荐
- lesson 20 pioneer pilots
			
lesson 20 Pioneer pilots driver pilot rider cyclist 骑自行车的人 介词后不加that cover + 距离 = travel 了一段距离 by su ...
 - Unity OBB分包(基础APK+OBB) 与apk签名
			
1.OBB (Opaque Binary Blob)文件格式,是安卓游戏通用数据包.在一些大型游戏上较为常见,同时还附以Data文件,亦或是md5.dat文件出现 产生原因:由于某些平台对于apk上传 ...
 - Grid 网格布局
			
CSS 网格布局(Grid Layout) 是CSS中最强大的布局系统. 这是一个二维系统,这意味着它可以同时处理列和行,不像 flexbox 那样主要是一维系统. 你可以通过将CSS规则应用于父元素 ...
 - RL_Learning
			
Key Concepts in RL 标签(空格分隔): RL_learning OpenAI Spinning Up原址 states and observations (状态和观测) action ...
 - 5.hadoop常用命令
			
1. 单独启动和关闭hadoop服务 启动名称节点 #hadoop-daemon.sh start namenode 启动数据节点 #hadoop-daemons.sh start datanode ...
 - Alpha冲刺——第二天
			
Alpha第二天 听说 031502543 周龙荣(队长) 031502615 李家鹏 031502632 伍晨薇 031502637 张柽 031502639 郑秦 1.前言 任务分配是VV.ZQ. ...
 - lintcode-184-最大数
			
184-最大数 给出一组非负整数,重新排列他们的顺序把他们组成一个最大的整数. 注意事项 最后的结果可能很大,所以我们返回一个字符串来代替这个整数. #### 样例 给出 [1, 20, 23, 4, ...
 - HDU 2115 I Love This Game
			
http://acm.hdu.edu.cn/showproblem.php?pid=2115 Problem Description Do you like playing basketball ? ...
 - SQL SERVER技术内幕之8 分组集
			
分组集就是分组(GROUP BY子句)使用的一组属性,在传统的SQL中,一个聚合查询只能定义一个分组集: 假设现在不想生成4个单独的结果集,而是希望生成一个统一的结果集,其中包含所有4个分组集的聚合 ...
 - vc6.0批量加注释
			
MATLAB批量加注释的方法非常简单明了,加注释是ctrl+R,去注释是ctrl+T 然后在VC中我对一条一条加注释的方法非常烦恼,我想也许会有简单的方法可以批量家注释.果然,先贴代码 '------ ...