Is it possible to open hdf5 (.h5) images in MATLAB?
46 次查看(过去 30 天)
显示 更早的评论
I am trying to open a .h5 image in MATLAB but IMREAD does not support this format.
采纳的回答
MathWorks Support Team
2009-11-2
An image ingestion tool is not available for hdf5 images.
A possible workaround is to use HDF5INFO and HDF5READ functions to query the hdf5 database and extract image data. This can be done by loading the file into the MATLAB workspace with the HDF5INFO function then manually searching for the image data inside the resulting structure. Then query the database for the data with the HDF5READ function. Image data can then been processed or plotted with the IMAGESC function.
%%Read an hdf5 image and plot in MATLAB
%%Load the hdf5 file in MATLAB
info = hdf5info('hdf5_test.h5');
%%Find the addres of the image
% The operation must be done manually and the position inside the structure
% could be variable depending on the structure itself
address_data_1 = info.GroupHierarchy.Groups(3).Datasets(5).Name;
%%Query the database
image1 =hdf5read('hdf5_test.h5',address_data_1);
%%Plot the image
figure
imagesc(image1)
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 HDF5 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!