backgroundsubtractorcv
Applies a background subtractor and computes a foreground mask for image handle.
Syntax
R = backgroundsubtractorcv(handle...)
R = backgroundsubtractorcv(handle, type, rate)
Inputs
- handle
- Handle of an image or video frame.
- type
- Background subtractor type. Default value is 'MOG2'. Valid values are:
- KNN
- Uses K-nearest neighbors background subtraction algorithm.
- MOG2
- Uses Gaussian Mixture-based algorithm. This is the default option.
- rate
- Optional learning rate. Default value is -1, indicating that the algorithm will chose an automatic learning rate.
Outputs
- R
- Handle of the 8-bit single channel output image.
Example
Apply the MOG2 background subtractor:
handle = imreadcv('image1.jpg');
mask = backgroundsubtractorcv(handle, 'MOG2', -1);