Ask Your Question

Revision history [back]

It depends on the version of python you are using. The opencv library has createBackgroundSubtractorMOG and createBackgroundSubtractorMOG2 for different versions of python. After python3, the createBackgroundSubtractorMOG is not available. So you have to use createBackgroundSubtractorMOG2.

So use cv2.createBackgroundSubtractorMOG2() if you are using Python3 else cv2.createBackgroundSubtractorMOG() if Python2