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.
* 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.
>> info = read_envihdr('my_envi_image.hdr')
description: [1x101 char]
size: [749 658 3]
file_type: 'ENVI Standard'
format : 'single'
map_info: [1x1 struct]
projection_info: [1x102 char]
pixel_size: [1x1 struct]
band_names: [1x154 char]
>> 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);
Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.