Support for Singleton Dimensions
Hyperspectral Imaging Library for Image Processing Toolbox™ represents hyperspectral and multispectral images as two-dimensional (2-D) images of the form M-by-N,where M and N are the spatial dimensions of the acquired data, in P number of spectral bands. However, hyperspectral and multispectral 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 and multispectral 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 and multispectral functions, you must reshape it into 3-D volume data. These methods assume that, if the spectral data is multispectral data, the spatial resolution of the data is uniform across spectral bands.
Reshape 1-D spectral data of size 1-by-P into a 3-D data cube 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 = imhypercube(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. Theimhypercube
function then creates a 3-Dhypercube
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 data cube 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]); mcube = immulticube(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. Theimmulticube
function then creates a 3-Dmulticube
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
| multicube
| spectralMatch
| ndvi