python - 如何可视化 h5 格式数据的图像?

标签 python image image-processing hdf5 h5py

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/

相关文章:

python - 全局名称 'RequestContext' 未定义

python - Pygame 移动 Sprite 上的鼠标点击检测

python - 如何在python中将包含数字和字符的向量转换为数值向量?

jquery - blueimp jquery 文件 uploader image_versions 不起作用

python - 构建具有外部依赖项的库 -- pep8

android - Bitmap.Options.inSampleSize 应该如何工作?

Android:将图像转换为字节数组

java - 图像处理 - 我需要找到任何四边形的 4 个角

matlab - 将 RGB 值映射到颜色名称 MATLAB

image-processing - 什么是像素级 softmax 损失?