【发布时间】:2020-06-05 22:30:15
【问题描述】:
我有 6 张不同的图片。我想将它们一起存储在一个 numpy 数组中。那可能吗?如果是,我该怎么做?
from PIL import Image
from matplotlib import image
import matplotlib.pyplot as plt
from os import listdir
from numpy import asarray
import numpy as np
for i in range(1,6):
image=Image.open(str(i)+'.jpg')
image=image.resize((100,100))
temp=asarray(image)
print(np.append(X_train,temp,axis=0))
这会引发以下异常:
ValueError:所有输入数组的维数必须相同
【问题讨论】:
标签: python-3.x image-processing python-imaging-library numpy-ndarray