INFO = READ_ENVIHDR('HDR_FILE') reads the ASCII ENVI-generated image header file and returns all the information in a structure of parameters. Usefull in combination with MATLAB multibandread function capable of reading ENVI binary files.
The file is a result of frustration with other ENVI header readers found on MATLAB File Exchange, which I could never get to work properly.
Output:
* Info - struct with fields provided in the ENVI file. ENVI header format requires the following fields (if other fields are provided then they will also be included.
* samples - number of samples in the image (columns)
* lines - number of lines in the image (rows)
* bands - number of bands in the image. If all 3 dimensions are provided than info.size will be created holding [info.lines info.samples info.bands]
* data_type - data type of the image stored as an integer in 1-15 range. If provided than info.format will be created holding string with Matlab's type name.
* interleave - file band interleave type; either bip, bsq, or bil are possible
* byte_order - byte order (0 is little endian [least significant byte first], 1 is big endian [most significant byte first]). If provided than info.machine will be created holding either 'ieee-le' or 'ieee-be' string.
Example 1:
>> info = read_envihdr('my_envi_image.hdr')
info =
description: [1x101 char]
samples: 658
lines: 749
bands: 3
size: [749 658 3]
header_offset: 0
file_type: 'ENVI Standard'
data_type: 4
format : 'single'
interleave: 'bsq'
sensor_type: 'Unknown'
byte_order: 0
map_info: [1x1 struct]
projection_info: [1x102 char]
wavelength_units: 'Unknown'
pixel_size: [1x1 struct]
band_names: [1x154 char]
Example 2:
>> info = read_envihdr('my_envi_image.hsi');
>> Z = multibandread('my_envi_image.hsi', info.size, [info.format '=>double'], info.header_offset, info.interleave, info.machine);
引用格式
Jaroslaw Tuszynski (2024). read_envihdr (https://www.mathworks.com/matlabcentral/fileexchange/38500-read_envihdr), MATLAB Central File Exchange. 检索时间: .
MATLAB 版本兼容性
平台兼容性
Windows macOS Linux类别
标签
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!版本 | 已发布 | 发行说明 | |
---|---|---|---|
1.0.0.0 |