我在python中有这个代码片段:
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"buut 的 github 存储库中复制并添加到其中的项目,我已经将三个文件统一为一个
假设您正在使用以下项目:
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