| OpenCV 5.0.0alpha Open Source Computer Vision

Loading...
Searching...
No Matches
Public Member Functions | List of all members
cv::bgsegm::BackgroundSubtractorGMG Class Referenceabstract
Improved Background-Foreground Segmentation Methods

Background Subtractor module based on the algorithm given in [107] . More...

`#include <opencv2/bgsegm.hpp>`

Collaboration diagram for cv::bgsegm::BackgroundSubtractorGMG:

## Public Member Functions
virtual void | apply (InputArray image, OutputArray fgmask, double learningRate=-1) CV_OVERRIDE=0
| Computes a foreground mask.
virtual void | getBackgroundImage (OutputArray backgroundImage) const CV_OVERRIDE=0
| Computes a background image.
virtual double | getBackgroundPrior () const =0
| Returns the prior probability that each individual pixel is a background pixel.
virtual double | getDecisionThreshold () const =0
| Returns the value of decision threshold.
virtual double | getDefaultLearningRate () const =0
| Returns the learning rate of the algorithm.
virtual int | getMaxFeatures () const =0
| Returns total number of distinct colors to maintain in histogram.
virtual double | getMaxVal () const =0
| Returns the maximum value taken on by pixels in image sequence. e.g. 1.0 or 255.
virtual double | getMinVal () const =0
| Returns the minimum value taken on by pixels in image sequence. Usually 0.
virtual int | getNumFrames () const =0
| Returns the number of frames used to initialize background model.
virtual int | getQuantizationLevels () const =0
| Returns the parameter used for quantization of color-space.
virtual int | getSmoothingRadius () const =0
| Returns the kernel radius used for morphological operations.
virtual bool | getUpdateBackgroundModel () const =0
| Returns the status of background model update.
virtual void | setBackgroundPrior (double bgprior)=0
| Sets the prior probability that each individual pixel is a background pixel.
virtual void | setDecisionThreshold (double thresh)=0
| Sets the value of decision threshold.
virtual void | setDefaultLearningRate (double lr)=0
| Sets the learning rate of the algorithm.
virtual void | setMaxFeatures (int maxFeatures)=0
| Sets total number of distinct colors to maintain in histogram.
virtual void | setMaxVal (double val)=0
| Sets the maximum value taken on by pixels in image sequence.
virtual void | setMinVal (double val)=0
| Sets the minimum value taken on by pixels in image sequence.
virtual void | setNumFrames (int nframes)=0
| Sets the number of frames used to initialize background model.
virtual void | setQuantizationLevels (int nlevels)=0
| Sets the parameter used for quantization of color-space.
virtual void | setSmoothingRadius (int radius)=0
| Sets the kernel radius used for morphological operations.
virtual void | setUpdateBackgroundModel (bool update)=0
| Sets the status of background model update.
Public Member Functions inherited from cv::BackgroundSubtractor
Public Member Functions inherited from cv::Algorithm
| Algorithm ()
virtual | ~Algorithm ()
virtual void | clear ()
| Clears the algorithm state.
virtual bool | empty () const
| Returns true if the Algorithm is empty (e.g. in the very beginning or after unsuccessful read.
virtual String | getDefaultName () const
virtual void | read (const FileNode &fn)
| Reads algorithm parameters from a file storage.
virtual void | save (const String &filename) const
virtual void | write (FileStorage &fs) const
| Stores algorithm parameters in a file storage.
void | write (FileStorage &fs, const String &name) const

## Additional Inherited Members
Static Public Member Functions inherited from cv::Algorithm
template<typename _Tp >
static Ptr< _Tp > | load (const String &filename, const String &objname=String())
| Loads algorithm from the file.
template<typename _Tp >
static Ptr< _Tp > | loadFromString (const String &strModel, const String &objname=String())
| Loads algorithm from a String.
template<typename _Tp >
static Ptr< _Tp > | read (const FileNode &fn)
| Reads algorithm from the file node.
Protected Member Functions inherited from cv::Algorithm
void | writeFormat (FileStorage &fs) const

## Detailed Description

Background Subtractor module based on the algorithm given in [107] .

Takes a series of images and returns a sequence of mask (8UC1) images of the same size, where 255 indicates Foreground and 0 represents Background. This class implements an algorithm described in "Visual Tracking of Human Visitors under Variable-Lighting Conditions for a Responsive Audio Art Installation," A. Godbehere, A. Matsukawa, K. Goldberg, American Control Conference, Montreal, June 2012.

## Member Function Documentation

## ◆ apply()

virtual void cv::bgsegm::BackgroundSubtractorGMG::apply | ( | InputArray | image,
|  | OutputArray | fgmask,
|  | double | learningRate = -1 )
| pure virtual

Python:
| cv.bgsegm.BackgroundSubtractorGMG.apply( | image[, fgmask[, learningRate]] | ) -> | fgmask

Computes a foreground mask.

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.

Implements cv::BackgroundSubtractor.

## ◆ getBackgroundImage()

virtual void cv::bgsegm::BackgroundSubtractorGMG::getBackgroundImage | ( | OutputArray | backgroundImage | ) | const
| pure virtual

Python:
| cv.bgsegm.BackgroundSubtractorGMG.getBackgroundImage( | [, backgroundImage] | ) -> | backgroundImage

Computes a background image.

Parameters

  backgroundImage | The output background image.

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

Implements cv::BackgroundSubtractor.

## ◆ getBackgroundPrior()

virtual double cv::bgsegm::BackgroundSubtractorGMG::getBackgroundPrior | ( |  | ) | const
| pure virtual

Python:
| cv.bgsegm.BackgroundSubtractorGMG.getBackgroundPrior( |  | ) -> | retval

Returns the prior probability that each individual pixel is a background pixel.

## ◆ getDecisionThreshold()

virtual double cv::bgsegm::BackgroundSubtractorGMG::getDecisionThreshold | ( |  | ) | const
| pure virtual

Python:
| cv.bgsegm.BackgroundSubtractorGMG.getDecisionThreshold( |  | ) -> | retval

Returns the value of decision threshold.

Decision value is the value above which pixel is determined to be FG.

## ◆ getDefaultLearningRate()

virtual double cv::bgsegm::BackgroundSubtractorGMG::getDefaultLearningRate | ( |  | ) | const
| pure virtual

Python:
| cv.bgsegm.BackgroundSubtractorGMG.getDefaultLearningRate( |  | ) -> | retval

Returns the learning rate of the algorithm.

It lies between 0.0 and 1.0. It determines how quickly features are "forgotten" from histograms.

## ◆ getMaxFeatures()

virtual int cv::bgsegm::BackgroundSubtractorGMG::getMaxFeatures | ( |  | ) | const
| pure virtual

Python:
| cv.bgsegm.BackgroundSubtractorGMG.getMaxFeatures( |  | ) -> | retval

Returns total number of distinct colors to maintain in histogram.

## ◆ getMaxVal()

virtual double cv::bgsegm::BackgroundSubtractorGMG::getMaxVal | ( |  | ) | const
| pure virtual

Python:
| cv.bgsegm.BackgroundSubtractorGMG.getMaxVal( |  | ) -> | retval

Returns the maximum value taken on by pixels in image sequence. e.g. 1.0 or 255.

## ◆ getMinVal()

virtual double cv::bgsegm::BackgroundSubtractorGMG::getMinVal | ( |  | ) | const
| pure virtual

Python:
| cv.bgsegm.BackgroundSubtractorGMG.getMinVal( |  | ) -> | retval

Returns the minimum value taken on by pixels in image sequence. Usually 0.

## ◆ getNumFrames()

virtual int cv::bgsegm::BackgroundSubtractorGMG::getNumFrames | ( |  | ) | const
| pure virtual

Python:
| cv.bgsegm.BackgroundSubtractorGMG.getNumFrames( |  | ) -> | retval

Returns the number of frames used to initialize background model.

## ◆ getQuantizationLevels()

virtual int cv::bgsegm::BackgroundSubtractorGMG::getQuantizationLevels | ( |  | ) | const
| pure virtual

Python:
| cv.bgsegm.BackgroundSubtractorGMG.getQuantizationLevels( |  | ) -> | retval

Returns the parameter used for quantization of color-space.

It is the number of discrete levels in each channel to be used in histograms.

## ◆ getSmoothingRadius()

virtual int cv::bgsegm::BackgroundSubtractorGMG::getSmoothingRadius | ( |  | ) | const
| pure virtual

Python:
| cv.bgsegm.BackgroundSubtractorGMG.getSmoothingRadius( |  | ) -> | retval

Returns the kernel radius used for morphological operations.

## ◆ getUpdateBackgroundModel()

virtual bool cv::bgsegm::BackgroundSubtractorGMG::getUpdateBackgroundModel | ( |  | ) | const
| pure virtual

Python:
| cv.bgsegm.BackgroundSubtractorGMG.getUpdateBackgroundModel( |  | ) -> | retval

Returns the status of background model update.

## ◆ setBackgroundPrior()

virtual void cv::bgsegm::BackgroundSubtractorGMG::setBackgroundPrior | ( | double | bgprior | ) |
| pure virtual

Python:
| cv.bgsegm.BackgroundSubtractorGMG.setBackgroundPrior( | bgprior | ) -> | None

Sets the prior probability that each individual pixel is a background pixel.

## ◆ setDecisionThreshold()

virtual void cv::bgsegm::BackgroundSubtractorGMG::setDecisionThreshold | ( | double | thresh | ) |
| pure virtual

Python:
| cv.bgsegm.BackgroundSubtractorGMG.setDecisionThreshold( | thresh | ) -> | None

Sets the value of decision threshold.

## ◆ setDefaultLearningRate()

virtual void cv::bgsegm::BackgroundSubtractorGMG::setDefaultLearningRate | ( | double | lr | ) |
| pure virtual

Python:
| cv.bgsegm.BackgroundSubtractorGMG.setDefaultLearningRate( | lr | ) -> | None

Sets the learning rate of the algorithm.

## ◆ setMaxFeatures()

virtual void cv::bgsegm::BackgroundSubtractorGMG::setMaxFeatures | ( | int | maxFeatures | ) |
| pure virtual

Python:
| cv.bgsegm.BackgroundSubtractorGMG.setMaxFeatures( | maxFeatures | ) -> | None

Sets total number of distinct colors to maintain in histogram.

## ◆ setMaxVal()

virtual void cv::bgsegm::BackgroundSubtractorGMG::setMaxVal | ( | double | val | ) |
| pure virtual

Python:
| cv.bgsegm.BackgroundSubtractorGMG.setMaxVal( | val | ) -> | None

Sets the maximum value taken on by pixels in image sequence.

## ◆ setMinVal()

virtual void cv::bgsegm::BackgroundSubtractorGMG::setMinVal | ( | double | val | ) |
| pure virtual

Python:
| cv.bgsegm.BackgroundSubtractorGMG.setMinVal( | val | ) -> | None

Sets the minimum value taken on by pixels in image sequence.

## ◆ setNumFrames()

virtual void cv::bgsegm::BackgroundSubtractorGMG::setNumFrames | ( | int | nframes | ) |
| pure virtual

Python:
| cv.bgsegm.BackgroundSubtractorGMG.setNumFrames( | nframes | ) -> | None

Sets the number of frames used to initialize background model.

## ◆ setQuantizationLevels()

virtual void cv::bgsegm::BackgroundSubtractorGMG::setQuantizationLevels | ( | int | nlevels | ) |
| pure virtual

Python:
| cv.bgsegm.BackgroundSubtractorGMG.setQuantizationLevels( | nlevels | ) -> | None

Sets the parameter used for quantization of color-space.

## ◆ setSmoothingRadius()

virtual void cv::bgsegm::BackgroundSubtractorGMG::setSmoothingRadius | ( | int | radius | ) |
| pure virtual

Python:
| cv.bgsegm.BackgroundSubtractorGMG.setSmoothingRadius( | radius | ) -> | None

Sets the kernel radius used for morphological operations.

## ◆ setUpdateBackgroundModel()

virtual void cv::bgsegm::BackgroundSubtractorGMG::setUpdateBackgroundModel | ( | bool | update | ) |
| pure virtual

Python:
| cv.bgsegm.BackgroundSubtractorGMG.setUpdateBackgroundModel( | update | ) -> | None

Sets the status of background model update.

The documentation for this class was generated from the following file:

- opencv2/bgsegm.hpp