skills/cv/local-contrast-enhancement/SKILL.md
Subtracts a Gaussian-blurred version of the image from itself to normalize local illumination and enhance fine structural details.
npx skillsauth add wenmin-wu/ds-skills cv-local-contrast-enhancementInstall 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.
Images with uneven illumination (retinal fundus, microscopy, satellite) have regions where detail is lost in bright spots or dark shadows. Subtracting a heavily blurred version of the image from the original removes the low-frequency illumination gradient while preserving high-frequency details like edges and textures. The weighted additive blend 4*image - 4*blur + 128 centers the output at mid-gray with enhanced local contrast.
import cv2
def enhance_local_contrast(image, sigma=10):
"""Enhance local contrast by subtracting Gaussian blur.
Args:
image: (H, W, 3) uint8 RGB image
sigma: Gaussian kernel sigma; larger = removes broader gradients
Returns:
(H, W, 3) uint8 contrast-enhanced image
"""
return cv2.addWeighted(
image, 4,
cv2.GaussianBlur(image, (0, 0), sigma),
-4, 128
)
# Usage in preprocessing pipeline
img = cv2.imread(path)
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
img = cv2.resize(img, (512, 512))
img = enhance_local_contrast(img, sigma=10)
4 * original - 4 * blurred + 128data-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