How BackgroundSubtractorMOG in Java works?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

How BackgroundSubtractorMOG in Java works?

This post has NOT been accepted by the mailing list yet.
I'm using the BackgroundSubtractorMOG to get some background model from sequence of images. Could someone explain me, how this class works??

And to compute the foreground mask, it uses the method apply, right?
How this method works?? I'm completely not understand how this method can compute the foreground mask.

I've implemented in Java, here's my code:

VideoCapture capture = new VideoCapture(pathToVideo);
BackgroundSubtractorMOG backgroundSubtractorMOG = new BackgroundSubtractorMOG();
Mat camImage = new Mat();

if (capture.isOpened()) {
    while (true) {;
        if (!sequenceFrame.empty()) {

            Mat fgMask = new Mat();
            backgroundSubtractorMOG.apply(camImage, fgMask, 0.13);

            Mat output = new Mat();


Thank you so much for any answer..