【问题标题】:I am getting the error: np.append(Image()) TypeError: __init__() missing 1 required positional argument: 'imgtype'我收到错误:np.append(Image()) TypeError: __init__() missing 1 required positional argument: 'imgtype'
【发布时间】:2019-12-17 13:45:34
【问题描述】:

我在python中有这个代码sn-p:

for i in range(N_SLICES):
    np.append(Image())
if frame is not None:
    t1 = time.clock()
    SlicePart(frame, Images, N_SLICES)
    for i in range(N_SLICES):
        print (i)

我收到此错误:

np.append(Image())
TypeError: __init__() missing 1 required positional argument: 'imgtype'

之前有一个错误!但是我发现了一个类似的,但是我该如何解决它呢

这是我复制并添加到名为“vision race”的github存储库中的一个项目,但我已将三个文件统一为一个

【问题讨论】:

  • Image() 与其文档不匹配。但是np.append的使用也是错误的。

标签: python image numpy processing


【解决方案1】:

假设您正在使用以下项目:

https://github.com/CRM-UAM/VisionRace/

我可以看到Image 类是在Image.py 内部定义的:

https://github.com/CRM-UAM/VisionRace/blob/master/Repo/Image.py

确保您从那里导入 Image,而不是从其他地方导入,例如 tkinter

from Image import Image

更新:您似乎正在从 tkinter 导入 Image

我可以看到imgtype是构造函数中的必需参数

https://kite.com/python/docs/tkinter.Image

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-11-03
    • 2020-09-27
    • 2018-05-19
    • 2022-01-06
    • 2016-05-09
    • 2023-03-28
    相关资源
    最近更新 更多