类 BackgroundSubtractorGMG
- java.lang.Object
-
- org.opencv.core.Algorithm
-
- org.opencv.video.BackgroundSubtractor
-
- org.opencv.bgsegm.BackgroundSubtractorGMG
-
public class BackgroundSubtractorGMG extends BackgroundSubtractor
基于 CITE: Gold2012 中给出的算法的背景减除模块。接受一系列图像,并返回相同大小的掩码 (8UC1) 图像序列,其中 255 表示前景,0 表示背景。此类实现了一种算法,该算法在“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。
-
-
构造函数摘要
构造函数 修饰符 构造函数 描述 保护BackgroundSubtractorGMG(long addr)
-
方法摘要
所有方法 静态方法 实例方法 具体方法 修饰符和类型 方法 描述 static BackgroundSubtractorGMG__fromPtr__(long addr)voidapply(Mat image, Mat fgmask)计算前景掩码。voidapply(Mat image, Mat fgmask, double learningRate)计算前景掩码。protected voidfinalize()voidgetBackgroundImage(Mat backgroundImage)计算背景图像。doublegetBackgroundPrior()返回每个单独像素作为背景像素的先验概率。doublegetDecisionThreshold()返回决策阈值。doublegetDefaultLearningRate()返回算法的学习率。intgetMaxFeatures()返回直方图中要维护的不同颜色的总数。doublegetMaxVal()返回图像序列中像素采用的最大值。doublegetMinVal()返回图像序列中像素采用的最小值。intgetNumFrames()返回用于初始化背景模型的帧数。intgetQuantizationLevels()返回用于颜色空间量化的参数。intgetSmoothingRadius()返回用于形态学运算的内核半径booleangetUpdateBackgroundModel()返回背景模型更新的状态voidsetBackgroundPrior(double bgprior)设置每个单独像素作为背景像素的先验概率。voidsetDecisionThreshold(double thresh)设置决策阈值。voidsetDefaultLearningRate(double lr)设置算法的学习率。voidsetMaxFeatures(int maxFeatures)设置直方图中要维护的不同颜色的总数。voidsetMaxVal(double val)设置图像序列中像素的最大值。voidsetMinVal(double val)设置图像序列中像素的最小值。voidsetNumFrames(int nframes)设置用于初始化背景模型的帧数。voidsetQuantizationLevels(int nlevels)设置用于色彩空间量化的参数voidsetSmoothingRadius(int radius)设置用于形态学运算的内核半径voidsetUpdateBackgroundModel(boolean update)设置背景模型更新的状态-
从类继承的方法 org.opencv.core.Algorithm
clear, empty, getDefaultName, getNativeObjAddr, save
-
-
-
-
方法详细信息
-
__fromPtr__
public static BackgroundSubtractorGMG __fromPtr__(long addr)
-
apply
public void apply(Mat image, Mat fgmask, double learningRate)
计算前景掩码。- 重写
apply在类中BackgroundSubtractor- 参数
image- CV_8UC(n),CV_8SC(n),CV_16UC(n),CV_16SC(n),CV_32SC(n),CV_32FC(n),CV_64FC(n) 类型的下一个视频帧,其中 n 为 1,2,3,4。fgmask- 作为 8 位二进制图像的输出前景掩码。learningRate- 介于 0 和 1 之间的值,指示背景模型的学习速度。负参数值使算法使用一些自动选择的学习率。 0 表示根本不更新背景模型,1 表示从最后一帧完全重新初始化背景模型。
-
apply
public void apply(Mat image, Mat fgmask)
计算前景掩码。- 重写
apply在类中BackgroundSubtractor- 参数
image- CV_8UC(n),CV_8SC(n),CV_16UC(n),CV_16SC(n),CV_32SC(n),CV_32FC(n),CV_64FC(n) 类型的下一个视频帧,其中 n 为 1,2,3,4。fgmask- 作为 8 位二进制图像的输出前景掩码。 learnt. 负参数值使算法使用一些自动选择的学习率。 0 表示根本不更新背景模型,1 表示从最后一帧完全重新初始化背景模型。
-
getBackgroundImage
public void getBackgroundImage(Mat backgroundImage)
从类复制的描述:BackgroundSubtractor计算背景图像。- 重写
getBackgroundImage在类中BackgroundSubtractor- 参数
backgroundImage- 输出背景图像。 注意:有时背景图像可能非常模糊,因为它包含平均背景统计信息。
-
getMaxFeatures
public int getMaxFeatures()
返回直方图中要维护的不同颜色的总数。- 返回
- 自动生成
-
setMaxFeatures
public void setMaxFeatures(int maxFeatures)
设置直方图中要维护的不同颜色的总数。- 参数
maxFeatures- 自动生成
-
getDefaultLearningRate
public double getDefaultLearningRate()
返回算法的学习率。 它介于 0.0 和 1.0 之间。 它决定了从直方图中“遗忘”特征的速度。- 返回
- 自动生成
-
setDefaultLearningRate
public void setDefaultLearningRate(double lr)
设置算法的学习率。- 参数
lr- 自动生成
-
getNumFrames
public int getNumFrames()
返回用于初始化背景模型的帧数。- 返回
- 自动生成
-
setNumFrames
public void setNumFrames(int nframes)
设置用于初始化背景模型的帧数。- 参数
nframes- 自动生成
-
getQuantizationLevels
public int getQuantizationLevels()
返回用于色彩空间量化的参数。 它是直方图中要使用的每个通道中的离散级别数。- 返回
- 自动生成
-
setQuantizationLevels
public void setQuantizationLevels(int nlevels)
设置用于色彩空间量化的参数- 参数
nlevels- 自动生成
-
getBackgroundPrior
public double getBackgroundPrior()
返回每个单独像素作为背景像素的先验概率。- 返回
- 自动生成
-
setBackgroundPrior
public void setBackgroundPrior(double bgprior)
设置每个单独像素作为背景像素的先验概率。- 参数
bgprior- 自动生成
-
getSmoothingRadius
public int getSmoothingRadius()
返回用于形态学运算的内核半径- 返回
- 自动生成
-
setSmoothingRadius
public void setSmoothingRadius(int radius)
设置用于形态学运算的内核半径- 参数
radius- 自动生成
-
getDecisionThreshold
public double getDecisionThreshold()
返回决策阈值的值。 决策值是高于该值的像素被确定为 FG 的值。- 返回
- 自动生成
-
setDecisionThreshold
public void setDecisionThreshold(double thresh)
设置决策阈值。- 参数
thresh- 自动生成
-
getUpdateBackgroundModel
public boolean getUpdateBackgroundModel()
返回背景模型更新的状态- 返回
- 自动生成
-
setUpdateBackgroundModel
public void setUpdateBackgroundModel(boolean update)
设置背景模型更新的状态- 参数
update- 自动生成
-
getMinVal
public double getMinVal()
返回图像序列中像素采用的最小值。 通常为 0。- 返回
- 自动生成
-
setMinVal
public void setMinVal(double val)
设置图像序列中像素的最小值。- 参数
val- 自动生成
-
getMaxVal
public double getMaxVal()
返回图像序列中像素采用的最大值。 例如 1.0 或 255。- 返回
- 自动生成
-
setMaxVal
public void setMaxVal(double val)
设置图像序列中像素的最大值。- 参数
val- 自动生成
-
finalize
protected void finalize() throws java.lang.Throwable- 重写
finalize在类中BackgroundSubtractor- 抛出
java.lang.Throwable
-
-