Main Content

selectBands

Select bands from spectral image

Description

newspcube = selectBands(spcube,Wavelength=range) selects bands within the specified wavelength range range from the hyperspectral data spcube. spcube must be a hypercube object.

newspcube = selectBands(spcube,BandNumber=bands) selects bands with the specified numbers bands from the hyperspectral or multispectral data spcube.

example

newspcube = selectBands(spcube,DataResolution=resolution) selects bands with the specified data resolution resolution from the multispectral data spcube. spcube must be a multicube object.

newspcube = selectBands(spcube,endmembers) selects the most informative bands of the hyperspectral data spcube by using the orthogonal space projection method. spcube must be a hypercube object.

Note

  • For preprocessing, the function removes the water absorption and low signal-to-noise ratio (SNR) bands prior to computing the most informative bands.

  • To reduce computational complexity, the function computes the most informative bands by considering only 10% of the pixel values in the preprocessed data cube. The function selects these values randomly. The function also ensures that the random selection does not result in the removal of endmembers.

example

[newspcube,band] = selectBands(spcube,endmembers) also returns the band numbers of the most informative bands in the hyperspectral data. spcube must be a hypercube object.

[___] = selectBands(spcube,endmembers,NumberOfBands=numBands) specifies the number of most informative bands to select from the input data. spcube must be a hypercube object.

Note

This function 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.

example

Examples

collapse all

Download Landsat 8 multispectral data.

zipfile = "LC08_L1TP_113082_20211206_20211215_02_T1.zip";
landsat8Data_url = "https://ssd.mathworks.com/supportfiles/image/data/" + zipfile;
hyper.internal.downloadLandsatDataset(landsat8Data_url,zipfile)
filepath = fullfile("LC08_L1TP_113082_20211206_20211215_02_T1","LC08_L1TP_113082_20211206_20211215_02_T1_MTL.txt");

Read a multispectral image into the workspace.

mcube = immulticube(filepath);

Create a new multicube consisting of the desired bands.

newmcube = selectBands(mcube,BandNumber=7:9)
newmcube = 
  multicube with properties:

        ImageFiles: [3×1 string]
          BandSize: [3×2 double]
        Wavelength: [3×1 double]
          Metadata: [1×1 struct]
    BandResolution: [3×1 double]
         BlockSize: [1024 1024]

Read hyperspectral data into the workspace.

hcube = imhypercube("paviaU.dat")
hcube = 
  hypercube with properties:

     ImageDims: "[610x340x103 double]"
    Wavelength: [103×1 double]
      Metadata: [1×1 struct]
     BlockSize: [610 340]

Estimate the endmembers of the data cube by using the FIPPI algorithm.

endmembers = fippi(hcube,9);

Create a new hypercube consisting of the 10 most informative bands.

newhcube = selectBands(hcube,endmembers,NumberOfBands=10)
newhcube = 
  hypercube with properties:

     ImageDims: "[610x340x10 double]"
    Wavelength: [10×1 double]
      Metadata: [1×1 struct]
     BlockSize: [610 340]

Input Arguments

collapse all

Input spectral data, specified as a hypercube or multicube object.

Since R2025a

Desired wavelength range, specified as a 1-by-2 numeric vector. The first and second elements of the vector must specify he minimum and maximum wavelengths of the desired wavelength range.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

Since R2025a

Desired band numbers, specified as a numeric scalar or vector. Band numbers must be positive integers not greater than the number of bands in the data.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

Since R2025a

Desired data resolution, specified as a numeric scalar.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

Spectral signatures of the endmembers, specified as a C-by-K matrix. C is the number of spectral bands in the hyperspectral data cube, and K is the number of endmembers of the hyperspectral data cube. Use the fippi, ppi, or nfindr function to find the endmembers of a hyperspectral data cube.

Data Types: single | double

Number of most informative bands to select from the hyperspectral data cube, specified as a positive scalar less than the number of bands in the hyperspectral data. By default, the function selects the K most informative bands, where K is the number of endmembers given as input in endmembers.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

Output Arguments

collapse all

Output spectral data, returned as a hypercube or multicube object.

Spectral band numbers of the most informative bands in the input hyperspectral data cube, returned as a positive integer or a vector of positive integers.

Data Types: double

References

[1] Du, Qian, and He Yang. “Similarity-Based Unsupervised Band Selection for Hyperspectral Image Analysis.” IEEE® Geoscience and Remote Sensing Letters, Vol. 5, no. 4 (October 2008): 564–68. https://doi.org/10.1109/LGRS.2008.2000619.

Version History

Introduced in R2020a