Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

BackGroundSubractor is usually used for video because it learns gradually through time what belongs to background and what doesn't. If you have few background images with different illumination than image with people in foreground, there will all belong to foreground when BackGroundSubractorMOG is run. You should have in mind that GMM Background Subractor is not illumination invariant. You could ran some background images just before new people show up, so you want have false alarms. Also keep in mind that BackGroundSubractorMOG needs some time to adopt background, you can manage it with learning ratio (Alpha):

static const int defaultHistory2 = 500;

Larger defaultHistory2 -> slower it updates to background. But i advise you to use set of images with difference not larger than few seconds, couse you will have a lot of noise in your foreground mask.

BackGroundSubractor is usually used for video because it learns gradually through time what belongs to background and what doesn't. If you have few background images with different illumination than image with people in foreground, there they will all belong to foreground when BackGroundSubractorMOG is run. You should have in mind that GMM Background Subractor is not illumination invariant. You could ran some background images just before new people show up, so you want have false alarms. Also keep in mind that BackGroundSubractorMOG needs some time to adopt background, you can manage it with learning ratio (Alpha):

static const int defaultHistory2 = 500;

Larger defaultHistory2 -> slower it updates to background. But i advise you to use set of images with difference not larger than few seconds, couse you will have a lot of noise in your foreground mask.

BackGroundSubractor is usually used for video because it learns gradually through time what belongs to background and what doesn't. If you have few background images with different illumination than image with people in foreground, on which you want to detect people, they will all belong to foreground when BackGroundSubractorMOG is run. You should have in mind that GMM Background Subractor is not illumination invariant. You could ran some background images just before new people show up, so you want have false alarms. Also keep in mind that BackGroundSubractorMOG needs some time to adopt background, you can manage it with learning ratio (Alpha):

static const int defaultHistory2 = 500;

Larger defaultHistory2 -> slower it updates to background. But i advise you to use set of images with difference not larger than few seconds, couse you will have a lot of noise in your foreground mask.

BackGroundSubractor is usually used for video because it learns gradually through time what belongs to background and what doesn't. If you have few background images with different illumination than image on which you want to detect people, they will all belong to foreground when BackGroundSubractorMOG is run. You should have in mind that GMM Background Subractor is not illumination invariant. You could ran some background images just before new people show up, so you want have false alarms. Also keep in mind that BackGroundSubractorMOG needs some time to adopt background, you can manage it with learning ratio (Alpha):

static const int defaultHistory2 = 500;

Larger defaultHistory2 -> slower it updates to background. But i advise you to use set of images with difference not larger than few seconds, couse you will have a lot of noise in your foreground mask.

To sum it up:

  1. I wouldn't recommend it.
  2. Yes, you have to teach your BackGroundSubractorMOG what is background first.
  3. You can remember BackGroundSubractorMOG paramethers and run it again, but your foreground mask will be noisy and if illumination is different you could end up with lot of false alarms.