I am trying to use cv2.createBackgroundSubtractorMOG2 () method in Python. I have tried both on my Mac and on my Raspberry Pi, and get the same error when running the follow
>>> import cv2
>>> cv2.__version__
>>> 3.2.0
>>>bg_model = cv2.BackgroundSubtractorMOG2(0, 10)
Traceback (most recent call last):
File "/home/manivannan/pythonexamle/opencv/Samples/hand-gesture-recognition-opencv/HandRecognition.py", line 233, in
bg_model = cv2.BackgroundSubtractorMOG2(0, 10)
AttributeError: 'module' object has no attribute 'BackgroundSubtractorMOG2'
>>>bg_model = cv2.createBackgroundSubtractorMOG2(0, 10)
Use createBackgroundSubtractorMOG2 instead of BackgroundSubtractorMOG2 It's Working