找不到OpenCV2 Python createBackgroundSubtractor模块 [英] OpenCV2 Python createBackgroundSubtractor module not found
问题描述
我正在尝试在Python中使用cv2.createBackgroundSubtractorMOG2()方法.我在Mac和Raspberry Pi上都尝试过,在运行以下代码行时遇到相同的错误:
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 following line of code:
fgbg = cv2.createBackgroundSubtractorMOG2()
The code I am using is taken from https://github.com/abidrahmank/OpenCV2-Python-Tutorials/blob/master/source/py_tutorials/py_video/py_bg_subtraction/py_bg_subtraction.rst
运行此代码时出现以下错误:
I get the following error when running this code:
fgbg = cv2.createBackgroundSubtractorMOG2() AttributeError:模块"对象没有属性"createBackgroundSubtractorMOG2"
fgbg = cv2.createBackgroundSubtractorMOG2() AttributeError: 'module' object has no attribute 'createBackgroundSubtractorMOG2'
我似乎无法使用任何createBackgroundSubtractor方法.
I can't seem to use any of the createBackgroundSubtractor methods.
在过去的一天里,我一直在尝试解决此问题,但由于在Python上对cv2的支持有限,因此我在网上搜索时没有运气.
I have been trying to solve this for the past day, but I have had no luck searching online, as there is limited support for cv2 on Python.
预先感谢
推荐答案
将创建的...替换为
fgbg = cv2.BackgroundSubtractorMOG()
fgbg = cv2.BackgroundSubtractorMOG()
这篇关于找不到OpenCV2 Python createBackgroundSubtractor模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!