OpenCV 4.12.0
開源計算機視覺
載入中...
搜尋中...
無匹配項
cv::BackgroundSubtractorMOG2 類參考abstract

基於高斯混合模型的背景/前景分割演算法更多...

#include <opencv2/video/background_segm.hpp>

cv::BackgroundSubtractorMOG2 協作圖

公共成員函式

virtual void apply (InputArray image, OutputArray fgmask, double learningRate=-1) CV_OVERRIDE=0
 計算前景掩碼。
 
virtual double getBackgroundRatio () const =0
 返回演算法的“背景比率”引數。
 
virtual double getComplexityReductionThreshold () const =0
 返回複雜度降低閾值。
 
virtual bool getDetectShadows () const =0
 返回陰影檢測標誌。
 
virtual int getHistory () const =0
 返回影響背景模型的最後幀數。
 
virtual int getNMixtures () const =0
 返回背景模型中的高斯分量數量。
 
virtual double getShadowThreshold () const =0
 返回陰影閾值。
 
virtual int getShadowValue () const =0
 返回陰影值。
 
virtual double getVarInit () const =0
 返回每個高斯分量的初始方差。
 
virtual double getVarMax () const =0
 
virtual double getVarMin () const =0
 
virtual double getVarThreshold () const =0
 返回畫素-模型匹配的方差閾值。
 
virtual double getVarThresholdGen () const =0
 返回用於生成新混合分量的畫素模型匹配的方差閾值。
 
virtual void setBackgroundRatio (double ratio)=0
 設定演算法的“背景比率”引數。
 
virtual void setComplexityReductionThreshold (double ct)=0
 設定複雜度降低閾值。
 
virtual void setDetectShadows (bool detectShadows)=0
 啟用或停用陰影檢測。
 
virtual void setHistory (int history)=0
 設定影響背景模型的最後幀數。
 
virtual void setNMixtures (int nmixtures)=0
 設定背景模型中的高斯分量數量。
 
virtual void setShadowThreshold (double threshold)=0
 設定陰影閾值。
 
virtual void setShadowValue (int value)=0
 設定陰影值。
 
virtual void setVarInit (double varInit)=0
 設定每個高斯分量的初始方差。
 
virtual void setVarMax (double varMax)=0
 
virtual void setVarMin (double varMin)=0
 
virtual void setVarThreshold (double varThreshold)=0
 設定畫素-模型匹配的方差閾值。
 
virtual void setVarThresholdGen (double varThresholdGen)=0
 設定用於生成新混合分量的畫素模型匹配的方差閾值。
 
- 從 cv::BackgroundSubtractor 繼承的公共成員函式
virtual void getBackgroundImage (OutputArray backgroundImage) const =0
 計算背景影像。
 
- 從 cv::Algorithm 繼承的公共成員函式
 Algorithm ()
 
virtual ~Algorithm ()
 
virtual void clear ()
 清除演算法狀態。
 
virtual bool empty () const
 如果演算法為空(例如,在最開始或讀取失敗後),則返回 true。
 
virtual String getDefaultName () const
 
virtual void read (const FileNode &fn)
 從檔案儲存中讀取演算法引數。
 
virtual void save (const String &filename) const
 
void write (const Ptr< FileStorage > &fs, const String &name=String()) const
 
virtual void write (FileStorage &fs) const
 將演算法引數儲存到檔案儲存中。
 
void write (FileStorage &fs, const String &name) const
 

附加繼承成員

- 從 cv::Algorithm 繼承的靜態公共成員函式
template<typename _Tp >
static Ptr< _Tpload (const String &filename, const String &objname=String())
 從檔案中載入演算法。
 
template<typename _Tp >
static Ptr< _TploadFromString (const String &strModel, const String &objname=String())
 從字串載入演算法。
 
template<typename _Tp >
static Ptr< _Tpread (const FileNode &fn)
 從檔案節點讀取演算法。
 
- 從 cv::Algorithm 繼承的保護成員函式
void writeFormat (FileStorage &fs) const
 

詳細描述

基於高斯混合模型的背景/前景分割演算法

該類實現了 [327][326] 中描述的高斯混合模型背景減除演算法。

成員函式文件

◆ apply()

virtual void cv::BackgroundSubtractorMOG2::apply ( InputArray image,
OutputArray fgmask,
double learningRate = -1 )
純虛擬函式
Python
cv.BackgroundSubtractorMOG2.apply(image[, fgmask[, learningRate]]) -> fgmask

