🤖 AIによる機械翻訳(非公式) — これは OpenCV 5.0.0 公式リファレンス(英語)を AI (Claude) で自動翻訳したものです。訳に誤りを含む場合があります。正確な情報は 公式英語版(原文) を参照してください。
Package org.opencv.video
クラス BackgroundSubtractorMOG2
- java.lang.Object
-
- org.opencv.core.Algorithm
-
- org.opencv.video.BackgroundSubtractor
-
- org.opencv.video.BackgroundSubtractorMOG2
public class BackgroundSubtractorMOG2 extends BackgroundSubtractor
ガウス混合モデルに基づく背景/前景セグメンテーション(領域分割)アルゴリズム。このクラスは CITE: Zivkovic2004 および CITE: Zivkovic2006 で説明されているガウス混合モデルによる背景差分を実装している。
-
-
コンストラクタの要約
コンストラクタ Modifier Constructor Description protectedBackgroundSubtractorMOG2​(long addr)
-
メソッドの要約
すべてのメソッド 静的メソッド インスタンスメソッド 具象メソッド Modifier and Type Method Description static BackgroundSubtractorMOG2__fromPtr__​(long addr)voidapply​(Mat image, Mat fgmask)Computes a foreground mask.voidapply​(Mat image, Mat fgmask, double learningRate)Computes a foreground mask.voidapply​(Mat image, Mat knownForegroundMask, Mat fgmask)Computes a foreground mask and skips known foreground in evaluation.voidapply​(Mat image, Mat knownForegroundMask, Mat fgmask, double learningRate)Computes a foreground mask and skips known foreground in evaluation.doublegetBackgroundRatio()Returns the "background ratio" parameter of the algorithm If a foreground pixel keeps semi-constant value for about backgroundRatio\*history frames, it's considered background and added to the model as a center of a new component.doublegetComplexityReductionThreshold()Returns the complexity reduction threshold This parameter defines the number of samples needed to accept to prove the component exists.booleangetDetectShadows()Returns the shadow detection flag If true, the algorithm detects shadows and marks them.intgetHistory()Returns the number of last frames that affect the background modelintgetNMixtures()Returns the number of gaussian components in the background modeldoublegetShadowThreshold()Returns the shadow threshold A shadow is detected if pixel is a darker version of the background.intgetShadowValue()Returns the shadow value Shadow value is the value used to mark shadows in the foreground mask.doublegetVarInit()Returns the initial variance of each gaussian componentdoublegetVarMax()doublegetVarMin()doublegetVarThreshold()Returns the variance threshold for the pixel-model match The main threshold on the squared Mahalanobis distance to decide if the sample is well described by the background model or not.doublegetVarThresholdGen()Returns the variance threshold for the pixel-model match used for new mixture component generation Threshold for the squared Mahalanobis distance that helps decide when a sample is close to the existing components (corresponds to Tg in the paper).voidsetBackgroundRatio​(double ratio)Sets the "background ratio" parameter of the algorithmvoidsetComplexityReductionThreshold​(double ct)Sets the complexity reduction thresholdvoidsetDetectShadows​(boolean detectShadows)Enables or disables shadow detectionvoidsetHistory​(int history)Sets the number of last frames that affect the background modelvoidsetNMixtures​(int nmixtures)Sets the number of gaussian components in the background model.voidsetShadowThreshold​(double threshold)Sets the shadow thresholdvoidsetShadowValue​(int value)Sets the shadow valuevoidsetVarInit​(double varInit)Sets the initial variance of each gaussian componentvoidsetVarMax​(double varMax)voidsetVarMin​(double varMin)voidsetVarThreshold​(double varThreshold)Sets the variance threshold for the pixel-model matchvoidsetVarThresholdGen​(double varThresholdGen)Sets the variance threshold for the pixel-model match used for new mixture component generation-
クラス org.opencv.video.BackgroundSubtractor から継承したメソッド
getBackgroundImage
-
クラス org.opencv.core.Algorithm から継承されたメソッド
clear, empty, getDefaultName, getNativeObjAddr, save
-
-
-
-
メソッドの詳細
-
__fromPtr__
public static BackgroundSubtractorMOG2 __fromPtr__​(long addr)
-
getHistory
public int getHistory()
Returns the number of last frames that affect the background model- 戻り値:
- 自動生成
-
setHistory
public void setHistory​(int history)
Sets the number of last frames that affect the background model- 引数:
history- 自動生成
-
getNMixtures
public int getNMixtures()
Returns the number of gaussian components in the background model- 戻り値:
- 自動生成
-
setNMixtures
public void setNMixtures​(int nmixtures)
Sets the number of gaussian components in the background model. The model needs to be reinitialized to reserve memory.- 引数:
nmixtures- 自動生成
-
getBackgroundRatio
public double getBackgroundRatio()
Returns the "background ratio" parameter of the algorithm If a foreground pixel keeps semi-constant value for about backgroundRatio\*history frames, it's considered background and added to the model as a center of a new component. It corresponds to TB parameter in the paper.- 戻り値:
- 自動生成
-
setBackgroundRatio
public void setBackgroundRatio​(double ratio)
Sets the "background ratio" parameter of the algorithm- 引数:
ratio- 自動生成
-
getVarThreshold
public double getVarThreshold()
Returns the variance threshold for the pixel-model match The main threshold on the squared Mahalanobis distance to decide if the sample is well described by the background model or not. Related to Cthr from the paper.- 戻り値:
- 自動生成
-
setVarThreshold
public void setVarThreshold​(double varThreshold)
Sets the variance threshold for the pixel-model match- 引数:
varThreshold- 自動生成
-
getVarThresholdGen
public double getVarThresholdGen()
Returns the variance threshold for the pixel-model match used for new mixture component generation Threshold for the squared Mahalanobis distance that helps decide when a sample is close to the existing components (corresponds to Tg in the paper). If a pixel is not close to any component, it is considered foreground or added as a new component. 3 sigma => Tg=3\*3=9 is default. A smaller Tg value generates more components. A higher Tg value may result in a small number of components but they can grow too large.- 戻り値:
- 自動生成
-
setVarThresholdGen
public void setVarThresholdGen​(double varThresholdGen)
Sets the variance threshold for the pixel-model match used for new mixture component generation- 引数:
varThresholdGen- 自動生成
-
getVarInit
public double getVarInit()
Returns the initial variance of each gaussian component- 戻り値:
- 自動生成
-
setVarInit
public void setVarInit​(double varInit)
Sets the initial variance of each gaussian component- 引数:
varInit- 自動生成
-
getVarMin
public double getVarMin()
-
setVarMin
public void setVarMin​(double varMin)
-
getVarMax
public double getVarMax()
-
setVarMax
public void setVarMax​(double varMax)
-
getComplexityReductionThreshold
public double getComplexityReductionThreshold()
Returns the complexity reduction threshold This parameter defines the number of samples needed to accept to prove the component exists. CT=0.05 is a default value for all the samples. By setting CT=0 you get an algorithm very similar to the standard Stauffer&Grimson algorithm.- 戻り値:
- 自動生成
-
setComplexityReductionThreshold
public void setComplexityReductionThreshold​(double ct)
Sets the complexity reduction threshold- 引数:
ct- 自動生成
-
getDetectShadows
public boolean getDetectShadows()
Returns the shadow detection flag If true, the algorithm detects shadows and marks them. See createBackgroundSubtractorMOG2 for details.- 戻り値:
- 自動生成
-
setDetectShadows
public void setDetectShadows​(boolean detectShadows)
Enables or disables shadow detection- 引数:
detectShadows- 自動生成
-
getShadowValue
public int getShadowValue()
Returns the shadow value Shadow value is the value used to mark shadows in the foreground mask. Default value is 127. Value 0 in the mask always means background, 255 means foreground.- 戻り値:
- 自動生成
-
setShadowValue
public void setShadowValue​(int value)
Sets the shadow value- 引数:
value- 自動生成
-
getShadowThreshold
public double getShadowThreshold()
Returns the shadow threshold A shadow is detected if pixel is a darker version of the background. The shadow threshold (Tau in the paper) is a threshold defining how much darker the shadow can be. Tau= 0.5 means that if a pixel is more than twice darker then it is not shadow. See Prati, Mikic, Trivedi and Cucchiara, Detecting Moving Shadows...*, IEEE PAMI,2003.- 戻り値:
- 自動生成
-
setShadowThreshold
public void setShadowThreshold​(double threshold)
Sets the shadow threshold- 引数:
threshold- 自動生成
-
apply
public void apply​(Mat image, Mat fgmask, double learningRate)
Computes a foreground mask.- オーバーライド:
apply(クラスBackgroundSubtractor内)- 引数:
image- 次の動画フレーム。浮動小数点フレームはスケーリングなしで使用され、\([0,255]\) の範囲内である必要がある。fgmask- 8ビットのバイナリ画像としての出力前景マスク。learningRate- 背景モデルがどれだけ速く学習されるかを示す0から1の間の値。負のパラメータ値を指定すると、アルゴリズムは自動的に選択された学習率を使用する。0 は背景モデルがまったく更新されないことを意味し、1 は背景モデルが最後のフレームから完全に再初期化されることを意味する。
-
apply
public void apply​(Mat image, Mat fgmask)
Computes a foreground mask.- オーバーライド:
apply(クラスBackgroundSubtractor内)- 引数:
image- 次の動画フレーム。浮動小数点フレームはスケーリングなしで使用され、\([0,255]\) の範囲内である必要がある。fgmask- 8ビットのバイナリ画像としての出力前景マスク。学習される。負のパラメータ値を指定すると、アルゴリズムは自動的に選択された学習率を使用する。0 は背景モデルがまったく更新されないことを意味し、1 は背景モデルが最後のフレームから完全に再初期化されることを意味する。
-
apply
public void apply​(Mat image, Mat knownForegroundMask, Mat fgmask, double learningRate)
Computes a foreground mask and skips known foreground in evaluation.- オーバーライド:
apply(クラスBackgroundSubtractor内)- 引数:
image- 次の動画フレーム。浮動小数点フレームはスケーリングなしで使用され、\([0,255]\) の範囲内である必要がある。fgmask- 8ビットのバイナリ画像としての出力前景マスク。knownForegroundMask- 既知の前景を入力するためのマスク。モデルが特定のピクセルを無視できるようにする。learningRate- 背景モデルがどれだけ速く学習されるかを示す0から1の間の値。負のパラメータ値を指定すると、アルゴリズムは自動的に選択された学習率を使用する。0 は背景モデルがまったく更新されないことを意味し、1 は背景モデルが最後のフレームから完全に再初期化されることを意味する。
-
apply
public void apply​(Mat image, Mat knownForegroundMask, Mat fgmask)
Computes a foreground mask and skips known foreground in evaluation.- オーバーライド:
apply(クラスBackgroundSubtractor内)- 引数:
image- 次の動画フレーム。浮動小数点フレームはスケーリングなしで使用され、\([0,255]\) の範囲内である必要がある。fgmask- 8ビットのバイナリ画像としての出力前景マスク。knownForegroundMask- すでに既知の前景を入力するためのマスク。モデルが学習済みのピクセルを無視できるようにする。負の引数値を指定すると、アルゴリズムは自動的に選択した学習率を使用する。0 は背景モデルをまったく更新しないことを意味し、1 は背景モデルを直前のフレームから完全に再初期化することを意味する。
-
-