python-opencv AttributeError:“模块"对象没有属性"createBackgroundSubtractorGMG" [英] python-opencv AttributeError: 'module' object has no attribute 'createBackgroundSubtractorGMG'

查看:189
本文介绍了python-opencv AttributeError:“模块"对象没有属性"createBackgroundSubtractorGMG"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试遵循以下给出的教程: https://opencv-python-tutroals. readthedocs.org/en/latest/py_tutorials/py_video/py_bg_subtraction/py_bg_subtraction.html

I am trying to follow the tutorial given in: https://opencv-python-tutroals.readthedocs.org/en/latest/py_tutorials/py_video/py_bg_subtraction/py_bg_subtraction.html

尝试第三个示例(BackgroundSubtractorGMG)时,出现此错误:

While trying the third example (BackgroundSubtractorGMG) I get this error:

AttributeError: 'module' object has no attribute 'createBackgroundSubtractorGMG'

在前面的示例中,我遇到了相同的错误.但是我遵循了​​这篇文章中给出的说明.在某些方面,相同的技巧在这里不起作用.

I got the same error for the earlier examples. But I followed the explanation given in this post. some how, the same trick did not work here.

如果有人设法解决了这个问题,请帮帮我.

If there is some one who has managed to solve it, please help me out.

使用Python 2.7.3& Ubuntu 12.04上的opencv 2.4.6.1

Using Python 2.7.3 & opencv 2.4.6.1 on Ubuntu 12.04

推荐答案

哦,亲爱的,那是那些故事中的另一个...

oh dear, that's another one of those stories ...

在2.4.6中,您只能使用python中的BackgroundSubtractorMOG. (句号)

with 2.4.6, you only can use BackgroundSubtractorMOG from python. (full stop)

从2.4.8开始,看来 BackgroundSubtractorMOG2问题已得到解决,但BackgroundSubtractorGMG仍然丢失.

as of 2.4.8, it seems, the BackgroundSubtractorMOG2 problem got fixed, but the BackgroundSubtractorGMG is still missing.

在这两个版本中,您都使用一个普通的构造函数来创建一个.

with both versions, you use a plain constructor to create one.

在3.0(主版)中,他们更改了语法,现在您必须调用"createBackgroundSubtractorGMG","createBackgroundSubtractorMOG2"等(这就是您的教程可能引用的内容).但现在您至少可以使用所有3个版本.

in 3.0 (master), they changed the syntax, you now have to call 'createBackgroundSubtractorGMG', 'createBackgroundSubtractorMOG2' and such (that's what your tutorial might be refering to). but now you can use all 3 versions at least.

因此,无论如何,如果要使用BackgroundSubtractorMOG2,则必须更新为2.4.8,如果需要BackgroundSubtractorGMG,则需要3.0(某种程度上是出血边缘",但新界面可以更好地控制所需的参数,恕我直言).

so in any way, if you want to use BackgroundSubtractorMOG2 , you'll have to update to 2.4.8, if you need BackgroundSubtractorGMG, you'll need 3.0 (which is 'bleeding edge' in a way, but the new interface has the far better control over the params needed, imho).

这篇关于python-opencv AttributeError:“模块"对象没有属性"createBackgroundSubtractorGMG"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