skills/cv/spectral-index-segmentation/SKILL.md
Compute normalized spectral band ratios (NDWI, CCCI, NDVI) from multispectral imagery and threshold for binary segmentation of water, vegetation, or other targets
npx skillsauth add wenmin-wu/ds-skills cv-spectral-index-segmentationInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Multispectral satellites capture bands beyond visible RGB (NIR, red-edge, SWIR). Normalized difference indices combine these bands into single-channel images where target features (water, vegetation, chlorophyll) have distinct value ranges. A simple threshold on the index produces a binary segmentation mask without any ML model.
import numpy as np
from skimage.transform import resize
def ndwi(green, nir):
return (green - nir) / (green + nir + 1e-10)
def ccci(red, red_edge, mir):
return ((mir - red_edge) / (mir + red_edge + 1e-10) *
(mir - red) / (mir + red + 1e-10))
def ndvi(red, nir):
return (nir - red) / (nir + red + 1e-10)
ms = load_16band_image(image_id)
re = resize(ms[5], rgb.shape[:2])
mir = resize(ms[7], rgb.shape[:2])
r = rgb[:, :, 0].astype(float)
index = ccci(r, re, mir)
water_mask = (index > 0.11).astype(np.uint8)
data-ai
Scaled Pinball Loss (SPL) metric for evaluating quantile forecasts, normalized by mean absolute successive differences of training data
data-ai
Walk backward through a time series and multiplicatively rescale segments when jumps exceed a fraction of the running mean to correct data collection anomalies
testing
Transform forecasting target to next/current ratio minus one so that optimizing MAE or squared error implicitly minimizes SMAPE
tools
Convert point forecasts to prediction intervals by scaling with logit-transformed quantile ratios passed through a Normal CDF