class cv::BackgroundSubtractor

Overview

Base class for background/foreground segmentation. : Moreā€¦

#include <background_segm.hpp>

class BackgroundSubtractor: public cv::Algorithm
{
public:
    // methods

    virtual
    void
    apply(
        InputArray image,
        OutputArray fgmask,
        double learningRate = -1
        ) = 0;

    virtual
    void
    getBackgroundImage(OutputArray backgroundImage) const = 0;
};

// direct descendants

class BackgroundSubtractorKNN;
class BackgroundSubtractorMOG2;
class BackgroundSubtractorFGD;
class BackgroundSubtractorGMG;
class BackgroundSubtractorMOG;

Inherited Members

public:
    // methods

    virtual
    void
    clear();

    virtual
    bool
    empty() const;

    virtual
    String
    getDefaultName() const;

    virtual
    void
    read(const FileNode& fn);

    virtual
    void
    save(const String& filename) const;

    virtual
    void
    write(FileStorage& fs) const;

    template <typename _Tp>
    static
    Ptr<_Tp>
    load(
        const String& filename,
        const String& objname = String()
        );

    template <typename _Tp>
    static
    Ptr<_Tp>
    loadFromString(
        const String& strModel,
        const String& objname = String()
        );

    template <typename _Tp>
    static
    Ptr<_Tp>
    read(const FileNode& fn);

protected:
    // methods

    void
    writeFormat(FileStorage& fs) const;

Detailed Documentation

Base class for background/foreground segmentation. :

The class is only used to define the common interface for the whole family of background/foreground segmentation algorithms.

Methods

virtual
void
apply(
    InputArray image,
    OutputArray fgmask,
    double learningRate = -1
    ) = 0

Computes a foreground mask.

Parameters:

image Next video frame.
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.
virtual
void
getBackgroundImage(OutputArray backgroundImage) const = 0

Computes a background image.

Sometimes the background image can be very blurry, as it contain the average background statistics.

Parameters:

backgroundImage The output background image.