【发布时间】:2016-10-17 10:39:26
【问题描述】:
我想在 python 中迭代一个图像。 到目前为止,这是我的代码:
def imageIteration(greyValueImage):
for (x,y), pixel in np.ndenumerate(greyValueImage):
vals = greyValueImage[x, y]
print(vals)
这里的问题是我得到以下异常:
for (x,y), pixel in np.ndenumerate(greyValueImage):
ValueError: too many values to unpack
现在我的问题是解决这个问题的最快方法是什么? 我真的需要将图像分成几个和平,但是采取这一步如何在不尝试的情况下获得必要循环的计数?
感谢您的意见
附: im = Image.open(args["image"]) im_grey = im.convert('LA') # 转换为灰度
【问题讨论】:
标签: python image loops for-loop iteration