andrewssobral/bgslibrary
Vedi su GitHubshort learning background first, without updating that
Open
#185 aperta il 27 lug 2020
help wantedquestion
Metriche repository
- Star
- (2270 star)
- Metriche merge PR
- (Nessuna PR mergiata in 30 g)
Descrizione
Hi, thank for your amazing lib first
I have a factory rail that at first moments (first 10 second) i want to learn background and then extract objects on it, for my video multicue was good but i found that it is updating background model in each frame is there any other algorithm that just build bkg model base on first seconds?
I'm using c++, this is process method of multicue, i have commented UpdateModel_Par(); but it made no difference
void MultiCue::process(const cv::Mat &img_input, cv::Mat &img_output, cv::Mat &img_bgmodel)
{
init(img_input, img_output, img_bgmodel);
//--STep1: Background Modeling--//
//IplImage* frame = &IplImage(img_input);
IplImage* frame = new IplImage(img_input);
IplImage* result_image = cvCreateImage(cvGetSize(frame), IPL_DEPTH_8U, 3);
cvSetZero(result_image);
if (g_iFrameCount <= g_iTrainingPeriod) {
BackgroundModeling_Par(frame);
g_iFrameCount++;
}
//--Step2: Background Subtraction--//
else {
g_bForegroundMapEnable = FALSE;
ForegroundExtraction(frame);
UpdateModel_Par();
//Get BGS Results
GetForegroundMap(result_image, NULL);
}
delete frame;
img_background = cv::Mat::zeros(img_input.size(), img_input.type());
img_foreground = cv::cvarrToMat(result_image, TRUE);
cvReleaseImage(&result_image);
#ifndef MEX_COMPILE_FLAG
if (showOutput)
cv::imshow(algorithmName + "_FG", img_foreground);
#endif
img_foreground.copyTo(img_output);
img_background.copyTo(img_bgmodel);
firstTime = false;
}