python - Python 找不到来自 cv2 的 bgsegm
问题描述
我正在尝试测试一些背景减法方法(按照教程),但 Python 无法找到它们。
使用 Windows 和 Anaconda。我确保通过 conda升级opencv并运行
点安装 opencv-contrib-python
另一个相关问题中建议的命令。
不过,我明白了:
(tracx) C:\Users\USER>python
Python 3.5.4 |Anaconda, Inc.| (default, Nov 8 2017, 14:34:30) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> fgbg = cv2.createBackgroundSubtractorMOG()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 'cv2.cv2' has no attribute 'createBackgroundSubtractorMOG'
>>> quit()
解决方案
你一定在寻找f = cv2.bgsegm.createBackgroundSubtractorMOG()
。
该功能当前位于bgseg
(背景分割)模块中。
推荐阅读
- vba - 关闭使用 OpenSharedItem 打开的电子邮件?
- java - 如何使用 Spring-boot 为控制器方法编写 JUnit 5 测试用例
- python - numpy.empty([]) 创建的数组的性质
- ruby-on-rails - 无法验证/创建输出存储桶
- ssis - SSIS的源/目标助手中的excel表中附加和不附加美元符号的文件有什么区别?
- pysimplegui - 有没有办法让 GUI 停留在全屏游戏之上?
- javascript - 反转成新数组 VS 原地反转
- javascript - 无法使用 VueJs 从 Mysql DB 获取数据
- python - 如何通过另一个值在多维字典中查找一个值?
- java - 包 com.datastax.driver.core 不存在