Skip to content
Snippets Groups Projects
Commit cc483c60 authored by Lieven Govaerts's avatar Lieven Govaerts Committed by Andrews Sobral
Browse files

Fix a crash in the IndependentMultimodal algorithm during setup. The … (#108)

* Fix a crash in the IndependentMultimodal algorithm during setup. The nframes member
    variable is not initialized, which means that occasionally the initialize() function
    is not called when the first frame is processed.

    * package_bgs/IMBS/IMBS.cpp
      (BackgroundSubtractorIMBS): Initialize nframes to 0.

* Fix a crash when initializingn not using and the destroying the IndependentMultimodal algorithm.

* package_bgs/IMBS/IMBS.cpp
  (BackgroundSubtractorIMBS): initialize bgBins, bgModel and persistenceMap pointers to NULL.
parent 145fbe7e
No related branches found
No related tags found
No related merge requests found
...@@ -53,6 +53,10 @@ BackgroundSubtractorIMBS::BackgroundSubtractorIMBS() ...@@ -53,6 +53,10 @@ BackgroundSubtractorIMBS::BackgroundSubtractorIMBS()
tau_s = 60; tau_s = 60;
tau_h = 40; tau_h = 40;
minArea = 30.; minArea = 30.;
nframes = 0;
bgBins = NULL;
bgModel = NULL;
persistenceMap = NULL;
persistencePeriod = samplingPeriod*numSamples / 3.;//ms persistencePeriod = samplingPeriod*numSamples / 3.;//ms
initial_tick_count = (double)getTickCount(); initial_tick_count = (double)getTickCount();
...@@ -94,6 +98,10 @@ BackgroundSubtractorIMBS::BackgroundSubtractorIMBS( ...@@ -94,6 +98,10 @@ BackgroundSubtractorIMBS::BackgroundSubtractorIMBS(
this->tau_s = tau_s; this->tau_s = tau_s;
this->tau_h = tau_h; this->tau_h = tau_h;
this->minArea = minArea; this->minArea = minArea;
nframes = 0;
bgBins = NULL;
bgModel = NULL;
persistenceMap = NULL;
if (fps == 0.) if (fps == 0.)
initial_tick_count = (double)getTickCount(); initial_tick_count = (double)getTickCount();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment