import h5py
f = h5py.File('the_file.h5', 'r')
one_data = f['key']
print(one_data.shape)
print(one_data.dtype)
print(one_data)
我使用上面的代码打印信息。 打印结果为:
(320, 320, 3)
uint8
<HDF5 dataset "1458552843.750": shape (320, 320, 3), type "|u1">
最佳答案
import cv2
import numpy as np
import h5py
f = h5py.File('the_file.h5', 'r')
dset = f['key']
data = np.array(dset[:,:,:])
file = 'test.jpg'
cv2.imwrite(file, data)
关于python - 如何可视化 h5 格式数据的图像?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41627147/