Main Content

enviinfo

Read metadata from ENVI header file

Description

example

info= enviinfo(file)reads the metadata from ENVI (Environment for Visualizing Images) header file.

Note

This function requires theImage Processing Toolbox™ Hyperspectral Imaging Library. You can install theImage Processing Toolbox Hyperspectral Imaging Libraryfrom Add-On Explorer. For more information about installing add-ons, seeGet and Manage Add-Ons.

Examples

collapse all

Read an ENVI header file into the workspace.

info = enviinfo('paviau.hdr');

创建一个hypercubeobject using theFilenameof the ENVI header file.

hcube = hypercube(info.Filename)
hcube =具有属性的HyperCube:DataCube:[610×340×103 double]波长:[103×1 double] Double]元数据:[1×1结构]

Read an ENVI header file into the workspace.

info = enviinfo('indian_pines');

Read from the ENVI binary data file by using the metadata from the ENVI header file.

data = multibandread('indian_pines.dat',...[info.Height info.Width info.Bands],...info.DataType,info.HeaderOffset,info.Interleave,info.ByteOrder);

Input Arguments

collapse all

Name of ENVI header file, specified as a string scalar or character vector. An ENVI header file must have the extension.hdr. If you do not specify a file extension, then the function looks for a file with the specified name and the.hdrfile extension.

Data Types:char|string

Output Arguments

collapse all

Information about ENVI data and metadata, returned as a structure array containing at least these fields. If the ENVI header file contains additional fields, then the structure array contains those additional fields as well.

Field Description
Height Height of the image or number of rows in the image, returned as a positive integer.
Width Width of the image or number of columns in the image, returned as a positive integer.
Bands Number of spectral bands, returned as a positive integer.
DataType

Data type of data in the ENVI file, returned as any of these values:

  • "single"

  • "double"

  • "uint8"

  • "uint16"

  • "int16"

  • "uint32"

  • “ int32”

  • "uint64"

  • "int64"

Interleave

Data interleave, returned as any one of these values:

  • "bsq"— Band-sequential

  • "bil"— Band-interleaved-by-line

  • "bip"— Band-interleaved-by-pixel

HeaderOffset Zero-based location of the first element in the image file, returned as a positive integer. The header offset represents the number of bytes from the beginning of the image file to the start of the image data.
ByteOrder Endianness of the data, returned as the string"ieee-le"for little endian or"ieee-be"for big endian.

Version History

Introduced in R2020a