Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要使用 python 读取一组图像并将其放入矩阵中,以便能够执行 PCA(原理成分分析)。所有图像都在一个文件夹中。
使用numpy和PIL:
numpy
PIL
import numpy as np import Image dirname = '...' [np.asarray(Image.open(os.path.join(dirname, fn))) for fn in os.listdir(dirname)]