計算前景掩碼。

引數
image下一影片幀。浮點幀將不進行縮放使用,其範圍應在 \([0,255]\) 內。
fgmask作為 8 位二進位制影像的輸出前景掩碼。
learningRate介於 0 和 1 之間的值,表示背景模型的學習速度。負引數值表示演算法將使用自動選擇的學習率。0 表示背景模型完全不更新,1 表示背景模型從最後一幀完全重新初始化。

實現 cv::BackgroundSubtractor

◆ getBackgroundRatio()

virtual double cv::BackgroundSubtractorMOG2::getBackgroundRatio ( ) const
純虛擬函式
Python
cv.BackgroundSubtractorMOG2.getBackgroundRatio() -> retval

返回演算法的“背景比率”引數。

如果一個前景畫素在約 backgroundRatio*history 幀內保持半恆定值,則被視為背景,並作為新分量的中心新增到模型中。這對應於論文中的 TB 引數。

◆ getComplexityReductionThreshold()

virtual double cv::BackgroundSubtractorMOG2::getComplexityReductionThreshold ( ) const
純虛擬函式
Python
cv.BackgroundSubtractorMOG2.getComplexityReductionThreshold() -> retval

返回複雜度降低閾值。

此引數定義了接受以證明元件存在的樣本數量。CT=0.05 是所有樣本的預設值。透過設定 CT=0,您將獲得與標準 Stauffer&Grimson 演算法非常相似的演算法。

◆ getDetectShadows()

virtual bool cv::BackgroundSubtractorMOG2::getDetectShadows ( ) const
純虛擬函式
Python
cv.BackgroundSubtractorMOG2.getDetectShadows() -> retval

返回陰影檢測標誌。

如果為 true,演算法將檢測並標記陰影。詳情請參見 createBackgroundSubtractorMOG2。

◆ getHistory()

virtual int cv::BackgroundSubtractorMOG2::getHistory ( ) const
純虛擬函式
Python
cv.BackgroundSubtractorMOG2.getHistory() -> retval

返回影響背景模型的最後幀數。

◆ getNMixtures()

virtual int cv::BackgroundSubtractorMOG2::getNMixtures ( ) const
純虛擬函式
Python
cv.BackgroundSubtractorMOG2.getNMixtures() -> retval

返回背景模型中的高斯分量數量。

◆ getShadowThreshold()

virtual double cv::BackgroundSubtractorMOG2::getShadowThreshold ( ) const
純虛擬函式
Python
cv.BackgroundSubtractorMOG2.getShadowThreshold() -> retval

返回陰影閾值。

如果畫素是背景的較暗版本,則檢測到陰影。陰影閾值(論文中的 Tau)定義了陰影可以有多暗。Tau=0.5 意味著如果畫素暗度超過兩倍,則它不是陰影。參見 Prati, Mikic, Trivedi and Cucchiara, Detecting Moving Shadows...*, IEEE PAMI,2003。

◆ getShadowValue()

virtual int cv::BackgroundSubtractorMOG2::getShadowValue ( ) const
純虛擬函式
Python
cv.BackgroundSubtractorMOG2.getShadowValue() -> retval

返回陰影值。

陰影值是用於在前景掩碼中標記陰影的值。預設值為 127。掩碼中的值 0 始終表示背景,255 表示前景。

◆ getVarInit()

virtual double cv::BackgroundSubtractorMOG2::getVarInit ( ) const
純虛擬函式
Python
cv.BackgroundSubtractorMOG2.getVarInit() -> retval

返回每個高斯分量的初始方差。

◆ getVarMax()

virtual double cv::BackgroundSubtractorMOG2::getVarMax ( ) const
純虛擬函式
Python
cv.BackgroundSubtractorMOG2.getVarMax() -> retval

◆ getVarMin()

virtual double cv::BackgroundSubtractorMOG2::getVarMin ( ) const
純虛擬函式
Python
cv.BackgroundSubtractorMOG2.getVarMin() -> retval

◆ getVarThreshold()

virtual double cv::BackgroundSubtractorMOG2::getVarThreshold ( ) const
純虛擬函式
Python
cv.BackgroundSubtractorMOG2.getVarThreshold() -> retval

返回畫素-模型匹配的方差閾值。

馬氏距離平方上的主要閾值,用於判斷樣本是否被背景模型很好地描述。與論文中的 Cthr 相關。

