0

我想可视化以 .h5 格式存储的 3D 图像。我想知道如何在 python 中使用它。对于输入,我的文件名是 '***.h5'

4

1 回答 1

2

在 python 中加载文件,如:

import h5py
filename = 'file.hdf5'
f = h5py.File(filename, 'r')

然后检查它的类型。如果它是一个 numpy 数组,您可以使用 OpenCV 或 Pillow。如果不是,只需使用f = np.array(f).

开放式简历:

cv.imshow('text', f)
cv.waitKey(0)
cv.destroyAllWindows()

枕头:

Image.fromarray(f).show()
于 2018-11-07T09:14:31.003 回答