I was just wondering how this function CvBGStatModel() works. I mean to say what is the algorithm used for this and how it gives better results compared to average and frame difference algorithms.
Thanks in advance.
I was just wondering how this function CvBGStatModel() works. I mean to say what is the algorithm used for this and how it gives better results compared to average and frame difference algorithms.
Thanks in advance.
CvBGStatModel() is a class, not a function. For example, you can create this class like this:
IplImage* temp = NULL;
temp = cvLoadImage( "temp.jpg" );
CvBGStatModel* background_model = cvCreateGaussianBGModel(temp);
You have to call a function in order to update the background/foreground model (see sample):
cvUpdateBGStatModel( temp, background_model );
"how it gives better results compared to average and frame difference algorithms"
Because it stores pixel information as a mixture of the Gaussian Distributions that better represent that pixel. This means that a pixel that changes its value during a couple of frames won't be consider foreground as long as the Gaussians that better represent it are consider background. Gaussians are weighted. The longest a gaussian distribution was considered background, the more weight it has. The frame difference algorithm only considers difference between frames, but not how consistent/trustable these differences are.