◆ getVarThresholdGen()

virtual double cv::BackgroundSubtractorMOG2::getVarThresholdGen ( ) const
純虛擬函式
Python
cv.BackgroundSubtractorMOG2.getVarThresholdGen() -> retval

返回用於生成新混合分量的畫素模型匹配的方差閾值。

馬氏距離平方的閾值,用於幫助判斷樣本何時接近現有分量(對應於論文中的 Tg)。如果畫素不接近任何分量,則被視為前景或作為新分量新增。3 sigma => Tg=3*3=9 是預設值。較小的 Tg 值會生成更多分量。較大的 Tg 值可能會導致分量數量較少,但它們可能變得太大。

◆ setBackgroundRatio()

virtual void cv::BackgroundSubtractorMOG2::setBackgroundRatio ( double ratio)
純虛擬函式
Python
cv.BackgroundSubtractorMOG2.setBackgroundRatio(ratio) ->

設定演算法的“背景比率”引數。

◆ setComplexityReductionThreshold()

virtual void cv::BackgroundSubtractorMOG2::setComplexityReductionThreshold ( double ct)
純虛擬函式
Python
cv.BackgroundSubtractorMOG2.setComplexityReductionThreshold(ct) ->

設定複雜度降低閾值。

◆ setDetectShadows()

virtual void cv::BackgroundSubtractorMOG2::setDetectShadows ( bool detectShadows)
純虛擬函式
Python
cv.BackgroundSubtractorMOG2.setDetectShadows(detectShadows) ->

啟用或停用陰影檢測。

◆ setHistory()

virtual void cv::BackgroundSubtractorMOG2::setHistory ( int history)
純虛擬函式
Python
cv.BackgroundSubtractorMOG2.setHistory(history) ->

設定影響背景模型的最後幀數。

◆ setNMixtures()

virtual void cv::BackgroundSubtractorMOG2::setNMixtures ( int nmixtures)
純虛擬函式
Python
cv.BackgroundSubtractorMOG2.setNMixtures(nmixtures) ->

設定背景模型中的高斯分量數量。

需要重新初始化模型以保留記憶體。

◆ setShadowThreshold()

virtual void cv::BackgroundSubtractorMOG2::setShadowThreshold ( double RANSAC引數。它是點到畫素中對極線的最大距離,超過此距離的點將被視為異常值,不用於計算最終的基本矩陣。它可以設定為1-3左右,具體取決於點定位的精度、影像解析度和影像噪聲。)
純虛擬函式
Python
cv.BackgroundSubtractorMOG2.setShadowThreshold(RANSAC引數。它是點到畫素中對極線的最大距離,超過此距離的點將被視為異常值,不用於計算最終的基本矩陣。它可以設定為1-3左右,具體取決於點定位的精度、影像解析度和影像噪聲。) ->

設定陰影閾值。

◆ setShadowValue()

virtual void cv::BackgroundSubtractorMOG2::setShadowValue ( int )
純虛擬函式
Python
cv.BackgroundSubtractorMOG2.setShadowValue() ->

設定陰影值。

◆ setVarInit()

virtual void cv::BackgroundSubtractorMOG2::setVarInit ( double varInit)
純虛擬函式
Python
cv.BackgroundSubtractorMOG2.setVarInit(varInit) ->

設定每個高斯分量的初始方差。

◆ setVarMax()

virtual void cv::BackgroundSubtractorMOG2::setVarMax ( double varMax)
純虛擬函式
Python
cv.BackgroundSubtractorMOG2.setVarMax(varMax) ->

◆ setVarMin()

virtual void cv::BackgroundSubtractorMOG2::setVarMin ( double varMin)
純虛擬函式
Python
cv.BackgroundSubtractorMOG2.setVarMin(varMin) ->

◆ setVarThreshold()

virtual void cv::BackgroundSubtractorMOG2::setVarThreshold ( double varThreshold)
純虛擬函式
Python
cv.BackgroundSubtractorMOG2.setVarThreshold(varThreshold) ->

設定畫素-模型匹配的方差閾值。

◆ setVarThresholdGen()

virtual void cv::BackgroundSubtractorMOG2::setVarThresholdGen ( double varThresholdGen)
純虛擬函式
Python
cv.BackgroundSubtractorMOG2.setVarThresholdGen(varThresholdGen) ->

設定用於生成新混合分量的畫素模型匹配的方差閾值。


此類的文件生成自以下檔案