Main Content

removeContinuum

Normalize spectral signature

Since R2024a

    Description

    The removeContinuum function normalizes the reflectance spectrum by removing the effect of the convex hull through division or subtraction. You can use continuum removal to reduce the influence of background spectra such as atmospheric effects and sensor artifacts, improving the accuracy of subsequent applications like spectral matching and target detection.

    example

    continuumRemovedRef = removeContinuum(reflectance) normalizes the reflectance spectrum reflectance by removing the convex hull using division.

    example

    continuumRemovedRef = removeContinuum(reflectance,wavelength) specifies the wavelengths wavelength within the reflectance spectrum.

    example

    continuumRemovedRef = removeContinuum(___,Method=method) specifies the method method for continuum removal.

    Note

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

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

    Examples

    collapse all

    Read the spectral signature of vegetation from the ECOSTRESS spectral library, to use as the reference spectrum.

    lib = readEcostressSig("vegetation.tree.tsuga.canadensis.vswir.tsca-1-47.ucsb.asd.spectrum.txt");

    Load a hyperspectral image into the workspace.

    hcube = hypercube("paviaU.dat");

    Colorize the hyperspectral image to get an RGB image.

    rgbImg = colorize(hcube,Method="rgb",ContrastStretching=true);

    Compute the distance scores of the spectrum of the hyperspectral image pixels with respect to the reference spectrum.

    scoreBeforeNormalization = spectralMatch(lib,hcube);

    Normalize the reference spectrum by removing its continuum.

    continuumRemovedRef = removeContinuum(lib);

    Normalize the hyperspectral image by removing its continuum.

    continuumRemovedCube = removeContinuum(hcube);

    Compute the distance scores of the normalized spectrum of the hyperspectral image pixels with respect to the normalized reference spectrum.

    scoreAfterNormalization = spectralMatch(continuumRemovedRef,continuumRemovedCube);

    Visualize the RGB image of the hyperspectral image, the distance score map before continuum removal, and the distance score map after continuum removal. The pixels with low distance scores are stronger matches to the reference spectrum, and are more likely to belong to the vegetation region. Observe that the distance scores after continuum removal are more accurate, as regions that do not have any vegetation cover have a significantly higher distance score after continuum removal.

    figure
    tiledlayout(3,1)
    nexttile
    imshow(rgbImg)
    title("RGB Image")
    nexttile
    imagesc(scoreBeforeNormalization)
    title("Spectral match before continuum removal")
    axis image off
    colormap(parula(5))
    colorbar
    nexttile
    imagesc(scoreAfterNormalization)
    title("Spectral match after continuum removal")
    axis image off
    colormap(parula(5))
    colorbar

    Load a .mat file that contains the reflectance and the wavelength values of a spectrum into the workspace.

    load spectralData.mat reflectance wavelength

    Normalize the reflectance spectrum by removing its continuum. Remove the continuum by subtracting the convex hull from the reflectance spectrum.

    continuumRemovedRef = removeContinuum(reflectance,wavelength,Method="subtraction");

    Plot the reflectance spectrum before and after continuum removal as a function of the wavelengths.

    tiledlayout(2,1)
    nexttile
    plot(wavelength,reflectance)
    title("Reflectance spectrum before continuum removal")
    nexttile
    plot(wavelength,continuumRemovedRef)
    title("Reflectance spectrum after continuum removal")

    Input Arguments

    collapse all

    Reflectance spectrum from which to remove the continuum, specified as a structure, hypercube object, numeric vector, or 3-D numeric array.

    If reflectance is a structure, it must contain Reflectance and Wavelength fields consisting of numeric vectors of equal length, such as a spectral signature read from the ECOSTRESS library using the readEcostressSig function.

    If reflectance is a numeric vector or a 3-D numeric array, you must also specify the wavelength input argument.

    Wavelengths in the reflectance spectrum, specified as a numeric vector. If reflectance is a numeric vector of length C or a 3-D numeric array of size M-by-N-by-C, then you must specify wavelength as a vector of length C.

    Data Types: single | double

    Method for continuum removal, specified as "division" or "subtraction". The method indicates whether the function removes the convex hull from the reflectance spectrum using division or subtraction.

    Data Types: char | string

    Output Arguments

    collapse all

    Normalized spectrum, returned as a structure, hypercube object, numeric vector, or 3-D numeric array of the same size and data type as reflectance.

    Version History

    Introduced in R2024a