Package org.opencv.bgsegm
Class BackgroundSubtractorCNT
java.lang.Object
org.opencv.core.Algorithm
org.opencv.video.BackgroundSubtractor
org.opencv.bgsegm.BackgroundSubtractorCNT
Background subtraction based on counting.
About as fast as MOG2 on a high end system.
More than twice faster than MOG2 on cheap hardware (benchmarked on Raspberry Pi3).
%Algorithm by Sagi Zeevi ( https://github.com/sagi-z/BackgroundSubtractorCNT )
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic BackgroundSubtractorCNT
__fromPtr__
(long addr) void
Computes a foreground mask.void
Computes a foreground mask.protected void
finalize()
void
getBackgroundImage
(Mat backgroundImage) Computes a background image.boolean
Returns if we're parallelizing the algorithm.int
Returns maximum allowed credit for a pixel in history.int
Returns number of frames with same pixel color to consider stable.boolean
Returns if we're giving a pixel credit for being stable for a long time.void
setIsParallel
(boolean value) Sets if we're parallelizing the algorithm.void
setMaxPixelStability
(int value) Sets the maximum allowed credit for a pixel in history.void
setMinPixelStability
(int value) Sets the number of frames with same pixel color to consider stable.void
setUseHistory
(boolean value) Sets if we're giving a pixel credit for being stable for a long time.Methods inherited from class org.opencv.core.Algorithm
clear, empty, getDefaultName, getNativeObjAddr, save
-
Constructor Details
-
BackgroundSubtractorCNT
protected BackgroundSubtractorCNT(long addr)
-
-
Method Details
-
__fromPtr__
-
apply
Description copied from class:BackgroundSubtractor
Computes a foreground mask.- Overrides:
apply
in classBackgroundSubtractor
- 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
Description copied from class:BackgroundSubtractor
Computes a foreground mask.- Overrides:
apply
in classBackgroundSubtractor
- 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
Description copied from class:BackgroundSubtractor
Computes a background image.- Overrides:
getBackgroundImage
in classBackgroundSubtractor
- Parameters:
backgroundImage
- The output background image. Note: Sometimes the background image can be very blurry, as it contain the average background statistics.
-
getMinPixelStability
public int getMinPixelStability()Returns number of frames with same pixel color to consider stable.- Returns:
- automatically generated
-
setMinPixelStability
public void setMinPixelStability(int value) Sets the number of frames with same pixel color to consider stable.- Parameters:
value
- automatically generated
-
getMaxPixelStability
public int getMaxPixelStability()Returns maximum allowed credit for a pixel in history.- Returns:
- automatically generated
-
setMaxPixelStability
public void setMaxPixelStability(int value) Sets the maximum allowed credit for a pixel in history.- Parameters:
value
- automatically generated
-
getUseHistory
public boolean getUseHistory()Returns if we're giving a pixel credit for being stable for a long time.- Returns:
- automatically generated
-
setUseHistory
public void setUseHistory(boolean value) Sets if we're giving a pixel credit for being stable for a long time.- Parameters:
value
- automatically generated
-
getIsParallel
public boolean getIsParallel()Returns if we're parallelizing the algorithm.- Returns:
- automatically generated
-
setIsParallel
public void setIsParallel(boolean value) Sets if we're parallelizing the algorithm.- Parameters:
value
- automatically generated
-
finalize
- Overrides:
finalize
in classBackgroundSubtractor
- Throws:
Throwable
-