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.
我有一个代表灰度图像的二维numpy.array对象。dtype=uint16如何将其保存到 PNG 文件中,然后将其读回,获得相同的数组?
numpy.array
dtype=uint16
scikit-image 使这很容易:
from skimage.io import imread, imsave import numpy as np x = np.ones((100, 100), dtype=np.uint16) imsave('test.png', x) y = imread('test.png') (x == y).all() # True