【发布时间】:2017-09-04 02:20:39
【问题描述】:
我正在尝试在 python 中调整 .tif 图像的大小。 但是当我尝试运行代码时,出现以下错误:
AttributeError: 'NoneType' object has no attribute 'shape'
下面是sn-p的代码:
# Open de beeldfile
image = cv2.imread(fullinname)
# Bepaal afmetingen en aantal kleurkanalen
width = image.shape[1]
height = image.shape[0]
colors = image.shape[2]
print ("{} pixels breed".format(width))
print ("{} pixels hoog".format(height))
print ("{} kleur kanalen".format(colors))
img = cv2.resize(image, (512, 512))
有人知道怎么解决吗?
【问题讨论】:
-
不,我的文件中只有 1 个 cv2.imread
-
如果发布的 5 个答案都没有解决您的问题,那么 any of these 可以提供帮助吗?这是一个相当普遍的问题,我相信一些研究会产生解决方案。 (见How much research effort is expected of Stack Overflow users?)
-
你能调试
fullinname吗?