Main Content

hypercube

Read hyperspectral data

    Description

    The hypercube object represents the hyperspectral data cube and its related properties. Create hypercube objects using the imhypercube or geohypercube function. Use the hypercube object functions to assign new pixel values, crop data, select or remove specific hyperspectral bands, generate a colored image, and write hyperspectral data to the ENVI (environment for visualizing images) file format.

    The hypercube object supports hyperspectral data acquired by these satellites.

    • Earth Observing-1 (EO-1) Hyperion

    • Airborne Visible/Infrared Imaging Spectrometer (AVIRIS)

    Note

    This object requires the Hyperspectral Imaging Library for Image Processing Toolbox™. You can install the Hyperspectral Imaging Library for Image Processing Toolbox from Add-On Explorer. For more information about installing add-ons, see Get and Manage Add-Ons.

    The Hyperspectral Imaging Library for Image Processing Toolbox requires desktop MATLAB®, as MATLAB Online™ and MATLAB Mobile™ do not support the library.

    Creation

    • Read hyperspectral data without geospatial information using the imhypercube function.

    • Read hyperspectral data with geospatial information using the geohypercube function.

      Note

      The geohypercube function requires a Mapping Toolbox™ license.

    Properties

    expand all

    Since R2025a

    This property is read-only.

    Dimensions and data type of the hyperspectral data cube, represented as a string scalar.

    Data Types: string

    This property is read-only.

    Center wavelength value of each spectral band, represented as a C-element vector. C is the spectral dimension, defined as the number of spectral bands, of the input hyperspectral data.

    Data Types: double

    This property is read-only.

    Metadata of the hyperspectral data, represented as a structure. The fields of the structure contain the properties of the hyperspectral image and spectral information. The set of fields in the structure depends on the individual image and file format. This table lists the common fields.

    FieldDescription
    HeightHeight of the image, in pixels, or number of rows in the data cube, represented as a positive integer.
    WidthWidth of the image, in pixels, or number of columns in the data cube, represented as a positive integer.
    BandsNumber of spectral bands comprising the data cube, represented as a positive integer
    DataType

    Data type of the hyperspectral data, represented as one of these values.

    • "single"

    • "double"

    • "uint8"

    • "uint16"

    • "int16"

    • "uint32"

    • "int32"

    • "uint64"

    • "int64"

    Interleave

    Data interleave, represented as 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, represented 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. The default value is 0.

    ByteOrderEndianness of the data, represented as "ieee-le" for little endian or "ieee-be" for big endian.
    WavelengthUnits

    Units for the wavelengths of the spectral bands, represented as one of these strings.

    • "Nanometers" — All wavelengths are in nanometers (greater than 200 and less than 100000).

    • "Micrometers" — All wavelengths are in micrometers (greater than 0.2 and less than 100).

    • "" — Wavelengths are neither all in nanometers, nor all in micrometers.

    RasterReference

    Geospatial information of the hyperspectral image, represented as a structure.

    • If you create a hypercube object with geospatial information using the geohypercube function, the RasterReference field contains the geospatial information. When you perform operations such as cropping on the hypercube object, thehypercube updates the geospatial information.

    • If you create a hypercube object without geospatial information using the imhypercube function, the RasterReference field is empty.

    Data Types: struct

    This property is read-only.

    Size of the data blocks, represented as a 2-element vector of positive integers. The first and second elements of the vector correspond to the number of rows and columns in each block, respectively. Loading the hyperspectral data cube using blocks enables you to load smaller regions of large data sets without running out of memory.

    • A small value for BlockSize reduces the memory usage of the function at the cost of increased execution time.

    • A large value for BlockSize reduces execution time at the cost of increased memory usage.

    You can set this property using the blockSize name-value argument of the imhypercube or geohypercube function.

    • The number of rows in each block must be less than or equal to the number of rows in the hyperspectral image. If you specify a value greater than the number of rows in the hyperspectral image, BlockSize uses the number of rows in the hyperspectral image, instead. If the image contains more than 1024 rows, the default value for the number of rows in each block is 1024.

    • The number of columns in each block must be less than or equal to the number of columns in the hyperspectral image. If you specify a value greater than the number of columns in the hyperspectral image, BlockSize uses the number of columns in the hyperspectral image, instead. If the image contains more than 1024 columns, the default value for the number of columns in each block is 1024.

    Data Types: double

    Object Functions

    gatherRead data cube of spectral image into workspace
    assignDataAssign new data to spectral image data cube
    cropDataCrop regions-of-interest of spectral image
    enviwriteWrite hyperspectral data to ENVI file format
    selectBandsSelect bands from spectral image
    removeBandsRemove spectral bands from spectral image
    colorizeEstimate color image of spectral image
    applyApply function to each block of spectral image

    Examples

    collapse all

    Read hyperspectral data into the workspace.

    hcube = imhypercube("EO1H0440342002212110PY_cropped.hdr");

    Estimate and visualize the RGB image of the hyperspectral data.

    rgbImg = colorize(hcube,Method="rgb");
    figure
    imshow(rgbImg)

    Figure contains an axes object. The hidden axes object contains an object of type image.

    Convert the digital numbers to radiance values to perform radiometric calibration of the data.

    newhcube = dn2radiance(hcube);

    Compute and visualize the NDVI index for the corrected data.

    ndviImg = ndvi(newhcube);
    figure
    imagesc(ndviImg)
    axis equal tight
    colorbar

    Figure contains an axes object. The axes object contains an object of type image.

    More About

    expand all

    Version History

    Introduced in R2020a

    expand all