How do I save a video with background subtraction applied
.
import numpy as np
import cv2 as cv
cap = cv.VideoCapture('testvid.mov')
fgbg = cv.createBackgroundSubtractorMOG2()
while(1):
ret, frame = cap.read()
fgmask = fgbg.apply(frame)
cv.imshow('frame',fgmask)
k = cv.waitKey(30) & 0xff
if k == 27:
break
cap.release()
cv.destroyAllWindows()
I have this working, however cant figure out how to save it once BGS has been applied?