[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

short learning background first, without updating that #185

Open
SabraHashemi opened this issue Jul 27, 2020 · 2 comments
Open

short learning background first, without updating that #185

SabraHashemi opened this issue Jul 27, 2020 · 2 comments

Comments

@SabraHashemi
Copy link
SabraHashemi commented Jul 27, 2020

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;
}
@andrewssobral
Copy link
Owner

Hi @sabrabano0 sorry for my delayed feedback to you.
Yes, as you cited in #186 , the MultiLayerBGS algorithm is the best choice for you because it generates and saves a background model file during the learning step. Unfortunately, the others one produce an in-memory model with no option to save it as file.

@SabraHashemi
Copy link
Author

yes multicue had problem in free memory and takes o long time
but multilayer FPS is 2 :(
how should i detect objects on convey belt? @andrewssobral andrewssobral

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants