Lines Matching refs:bg_model
112 …cvBackgroundTest( const int nChannels, int n, int i, int j, int *match, CvGaussBGModel* bg_model );
114 static void CV_CDECL icvReleaseGaussianBGModel( CvGaussBGModel** bg_model );
115 static int CV_CDECL icvUpdateGaussianBGModel( IplImage* curr_frame, CvGaussBGModel* bg_model );
138 CvGaussBGModel* bg_model = 0; in cvCreateGaussianBGModel() local
169 CV_CALL( bg_model = (CvGaussBGModel*)cvAlloc( sizeof(*bg_model) )); in cvCreateGaussianBGModel()
170 memset( bg_model, 0, sizeof(*bg_model) ); in cvCreateGaussianBGModel()
171 bg_model->type = CV_BG_MODEL_MOG; in cvCreateGaussianBGModel()
172 bg_model->release = (CvReleaseBGStatModel)icvReleaseGaussianBGModel; in cvCreateGaussianBGModel()
173 bg_model->update = (CvUpdateBGStatModel)icvUpdateGaussianBGModel; in cvCreateGaussianBGModel()
175 bg_model->params = params; in cvCreateGaussianBGModel()
178 CV_CALL( bg_model->g_point = (CvGaussBGPoint*)cvAlloc(sizeof(CvGaussBGPoint)* in cvCreateGaussianBGModel()
181 CV_CALL( bg_model->background = cvCreateImage(cvSize(first_frame->width, in cvCreateGaussianBGModel()
183 CV_CALL( bg_model->foreground = cvCreateImage(cvSize(first_frame->width, in cvCreateGaussianBGModel()
186 CV_CALL( bg_model->storage = cvCreateMemStorage()); in cvCreateGaussianBGModel()
190 CV_CALL( bg_model->g_point[0].g_values = in cvCreateGaussianBGModel()
200 bg_model->g_point[n].g_values = in cvCreateGaussianBGModel()
201 bg_model->g_point[0].g_values + n*params.n_gauss; in cvCreateGaussianBGModel()
202 bg_model->g_point[n].g_values[0].weight = 1; //the first value seen has weight one in cvCreateGaussianBGModel()
203 bg_model->g_point[n].g_values[0].match_sum = 1; in cvCreateGaussianBGModel()
206 bg_model->g_point[n].g_values[0].variance[m] = var_init; in cvCreateGaussianBGModel()
207 … bg_model->g_point[n].g_values[0].mean[m] = (unsigned char)first_frame->imageData[p + m]; in cvCreateGaussianBGModel()
211 bg_model->g_point[n].g_values[k].weight = 0; in cvCreateGaussianBGModel()
212 bg_model->g_point[n].g_values[k].match_sum = 0; in cvCreateGaussianBGModel()
214 bg_model->g_point[n].g_values[k].variance[m] = var_init; in cvCreateGaussianBGModel()
215 bg_model->g_point[n].g_values[k].mean[m] = 0; in cvCreateGaussianBGModel()
221 bg_model->countFrames = 0; in cvCreateGaussianBGModel()
227 CvBGStatModel* base_ptr = (CvBGStatModel*)bg_model; in cvCreateGaussianBGModel()
229 if( bg_model && bg_model->release ) in cvCreateGaussianBGModel()
230 bg_model->release( &base_ptr ); in cvCreateGaussianBGModel()
232 cvFree( &bg_model ); in cvCreateGaussianBGModel()
233 bg_model = 0; in cvCreateGaussianBGModel()
236 return (CvBGStatModel*)bg_model; in cvCreateGaussianBGModel()
252 CvGaussBGModel* bg_model = *_bg_model; in icvReleaseGaussianBGModel() local
253 if( bg_model->g_point ) in icvReleaseGaussianBGModel()
255 cvFree( &bg_model->g_point[0].g_values ); in icvReleaseGaussianBGModel()
256 cvFree( &bg_model->g_point ); in icvReleaseGaussianBGModel()
259 cvReleaseImage( &bg_model->background ); in icvReleaseGaussianBGModel()
260 cvReleaseImage( &bg_model->foreground ); in icvReleaseGaussianBGModel()
261 cvReleaseMemStorage(&bg_model->storage); in icvReleaseGaussianBGModel()
262 memset( bg_model, 0, sizeof(*bg_model) ); in icvReleaseGaussianBGModel()
271 icvUpdateGaussianBGModel( IplImage* curr_frame, CvGaussBGModel* bg_model ) in icvUpdateGaussianBGModel() argument
277 bg_model->countFrames++; in icvUpdateGaussianBGModel()
289 CvGaussBGPoint* g_point = &bg_model->g_point[n]; in icvUpdateGaussianBGModel()
290 const CvGaussBGStatModelParams bg_model_params = bg_model->params; in icvUpdateGaussianBGModel()
298 if( bg_model->countFrames >= bg_model->params.win_size ) in icvUpdateGaussianBGModel()
300 icvUpdateFullWindow( pixel, nChannels, match, g_point, &bg_model->params ); in icvUpdateGaussianBGModel()
312 icvBackgroundTest( nChannels, n, i, j, match, bg_model ); in icvUpdateGaussianBGModel()
319 cvClearMemStorage(bg_model->storage); in icvUpdateGaussianBGModel()
324 …cvFindContours( bg_model->foreground, bg_model->storage, &first_seq, sizeof(CvContour), CV_RETR_LI… in icvUpdateGaussianBGModel()
328 if( cnt->rect.width * cnt->rect.height < bg_model->params.minArea ) in icvUpdateGaussianBGModel()
348 bg_model->foreground_regions = first_seq; in icvUpdateGaussianBGModel()
349 cvZero(bg_model->foreground); in icvUpdateGaussianBGModel()
350 cvDrawContours(bg_model->foreground, first_seq, CV_RGB(0, 0, 255), CV_RGB(0, 0, 255), 10, -1); in icvUpdateGaussianBGModel()
575 …icvBackgroundTest( const int nChannels, int n, int i, int j, int *match, CvGaussBGModel* bg_model ) in icvBackgroundTest() argument
580 CvGaussBGPoint* g_point = bg_model->g_point; in icvBackgroundTest()
583 …bg_model->background->imageData[ bg_model->background->widthStep*i + j*nChannels + m] = (unsigned… in icvBackgroundTest()
585 for( b = 0; b < bg_model->params.n_gauss; b++) in icvBackgroundTest()
590 if( weight_sum > bg_model->params.bg_threshold ) in icvBackgroundTest()
594 bg_model->foreground->imageData[ bg_model->foreground->widthStep*i + j] = pixelValue; in icvBackgroundTest()