import cv2
fgbg = cv2.createBackgroundSubtractorMOG()
fgbg1 = cv2.createBackgroundSubtractorGMG()
AttributeError: 'module' object has no attribute 'createBackgroundSubtractorMOG()'
AttributeError: 'module' object has no attribute 'createBackgroundSubtractorMOG()'
Enviroment:
What should I do?
You may be interested in BackgroundSubtractorMOG2, which, although not documented, has a python binding in opencv 3.0.0-beta.
import cv2
fgbg = cv2.createBackgroundSubtractorMOG2(detectShadows=True)
both were moved in 3.0 to the opencv_contrib repo
you will need to build it along with your main opencv repo using cmake. (no prebuild versions of this available) then running the INSTALL project (or make install) will copy your new cv2.pyd to the python folder.
then:
>>> import cv2
>>> cv2.bgsegm.createBackgroundSubtractorMOG # note additional bgsegm namespace !
<built-in function createBackgroundSubtractorMOG>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With