Hello, I want to use backgroundsubtractormog with python so my code is this
import cv2 import numpy as np
winname = "GRS"
bgs_mog = cv2.BackgroundSubtractorMOG(500, 6, 0.9, 1)
capture = cv2.VideoCapture(0)
frame = capture.read()[1]
if __name__ == "__main__": while frame != None: #fgmask = bgs_mog.apply(frame) cv2.imshow(winname, frame) c = cv2.waitKey(1) if c == 27: cv2.destroyWindow(winname) break frame = capture.read()[1] cv2.destroyAllWindows()
The output I am having is some mask of binary images. But I want only coloured image of moving objects. I do not know how to implement this mask to get the coloured image of moving objects only. I have referred the opencv2refman doc about this function but I am no getting clear about how to determine the parameters for mog constructor. Can somebody explain how to do this, Plz. Thanks