Merge pull request #6600 from grochefort:fix_backgroundsubstractormog2

This commit is contained in:
Andrey Pavlenko 2016-07-04 14:37:24 +00:00
commit 688bd28987
2 changed files with 1 additions and 6 deletions

View File

@ -369,7 +369,6 @@ __kernel void mog2_kernel(__global T_FRAME * frame, __global int* fgmask, __glob
bool fitsPDF = false; //if it remains zero a new GMM mode will be added
int nmodes = modesUsed[y * modesUsed_step + x];
int nNewModes = nmodes; //current number of modes in GMM
float totalWeight = 0.0f;
@ -430,8 +429,6 @@ __kernel void mog2_kernel(__global T_FRAME * frame, __global int* fgmask, __glob
for (int mode = 0; mode < nmodes; ++mode)
weight[(mode * frame_row + y) * weight_step + x] *= totalWeight;
nmodes = nNewModes;
if (!fitsPDF)
{
int mode = nmodes == (NMIXTURES) ? (NMIXTURES) - 1 : nmodes++;

View File

@ -309,7 +309,7 @@ struct MOG2Invoker : ParallelLoopBody
//internal:
bool fitsPDF = false;//if it remains zero a new GMM mode will be added
int nmodes = modesUsed[x], nNewModes = nmodes;//current number of modes in GMM
int nmodes = modesUsed[x];//current number of modes in GMM
float totalWeight = 0.f;
float* mean_m = mean;
@ -415,8 +415,6 @@ struct MOG2Invoker : ParallelLoopBody
gmm[mode].weight *= totalWeight;
}
nmodes = nNewModes;
//make new mode if needed and exit
if( !fitsPDF )
{