Open DevinBayly opened 2 years ago
all about the moving foreground being removed from the static background
algorithms
gaussian mixture segmentation algo based on this “An improved adaptive background mixture model for real-time tracking with shadow detection” by P. KadewTraKuPong and R. Bowden in 2001.
idea is every pixel is represented by k gaussians and the weights of those gaussians is related to whether the pixel stays mostly the same for a long period of time.
code snippet
import numpy as np
import cv2
cap = cv2.VideoCapture('vtest.avi')
fgbg = cv2.createBackgroundSubtractorMOG()
while(1):
ret, frame = cap.read()
fgmask = fgbg.apply(frame)
cv2.imshow('frame',fgmask)
k = cv2.waitKey(30) & 0xff
if k == 27:
break
cap.release()
cv2.destroyAllWindows()
results
It appears that probably the most effective one of these is the first?
just creating a notebook to try to estimate which of these tends to do better at least visually
https://opencv24-python-tutorials.readthedocs.io/en/latest/py_tutorials/py_video/py_bg_subtraction/py_bg_subtraction.html