matlab-analyze-spectral-images

Process, analyze, and classify hyperspectral and multispectral images in MATLAB.

995|122|Updated Apr 3, 2026
One-click install
npx skills add https://github.com/matlab/matlab-agentic-toolkit --skill matlab-analyze-spectral-images
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: matlab-analyze-spectral-images
Source: https://github.com/matlab/matlab-agentic-toolkit/tree/main/skills-catalog/image-processing-and-computer-vision/matlab-analyze-spectral-images
Command: npx skills add https://github.com/matlab/matlab-agentic-toolkit --skill matlab-analyze-spectral-images

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Working with hyperspectral and multispectral imagery in MATLAB involves dozens of specialized functions with subtle argument orders, object-type constraints, and format quirks that are easy to get wrong. This Skill gives an AI agent the exact syntax, constraints, and workflows of the Hyperspectral Imaging Library so it generates correct spectral imaging code on the first attempt.

Core Features & Use Cases

  • Spectral I/O and Preparation: Read ENVI, NITF, GeoTIFF, Sentinel-2, Landsat, and ASTER data into hypercube or multicube objects, then crop, select bands, resample resolutions, and visualize with colorize.
  • Calibration and Analysis: Run radiometric calibration, atmospheric correction, denoising, PCA/MNF reduction, endmember extraction, spectral unmixing, target and anomaly detection, spectral indices like NDVI, and segmentation.
  • Labeling and Deep Learning: Use the Spectral Image Labeler app and groundTruthSpectralImage objects, then train 3-D CNNs, 1-D spectral CNNs, unmixing autoencoders, or DeepLabV3+ segmentation models.
  • Use Case: Load a Sentinel-2 scene, resample all bands to 10 m, compute NDVI, and train a DeepLabV3+ model adapted for 12-channel input to segment land cover classes.

Quick Start

Ask the agent to load a hyperspectral ENVI file, compute an NDVI map, and detect anomalies using the spectral imaging skill.

Frequently Asked Questions about matlab-analyze-spectral-images

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I read hyperspectral and multispectral images in MATLAB?

Use imhypercube for hyperspectral formats like ENVI, NITF, and GeoTIFF, and immulticube for multispectral sources like Landsat MTL files, Sentinel-2 manifest.safe files, and ASTER HDF. Add geospatial referencing with geohypercube or geomulticube when Mapping Toolbox is available.

How do I compute NDVI and other spectral indices in MATLAB?

Call ndvi(spcube) for a direct numeric NDVI map, or spectralIndices(spcube, "NDVI") which returns a struct with IndexName and IndexImage fields. For custom formulas, use customSpectralIndex with wavelengths and a function handle rather than manually extracting bands.

What is the difference between hypercube and multicube in MATLAB?

A hypercube holds hyperspectral data with many uniform bands, while a multicube holds multispectral bands at varying resolutions. Many analysis functions like hyperpca, nfindr, and anomalyRX work only on hypercubes, so multicube data often needs conversion or resampleBands first.

Does the Hyperspectral Imaging Library work in MATLAB Online?

No, the Hyperspectral Imaging Library requires desktop MATLAB and is not supported in MATLAB Online or MATLAB Mobile. It is installed as an add-on for Image Processing Toolbox, and you can verify availability with exist('imhypercube','file').

Why does colorize fail with Method="rgb" on my multispectral data?

The Method parameter is supported only for hypercube objects, not multicube. For a multicube, colorize(mcube) already returns true RGB by auto-selecting bands by wavelength, and you can pass three band indices for a false-color composite.

How do I train a deep learning model on hyperspectral data in MATLAB?

Reduce dimensionality with hyperpca, extract spatial-spectral patches, then build a dlnetwork with image3dInputLayer and convolution3dLayer and train it using trainnet. For multispectral satellite imagery, adapt DeepLabV3+ by replacing the input and first convolution layers to accept more than three channels.