matlab-analyze-spectral-images
Work with hyperspectral and multispectral images in MATLAB. Covers reading/writing (ENVI, NITF, TIFF, Sentinel-2, Landsat, ASTER), ECOSTRESS spectral libraries, processing (calibration, atmospheric correction, denoising, sharpening, dimensionality reduction, endmember extraction, unmixing, target/anβ¦
Install / Use
npx skills add matlab/matlab-agentic-toolkit --skill matlab-analyze-spectral-imagesInstalls into whichever agent you are using.
SKILL.md
Installable skill definition
Quality Score
Category
AutomationSupported Platforms
Our assessment of matlab-analyze-spectral-images
matlab-analyze-spectral-images scores 93/100 on our quality scale, 743rd of 2,848 Automation skills we index (top 27%).
Its SKILL.md is 14 KB long, well organised into 13 sections with 5 code examples: a thorough specification that gives an agent plenty to work with.
With 1,098 GitHub stars, it is one of the more widely adopted skills in the catalogue.
Maintenance, license and trust
- The repository was last updated 18 days ago, so matlab-analyze-spectral-images is actively maintained.
- No license is declared. By default that means all rights are reserved: you can read it, but reusing or redistributing it is not clearly permitted. Ask the author before building on it commercially.
- Its trust signals score 88/100, with 1 caution from licensing, adoption, age or documentation. These come from repository metadata, not a code audit β read the skill file before letting an agent act on it.
matlab-analyze-spectral-images compared with similar skills
All 4 of these similar skills score higher than matlab-analyze-spectral-images; compare them before choosing.
| Skill | Score | Stars | Updated | Format |
|---|---|---|---|---|
| matlab-analyze-spectral-images (this skill)by matlab | 93 | 1.1k | 18d ago | SKILL.md |
| Agent-Reachby Panniantong | 100 | 89.8k | 18d ago | CLAUDE.md |
| Scraplingby D4Vinci | 100 | 85.4k | today | MCP Server |
| LocalAIby mudler | 100 | 49.4k | today | MCP Server |
| rufloby ruvnet | 100 | 73.8k | today | MCP Server |
Frequently asked questions
- How do I install matlab-analyze-spectral-images?
- Run
npx skills add matlab/matlab-agentic-toolkit --skill matlab-analyze-spectral-images. The install tabs above show the steps for each supported agent. - Which AI agents does matlab-analyze-spectral-images work with?
- It is written for Universal, as a SKILL.md file. Other agents that read the same format can often use it too.
- Is matlab-analyze-spectral-images safe to use?
- It declares no license and scores 88/100 on trust signals. Skills are instructions an agent will follow, so read the file before installing it and do not approve commands you do not understand.
- Is matlab-analyze-spectral-images still maintained?
- The repository was last updated 18 days ago, so matlab-analyze-spectral-images is actively maintained.
Skill content
View source on GitHubname: matlab-analyze-spectral-images description: >- Work with hyperspectral and multispectral images in MATLAB. Covers reading/writing (ENVI, NITF, TIFF, Sentinel-2, Landsat, ASTER), ECOSTRESS spectral libraries, processing (calibration, atmospheric correction, denoising, sharpening, dimensionality reduction, endmember extraction, unmixing, target/anomaly detection, spectral indices, segmentation), labeling (Spectral Image Labeler app, ground truth objects, automation algorithms), and deep learning (pixel classification CNNs, unmixing autoencoders, transfer learning). Use when reading, writing, processing, analyzing, classifying, labeling, or applying deep learning to hyperspectral or multispectral images. license: https://www.mathworks.com/content/dam/mathworks/license/pmrl/license.md metadata: author: MathWorks version: "1.0"
Spectral Imaging Skill
Generate MATLAB code for working with hyperspectral and multispectral data using the Hyperspectral Imaging Library for Image Processing Toolbox. Requires desktop MATLAB (not MATLAB Online or MATLAB Mobile) and the Hyperspectral Imaging Library add-on.
When to Use
- Reading/writing hyperspectral or multispectral images (ENVI, NITF, GeoTIFF, TIFF, ASTER, Sentinel-2, Landsat)
- Reading ECOSTRESS spectral library signatures (
readEcostressSig) - Creating hypercube/multicube objects, band selection, cropping, block processing
- Radiometric calibration, atmospheric correction, spectral correction
- Denoising, sharpening, dimensionality reduction (PCA, MNF)
- Endmember extraction, spectral unmixing, abundance estimation
- Spectral matching, target detection, anomaly detection
- Computing spectral indices (NDVI, EVI, custom)
- Segmentation (spectral clustering, superpixels, ISODATA)
- Labeling with the Spectral Image Labeler app
- Creating ground truth objects for spectral labeling
- Deep learning classification or unmixing of spectral images
- Semantic segmentation of multispectral satellite imagery (DeepLabV3+ with multi-channel input)
When NOT to Use
- General image reading/writing (use
imread/imwrite) - Non-spectral 3-D volume data (use Medical Imaging or Image Processing Toolbox)
- General image classification not involving spectral cubes (use Deep Learning Toolbox)
- Non-spectral semantic segmentation of RGB/grayscale images (use Computer Vision Toolbox)
- Point spectra or spectral libraries without spatial dimensions
Prerequisite Check
If you suspect the Hyperspectral Imaging Library might not be installed (e.g., user reports errors), verify with exist('imhypercube','file'). If not installed, suggest installing via Add-On Explorer and fall back to multibandread/imread. Do NOT run this check if you are confident the library is available.
Quick Start
% Read hyperspectral data
hcube = imhypercube("scene.hdr");
% Visualize β colorize syntax (NO name-value for basic usage):
falseColor = colorize(hcube); % false-colored image (default, 3 most informative bands)
rgb = colorize(hcube, Method="rgb"); % true RGB (hypercube ONLY β needs R/G/B wavelengths)
cir = colorize(hcube, Method="cir"); % color infrared (hypercube ONLY)
custom = colorize(hcube, [30 20 10]); % false color from specific band INDICES (not wavelengths)
imshow(falseColor)
% Radiometric pipeline
hcube = dn2radiance(hcube);
hcube = radiance2Reflectance(hcube);
hcube = fastInScene(hcube);
% Compute NDVI
ndviMap = ndvi(hcube);
% Endmember extraction and unmixing
numEM = countEndmembersHFC(hcube);
endmembers = nfindr(hcube, numEM);
abundance = estimateAbundanceLS(hcube, endmembers, Method="fcls");
% Anomaly detection
rxScore = anomalyRX(hcube);
% Segmentation
L = hyperseganchor(hcube, 8);
% Launch viewer app
hyperspectralViewer(hcube)
% Launch labeler app (Since R2026a)
spectralImageLabeler(hcube)
Essential Syntax (use without reading reference files)
colorize β Visualization
% HYPERCUBE (supports Method, 2 outputs, ContrastStretching default=false)
falseColor = colorize(hcube) % false-colored (default)
rgb = colorize(hcube, Method="rgb") % true color RGB
cir = colorize(hcube, Method="cir") % color infrared
custom = colorize(hcube, [b1 b2 b3]) % 3 band indices
[img, indices] = colorize(hcube) % also get band indices used
img = colorize(hcube, ContrastStretching=true) % with CLAHE
% MULTICUBE (NO Method param, 1 output, ContrastStretching default=true)
rgb = colorize(mcube) % true RGB (auto-selects by wavelength)
custom = colorize(mcube, [b1 b2 b3]) % false color from band indices
img = colorize(mcube, ContrastStretching=false) % disable contrast stretching
I/O and Band Management
hcube = imhypercube("file.hdr"); % read ENVI/NITF/TIFF
mcube = immulticube("MTL.txt"); % read Landsat (pass *_MTL.txt file)
mcube = immulticube("manifest.safe"); % read Sentinel-2 (pass manifest.safe file, NOT .SAFE folder)
mcube = immulticube("AST_L1T.hdf"); % read ASTER HDF
cropped = cropData(hcube, 30:110, 30:110); % row indices, col indices (NOT [x y w h])
vnir = selectBands(hcube, Wavelength=[400 1000]); % by wavelength range
subset = selectBands(hcube, BandNumber=[1 10 20]); % by band index
cleaned = removeBands(hcube, Wavelength=[1350 1450]); % remove wavelength range
data = gather(hcube); % get M-by-N-by-C numeric array
% ACCESSING DIMENSIONS β NO NumRows/NumColumns/NumBands properties exist:
height = hcube.Metadata.Height; % number of rows (M)
width = hcube.Metadata.Width; % number of columns (N)
bands = hcube.Metadata.Bands; % number of spectral bands (C)
% For multicube: use mcube.BandSize(1,1) for height, mcube.BandSize(1,2) for width
% RESAMPLING vs SELECTING (multicube only):
mcubeUniform = resampleBands(mcube, 30); % RESAMPLE all bands TO 30m (keeps ALL bands, changes spatial size)
mcubeUniform = resampleBands(mcube, 30, Method="bilinear"); % interpolation: "nearest"(default),"bilinear","cubic"
mcube30m = selectBands(mcube, "DataResolution", 30); % KEEP only bands already at 30m (DISCARDS others)
% When asked to "resample" or "match resolution" β use resampleBands
% When asked to "select" or "filter" bands by resolution β use selectBands
Spectral Indices (NEVER compute manually β use built-in functions)
% NDVI β use built-in ndvi() function (supports block processing natively)
ndviMap = ndvi(spcube); % direct numeric M-by-N output, range [-1,1]
ndviMap = ndvi(spcube, BlockSize=[512 512]); % with block processing for large data
% Standard indices β use spectralIndices() (returns struct with .IndexName and .IndexImage)
indices = spectralIndices(spcube, "NDVI"); % single index β struct
indices = spectralIndices(spcube, ["NDVI","EVI"]); % multiple β struct array
indices = spectralIndices(spcube, "all"); % all 16 supported indices
indices = spectralIndices(spcube, "NDVI", BlockSize=[512 512]); % with block processing
% Supported: "NDVI","EVI","NDBI","NBR","MNDWI","MSI","GVI","OSAVI","SR","CMR","MCARI","MTVI","PRI","NDNI","NDMI","CAI"
% Custom formula β use customSpectralIndex() (3 required args: cube, wavelengths, @func)
indexImage = customSpectralIndex(spcube, [800 670], @(nir,red) (nir-red)./(nir+red));
indexImage = customSpectralIndex(spcube, [800 670 475], @(nir,red,blue) 2.5*(nir-red)./(nir+6*red-7.5*blue+1));
indexImage = customSpectralIndex(spcube, [560 1650], @(g,swir) (g-swir)./(g+swir), BlockSize=[512 512]);
% DO NOT manually extract bands and compute β always use these built-in functions
Detection, Matching, and Processing
% Target detection β method is POSITIONAL (3rd arg, not Name=Value)
target = resampleSignature(libData(1), hcube.Wavelength); % resample library spectrum to cube wavelengths
score = detectTarget(hcube, target, "ACE"); % "CEM","ACE","SignedACE","MF","GLRT","AMSD","OSP"
rxScore = anomalyRX(hcube); % higher = more anomalous
% Similarity scores β cube first, reference second (lower = better match)
score = sam(hcube, refSpectrum); % spectral angle mapper [0, pi]
score = sid(hcube, refSpectrum); % spectral information divergence
% spectralMatch β UNUSUAL ARG ORDER: library struct FIRST, then cube/spectrum
% DO NOT pass numeric vectors β first arg MUST be a struct with .Reflectance and .Wavelength fields
libData = readEcostressSig("vegetation.txt"); % returns 1-by-K struct array
score = spectralMatch(libData, hcube); % returns M-by-N-by-K (one score map per signature)
score = spectralMatch(libData, hcube, Method="sam");% "sam"(default),"sid","sidsam","jmsam","ns3"
score = spectralMatch(libData, reflectance, wavelength); % compare against single spectrum (returns K-vector)
% Lower score = stronger match. Returns NaN when bandwidth overlap < MinBandWidth (default 300nm)
% For direct numeric comparison without library: use sam(hcube, target) or sid(hcube, target)
% Spectral clustering / segmentation (use INSTEAD of kmeans for spectral data)
L = hyperseganchor(hcube, numClusters); % spectral-aware clustering (1 output)
[L, n] = hyperslic(hcube, K); % spectral superpixels (2 outputs)
% Block processing β callback receives OBJECT, must use gather()
result = apply(hcube, @(block) mean(gather(block), 3));
Workflow
For functions fully documented in the Essential Syntax and Common Mistakes sections above, generate code directly β those sections provide complete API signatures and constraints.
Read a reference file ONLY when:
- Using a function NOT covered in Essential Syntax (e.g.,
sharc,empiricalLine,sharpencnmf,spectralImageLabeler) - Unsure about argument order or constraints for a complex workflow
- The task involves the Spectral Image Labeler app or ground truth objects
Reference Files (consult only when needed):
- references/spectral-io.md β I/O, band selection, cropping, block processing, colorize, enviwrite
- references/spectral-calibration.md β Radiometric calibration, atmospheric correction, spectral correction, denoising, sharpening
- references/spectral-analysis.md β PCA/MNF, unmixing, spectral matching, target/anomaly detection, indices, segmentation
- references/spectral-deep-learning.md β Labeler app, groundTruthSpectralImage, deep learning pipelines
- references/dl-classification.md β 3-D CNN, 1-D CNN, ground truth to training data workflows
- references/dl-advanced.md β Unmixing autoencoder, transfer learning, DeepLabV3+ semantic segmentation
CRITICAL: Common Mistakes to Avoid
These are the most frequent errors. Violating any of these will cause runtime failures:
- NEVER use
hypercube()β deprecated. Useimhypercube()orgeohypercube(). cropData(hcube, 30:110, 30:110)β row/col INDEX VECTORS, not[x y w h]selectBands/removeBandsrequire Name=Value:selectBands(hcube, BandNumber=[1 10 20]),removeBands(hcube, Wavelength=[1350 1450]).removeBandserrors if range outside cube's actual wavelengths.customSpectralIndex(spcube, [800 670], @(nir,red) (nir-red)./(nir+red))β 3 args requiredapply(hcube, @(block) mean(gather(block), 3))β callback receives OBJECT, usegather()inverseProjection(pcaCube, coeff)β data first, coefficients secondspectralMatch(libData, hcube)β struct fromreadEcostressSigFIRST. For numeric: usesam(hcube, target)directly.- `L
Truncated for display β read the full file on GitHub.
Related Skills
Agent-Reach
89.8kGive your AI agent eyes to see the entire internet. Read & search Twitter, Reddit, YouTube, GitHub, Bilibili, XiaoHongShu β one CLI, zero API fees.
Scrapling
85.4kπ·οΈ An adaptive Web Scraping framework that handles everything from a single request to a full-scale crawl! Don't be shy, join here: https://discord.gg/EMgGbDceNQ and follow here for daily tips and tricks: https://x.com/Scrapling_dev
LocalAI
49.4kLocalAI is the open-source AI engine. Run any model - LLMs, vision, voice, image, video - on any hardware. No GPU required.
ruflo
73.8kπ The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated
Languages
Trust signals
From repository metadata: license, adoption, age and documentation. Not a code audit β see the Safety scan above for what the skill file itself contains.
