Class BackgroundSubtractorMOG


  • public class BackgroundSubtractorMOG
    extends BackgroundSubtractor
    Gaussian Mixture-based Background/Foreground Segmentation Algorithm. The class implements the algorithm described in CITE: KB2001 .
    • Constructor Detail

      • BackgroundSubtractorMOG

        protected BackgroundSubtractorMOG​(long addr)
    • Method Detail

      • apply

        public void apply​(Mat image,
                          Mat fgmask,
                          double learningRate)
        Computes a foreground mask.
        Overrides:
        apply in class BackgroundSubtractor
        Parameters:
        image - Next video frame of type CV_8UC(n),CV_8SC(n),CV_16UC(n),CV_16SC(n),CV_32SC(n),CV_32FC(n),CV_64FC(n), where n is 1,2,3,4.
        fgmask - The output foreground mask as an 8-bit binary image.
        learningRate - The value between 0 and 1 that indicates how fast the background model is learnt. Negative parameter value makes the algorithm to use some automatically chosen learning rate. 0 means that the background model is not updated at all, 1 means that the background model is completely reinitialized from the last frame.
      • apply

        public void apply​(Mat image,
                          Mat fgmask)
        Computes a foreground mask.
        Overrides:
        apply in class BackgroundSubtractor
        Parameters:
        image - Next video frame of type CV_8UC(n),CV_8SC(n),CV_16UC(n),CV_16SC(n),CV_32SC(n),CV_32FC(n),CV_64FC(n), where n is 1,2,3,4.
        fgmask - The output foreground mask as an 8-bit binary image. learnt. Negative parameter value makes the algorithm to use some automatically chosen learning rate. 0 means that the background model is not updated at all, 1 means that the background model is completely reinitialized from the last frame.
      • apply

        public void apply​(Mat image,
                          Mat knownForegroundMask,
                          Mat fgmask,
                          double learningRate)
        Computes a foreground mask and skips known foreground in evaluation.
        Overrides:
        apply in class BackgroundSubtractor
        Parameters:
        image - Next video frame of type CV_8UC(n),CV_8SC(n),CV_16UC(n),CV_16SC(n),CV_32SC(n),CV_32FC(n),CV_64FC(n), where n is 1,2,3,4.
        fgmask - The output foreground mask as an 8-bit binary image.
        knownForegroundMask - The mask for inputting already known foreground, allows model to ignore learning known pixels.
        learningRate - The value between 0 and 1 that indicates how fast the background model is learnt. Negative parameter value makes the algorithm to use some automatically chosen learning rate. 0 means that the background model is not updated at all, 1 means that the background model is completely reinitialized from the last frame.
      • apply

        public void apply​(Mat image,
                          Mat knownForegroundMask,
                          Mat fgmask)
        Computes a foreground mask and skips known foreground in evaluation.
        Overrides:
        apply in class BackgroundSubtractor
        Parameters:
        image - Next video frame of type CV_8UC(n),CV_8SC(n),CV_16UC(n),CV_16SC(n),CV_32SC(n),CV_32FC(n),CV_64FC(n), where n is 1,2,3,4.
        fgmask - The output foreground mask as an 8-bit binary image.
        knownForegroundMask - The mask for inputting already known foreground, allows model to ignore learning known pixels. learnt. Negative parameter value makes the algorithm to use some automatically chosen learning rate. 0 means that the background model is not updated at all, 1 means that the background model is completely reinitialized from the last frame.
      • getHistory

        public int getHistory()
      • setHistory

        public void setHistory​(int nframes)
      • getNMixtures

        public int getNMixtures()
      • setNMixtures

        public void setNMixtures​(int nmix)
      • getBackgroundRatio

        public double getBackgroundRatio()
      • setBackgroundRatio

        public void setBackgroundRatio​(double backgroundRatio)
      • getNoiseSigma

        public double getNoiseSigma()
      • setNoiseSigma

        public void setNoiseSigma​(double noiseSigma)
      • finalize

        protected void finalize()
                         throws java.lang.Throwable
        Overrides:
        finalize in class BackgroundSubtractor
        Throws:
        java.lang.Throwable