Mog2 Background Subtraction
Mog2 Background Subtraction node separates the foreground from the background in a video stream. It does so by subtracting the background image from the current frame to reveal the foreground objects.
![](https://docs.lightact.com/~gitbook/image?url=https%3A%2F%2F3312042618-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F9sVaJpWJhPbmscipukhh%252Fuploads%252Fsl7VQQ1WU6x7rTDE6d1T%252FMog2Subtraction.gif%3Falt%3Dmedia%26token%3D7cb2733e-b80c-4cb0-b4d5-b843f860dde8&width=768&dpr=4&quality=100&sign=c4fca34c&sv=1)
Input pins
![](https://docs.lightact.com/~gitbook/image?url=https%3A%2F%2F3312042618-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F9sVaJpWJhPbmscipukhh%252Fuploads%252FCBCw3ApONLu9SmH2EL3j%252Fmog2subtraction.png%3Falt%3Dmedia%26token%3Daac78a19-8889-44d5-8e5c-192839cf5010&width=768&dpr=4&quality=100&sign=e54d74f9&sv=1)
Input: incoming CV Mat with 1, 3, or 4 channels,
History: number of frames used to produce background image.
Learn rate: - if smaller than 0, then the value is ignored and the best Learn rate is chosen automatically. If the value is equal to 0 or larger than 1, the background image will not be updated with the Input image. If it is 1, the background image will always update with the last Input.
Threshold variance: variance parameter MOG2 background subtraction,
Detect Shadows: detects shadows in the incoming stream. If a shadow is detected, then it will be represented with grey color in the output.
Output pins
Output: outgoing CV Mat stream in which foreground objects are represented in white, background objects are in black color, and shadows, if present, are displayed with grey color.
Background: background image from which the current frame is subtracted.
Last updated