Support for Singleton Dimensions
Hyperspectral Imaging Library for Image Processing Toolbox™ represents hyperspectral images as three-dimensional (3-D) arrays of the form M-by-N-by-P, where M and N are the spatial dimensions of the acquired data, and P is the number of spectral wavelengths used during acquisition. However, hyperspectral data can also be spectral reflectance curves obtained from ground spectrometers, and are arranged sequentially without a spatial dimension. This spectral response can be stored as a vector or a matrix. A vector of spectral data contains a single spectral reflectance curve, and a matrix of spectral data contains multiple spectral reflectance curves in sequence.
To process spectral data use these functions in Hyperspectral Imaging Library for Image Processing Toolbox, that also support hyperspectral images.
Explore, Analyze, and Visualize | Data Correction | Dimensionality Reduction | Spectral Unmixing | Spectral Matching and Target Detection |
To use 1-D or 2-D spectral data for the hyperspectral functions, you must reshape it into 3-D volume data:
Reshape 1-D spectral data of size 1-by-P into a 3-D hypercube of size 1-by-1-by-P, where P is the spectral dimension. For example,
spectralDim = size(spectralData1D,2); dataCube = reshape(spectralData1D,[1 1 spectralDim]); hCube = hypercube(dataCube,wavelength);
reshapes the 1-D spectral data
spectralData1D
of size 1-by-P into the 3-D volume datadataCube
of size 1-by-1-by-P by using thereshape
function. Thehypercube
function then creates a 3-D hypercube object by adding the wavelength informationwavelength
to the 3-D volume datadataCube
.Reshape 2-D spectral data of size M-by-P into a 3-D hypercube of size M-by-1-by-P or 1-by-M-by-P, where M represents the number of spectral reflectance curves and P is the spectral dimension. For example,
[numSpectra,spectralDim] = size(spectralData2D); dataCube = reshape(spectralData2D,[numSpectra 1 spectralDim]); hCube = hypercube(dataCube,wavelength);
reshapes the 2-D spectral data
spectralData2D
of size M-by-P into the 3-D volume datadataCube
of size M-by-1-by-P by using thereshape
function. Thehypercube
function then creates a 3-D hypercube object by adding the wavelength informationwavelength
to the 3-D volume datadataCube
.
For more information on how to use 2-D spectral data for hyperspectral function, see Identify Vegetation and Non-Vegetation Spectra example.
See Also
hypercube
| spectralMatch
| ndvi