# what the use of nmixtures, nchannels in bgmodel.create from bgfg_gaussmix.cpp line 123?

Hi I've problem to understand why there so many size parameter in bgmodel.create( 1, frameSize.height*frameSize.width*nmixtures*(2 + 2*nchannels), CV_32F ); from bgfg_gaussmix.cpp line 123? Why put nmixtures, and (2+2*channels)? And how they clustering the pixel value like how they get mean and covariance for each Gaussian distribution, it's seems the clustering program is not there..

edit retag close merge delete

Sort by » oldest newest most voted

I'm so stupid not to understand the comment from the author, so here my explanation.. We want to clustering pixel value at each coordinate (x,y) with mixture of Gaussian, we know that Gaussian distribution have 2 main parameter which is mean, and covariance/variance, and in background subtraction we classify the Gaussian distribution which is foreground or background first by sorting the distributions by weight/(covariance or variance) from the highest, and then sum the weight from the sorting Gaussian before which larger than some threshold (T). For example: we use RGB color space. As I told before, we need mean, covariance, and weight/covariance for each Gaussian distribution.. So we need 3 for save each mean (because it's RGB not grayscale), 3 for save each variance, and 1 for save each weight, 1 for save each weight/covariance ratio, so the total things we need to save for each Gaussian distribution =3+3+1+1=8 that's where the equation (2+2*nchannel) come from..

more

Official site

GitHub

Wiki

Documentation