主要内容

hyper.labeler.loading.SpectralImageSource

Source of spectral image data for groundTruthSpectralImage object

Since R2026a

    Description

    Add-On Required: This feature requires the Hyperspectral Imaging Library for Image Processing Toolbox add-on.

    A SpectralImageSource object defines the source of spectral image data. Use this object to specify the data sources for a groundTruthSpectralImage object.

    Note

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

    Creation

    • When you export labels from a Spectral Image Labeler app image session, the DataSource property of the exported groundTruthSpectralImage object contains a SpectralImageSource object.

    • To create a SpectralImageSource object programmatically, such as when programmatically creating a groundTruthSpectralImage object, use the hyper.labeler.loading.SpectralImageSource function.

    Description

    dataSource = hyper.labeler.loading.SpectralImageSource(source) creates a SpectralImageSource object for loading the spectral image data stored in the file specified by source.

    example

    Input Arguments

    expand all

    Source filename, specified as a string scalar or character vector. The source file must be one of these file types.

    Data Types: char | string

    Output Arguments

    expand all

    Source of spectral image data, returned as a SpectralImageSource object.

    Properties

    expand all

    This property is read-only.

    Filename of spectral image data source, represented as a character vector.

    Data Types: char

    Examples

    collapse all

    Download and unzip the data set.

    zipFile = matlab.internal.examples.downloadSupportFile("image","data/gulfport_dataset.zip");
    [filepath,folder,~] = fileparts(zipFile);
    unzip(zipFile,filepath)

    Create a SpectralImageSource object for the hyperspectral image file in the data set.

    filename = fullfile(filepath,folder,"gulfport_dataset","hyperspectralData.dat");
    dataSource = hyper.labeler.loading.SpectralImageSource(filename)
    dataSource = 
      SpectralImageSource with properties:
    
        Filename: "C:\Users\Example\supportfiles\image\data\gulfport_dataset\gulfport_dataset\hyperspectralData.dat"
    
    

    Version History

    Introduced in R2026a