【问题标题】:AttributeError: 'cv2.FileStorage' object has no attribute 'getNode'AttributeError:“cv2.FileStorage”对象没有属性“getNode”
【发布时间】:2018-02-20 13:10:49
【问题描述】:

我正在我的Ubuntu14.04机器上的PycharmCE2017中构建一个基于python3.4和opencv3.0的项目。运行下面的代码时,

import cv2

if __name__ == "__main__":
    savePath = "/home/s/Desktop/Imgcov/"
    filename = savePath + "depth.xml"
    fs = cv2.FileStorage(filename, cv2.FILE_STORAGE_READ)
    matrix = fs.getNode("data") 

我得到错误:

AttributeError: 'cv2.FileStorage' object has no attribute 'getNode'

我该如何解决这个问题?任何提示表示赞赏。

【问题讨论】:

  • 试试fs['data'],或查看here
  • 不幸的是,错误变成了TypeError: 'cv2.FileStorage' object is not subscriptable。我会查看您发布的链接。谢谢,@Miki
  • AttributeError 已随着 opencv-python 软件包的安装而被删除。但是,运行示例代码后,matrix 为空。

标签: python-3.x opencv3.0


【解决方案1】:

我猜你需要使用 3.2 以上版本的 opencv-python。

【讨论】:

    猜你喜欢
    • 2017-11-22
    • 2019-07-25
    • 2017-11-21
    • 2021-02-17
    • 2019-11-13
    • 2018-11-13
    • 2019-05-28
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多