import numpy as np
import cv2


#Used to remove background and check difference between frames to detect motion
#cap = cv2.VideoCapture(0)
cap = cv2.VideoCapture('people-walking.mp4')
fgbg = cv2.createBackgroundSubtractorMOG2()

while True:
    ret, frame = cap.read()

    fgmask = fgbg.apply(frame)

    cv2.imshow('original', frame)
    cv2.imshow('mask', fgmask)

    k = cv2.waitKey(30) & 0xff
    if k == 27:
        break

cap.release()
cv2.destroyAllWindows()

b9034169debc929dde0d444e3b2e10617dcdc18f
<mask token>

<mask token>
while True:
    ret, frame = cap.read()
    fgmask = fgbg.apply(frame)
    cv2.imshow('original', frame)
    cv2.imshow('mask', fgmask)
    k = cv2.waitKey(30) & 255
    if k == 27:
        break
cap.release()
cv2.destroyAllWindows()

<mask token>
cap = cv2.VideoCapture('people-walking.mp4')
fgbg = cv2.createBackgroundSubtractorMOG2()
while True:
    ret, frame = cap.read()
    fgmask = fgbg.apply(frame)
    cv2.imshow('original', frame)
    cv2.imshow('mask', fgmask)
    k = cv2.waitKey(30) & 255
    if k == 27:
        break
cap.release()
cv2.destroyAllWindows()

import numpy as np
import cv2
cap = cv2.VideoCapture('people-walking.mp4')
fgbg = cv2.createBackgroundSubtractorMOG2()
while True:
    ret, frame = cap.read()
    fgmask = fgbg.apply(frame)
    cv2.imshow('original', frame)
    cv2.imshow('mask', fgmask)
    k = cv2.waitKey(30) & 255
    if k == 27:
        break
cap.release()
cv2.destroyAllWindows()

import numpy as np
import cv2


#Used to remove background and check difference between frames to detect motion
#cap = cv2.VideoCapture(0)
cap = cv2.VideoCapture('people-walking.mp4')
fgbg = cv2.createBackgroundSubtractorMOG2()

while True:
    ret, frame = cap.read()

    fgmask = fgbg.apply(frame)

    cv2.imshow('original', frame)
    cv2.imshow('mask', fgmask)

    k = cv2.waitKey(30) & 0xff
    if k == 27:
        break

cap.release()
cv2.destroyAllWindows()
