I am using the following piece of code to do background subtraction.
import numpy as np
import cv2
cap = cv2.VideoCapture('Desktop/001.avi')
fgbg = cv2.BackgroundSubtractorMOG(100, 5, 0.3, 0.1)
while(1):
ret, frame = cap.read()
fgmask = fgbg.apply(frame)
cv2.imshow('frame',frame)
cv2.imshow('fgmask',fgmask)
k = cv2.waitKey(1) & 0xff
if k == 27:
break
cap.release()
v2.destroyAllWindows()
And the test video is from http://www.ee.cuhk.edu.hk/~xgwang/MITtraffic.html I choose the first video, the background mask has 4 most pedestrians and 1 car, Could any body tell me how to fix this or why this happened? Where are the host pedestrians from ? Thanks