Fixed BackgroundSubstractorMOG2 in opencv_video.
The number of gaussians involved in a mixture is supposed to be dynamically adjusted. After being increased, the number of gaussians can't be reduced anymore. It seems to be a regression as the legacy code located in modules/legacy/src/bgfg_gaussmix.cpp allows to reduce such number of gaussians.
This commit is contained in:
parent
19e79d6727
commit
78de75397e
@ -309,7 +309,7 @@ struct MOG2Invoker : ParallelLoopBody
|
|||||||
|
|
||||||
//internal:
|
//internal:
|
||||||
bool fitsPDF = false;//if it remains zero a new GMM mode will be added
|
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 totalWeight = 0.f;
|
||||||
|
|
||||||
float* mean_m = mean;
|
float* mean_m = mean;
|
||||||
@ -415,8 +415,6 @@ struct MOG2Invoker : ParallelLoopBody
|
|||||||
gmm[mode].weight *= totalWeight;
|
gmm[mode].weight *= totalWeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
nmodes = nNewModes;
|
|
||||||
|
|
||||||
//make new mode if needed and exit
|
//make new mode if needed and exit
|
||||||
if( !fitsPDF )
|
if( !fitsPDF )
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user