1 | initial version |
My suggestion is different than your code above. You should always apply with learning rate = 0, then if it is a good image, in your terms, then apply again with an actual learning rate.
fgmask = fgbg.apply(img, 0)
# check if should learn from content
perc_black = np.count_nonzero(fgmask) / len(fgmask)
if perc_black <= MOVEMENT_THRESH:
fgmask = fgbg.apply(img, -1)