Main Content


Perform fast in-scene atmospheric correction

Since R2020b



    newhcube = fastInScene(hcube)returns atmospherically corrected data cube by computing the surface reflectance values from the top of atmosphere (TOA) reflectance values in input hyperspectral data. Use this function to perform fast atmospheric correction that uses the in-scene characteristics for estimating the correction parameters.

    The fast in-scene method gives best correction results, if the hyperspectral data

    • is radiometrically calibrated

    • is uniformly illuminated

    • does not contain large water bodies, cloud, or cloud shadows

    • contain adequate dark pixels for approximately computing the baseline spectrum

    • contain heterogeneous regions that include soil, water, vegetation, and man-made structures. The method assumes that the mean reflectance spectrum of different endmember spectra are scene-independent.


    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.


    collapse all

    Read hyperspectral data into the workspace.

    inputCube = hypercube("EO1H0440342002212110PY_cropped.dat");

    Remove low signal-to-noise ratio (SNR) bands from the hyperspectral data cube.

    inputCube = removeBands(inputCube,"BandNumber",find(~inputCube.Metadata.BadBands));

    Convert digital number (DN) to top of atmosphere (TOA) reflectance values.

    inputCube = dn2reflectance(inputCube);

    Remove atmospheric effects from the input hyperspectral data based on the in-scene characteristics.

    correctedCube = fastInScene(inputCube);

    Display the false-color images of the input hyperspectral data and the hyperspectral data after fast in-scene atmospheric correction.

    colorImg = colorize(inputCube);
    colorImg_corrected = colorize(correctedCube);
    imagesc([colorImg colorImg_corrected])

    Input Arguments

    collapse all

    Input hyperspectral data, specified as a hypercube object. The DataCube property of the hypercube object stores the hyperspectral data cube. For better results, the input values must be TOA reflectance values. If the input values are digital numbers, use the dn2reflectance function to estimate the TOA reflectance values.

    Output Arguments

    collapse all

    Output hyperspectral data, returned as a hypercube object. The pixel values of the data cube returned at the output specifies the surface reflectance values.


    This function does not support parfor loops, as its performance is already optimized. (since R2023a)


    [1] Bernstein, L.S., S.M. Adler-Golden, R.L. Sundberg, R.Y. Levine, T.C. Perkins, A. Berk, A.J. Ratkowski, G. Felde, and M.L. Hoke. “A New Method for Atmospheric Correction and Aerosol Optical Property Retrieval for VIS-SWIR Multi- and Hyperspectral Imaging Sensors: QUAC (QUick Atmospheric Correction).” In Proceedings. 2005 IEEE International Geoscience and Remote Sensing Symposium, 2005. IGARSS ’05., 5:3549–52. Seoul, Korea: IEEE, 2005.

    Version History

    Introduced in R2020b