fixed the case learningRate==0 in BackgroundSubtractorMOG2 (patch #2221; thanks to Will Lucas)

pull/31/head
Vadim Pisarevsky 13 years ago
parent bb93651048
commit bbeffcc115
  1. 21
      modules/video/src/bgfg_gaussmix2.cpp

@ -562,18 +562,15 @@ void BackgroundSubtractorMOG2::operator()(InputArray _image, OutputArray _fgmask
learningRate = learningRate >= 0 && nframes > 1 ? learningRate : 1./min( 2*nframes, history );
CV_Assert(learningRate >= 0);
if (learningRate > 0)
{
parallel_for(BlockedRange(0, image.rows),
MOG2Invoker(image, fgmask,
(GMM*)bgmodel.data,
(float*)(bgmodel.data + sizeof(GMM)*nmixtures*image.rows*image.cols),
bgmodelUsedModes.data, nmixtures, (float)learningRate,
(float)varThreshold,
backgroundRatio, varThresholdGen,
fVarInit, fVarMin, fVarMax, float(-learningRate*fCT), fTau,
bShadowDetection, nShadowDetection));
}
parallel_for(BlockedRange(0, image.rows),
MOG2Invoker(image, fgmask,
(GMM*)bgmodel.data,
(float*)(bgmodel.data + sizeof(GMM)*nmixtures*image.rows*image.cols),
bgmodelUsedModes.data, nmixtures, (float)learningRate,
(float)varThreshold,
backgroundRatio, varThresholdGen,
fVarInit, fVarMin, fVarMax, float(-learningRate*fCT), fTau,
bShadowDetection, nShadowDetection));
}
void BackgroundSubtractorMOG2::getBackgroundImage(OutputArray backgroundImage) const

Loading…
Cancel
Save