I am currently running this to acquire images:
fgbg = cv2.createBackgroundSubtractorMOG2(detectShadows=False)
for frame in cam.camera.capture_continuous(raw, format="rgb", use_video_port=True):
img = frame.array
fgmask = fgbg.apply(img)
How can I go about choosing which images to save in the history
. I want to build a function where I can select which images are background. For example initially the first 50 input images will be used as history for the subtractor and after that all masks that have under a certain threshold of difference will be used as history too. I basically do not want the new foreground images to be used as history is that possible?