customSpectralIndex
Syntax
Description
Custom spectral indices can ease workflows where standard spectral indices are not applicable. You can use a custom spectral index to define and compute an index specific to your application. You can also use a custom spectral index to fine-tune commonly used spectral indices to your specific hyperspectral or multispectral data.
computes a custom spectral index using the custom formula specified by the function handle
indexImage
= customSpectralIndex(spcube
,wavelengths
,func
)func
. The formula uses the specified wavelengths,
wavelengths
, in the hyperspectral or multispectral data
spcube
.
specifies the block size, indexImage
= customSpectralIndex(spcube
,wavelengths
,func
,BlockSize=blocksize
)blocksize
, for block processing of the
spectral data.
The function divides the input image into distinct blocks,
processes each block, and then concatenates the processed output of each block to form the
output matrix. Spectral images are multi-dimensional data sets that can be too large to fit in
system memory in their entirety. This can cause the system to run out of memory while running
the customSpectralIndex
function. If you encounter such an issue, perform block
processing by using this syntax.
For example, customSpectralIndex(spcube,wavelengths,func,BlockSize=[50
50])
divides the input image into non-overlapping blocks of size 50-by-50 and
then computes the custom spectral index for pixels in each block.
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.