Package org.opencv.video
Class BackgroundSubtractor
java.lang.Object
org.opencv.core.Algorithm
org.opencv.video.BackgroundSubtractor
- Direct Known Subclasses:
BackgroundSubtractorKNN,BackgroundSubtractorMOG2
public class BackgroundSubtractor extends Algorithm
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.
-
Field Summary
-
Constructor Summary
Constructors Modifier Constructor Description protectedBackgroundSubtractor(long addr) -
Method Summary
Modifier and Type Method Description static BackgroundSubtractor__fromPtr__(long addr)voidapply(Mat image, Mat fgmask)Computes a foreground mask.voidapply(Mat image, Mat fgmask, double learningRate)Computes a foreground mask.protected voidfinalize()voidgetBackgroundImage(Mat backgroundImage)Computes a background image.Methods inherited from class org.opencv.core.Algorithm
clear, empty, getDefaultName, getNativeObjAddr, save
-
Constructor Details
-
Method Details
-
__fromPtr__
-
apply
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.
-
apply
Computes a foreground mask.- Parameters:
image- Next video frame.fgmask- The output foreground mask as an 8-bit binary image. 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.
-
getBackgroundImage
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.
-
finalize
-