skills/cv/laplacian-variance-blur-score/SKILL.md
Score image sharpness with the variance of the Laplacian (Pech-Pacheco) as a single scalar feature for downstream tabular models or as a hard blur filter
npx skillsauth add wenmin-wu/ds-skills cv-laplacian-variance-blur-scoreInstall 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.
Blurry photos are a universal quality problem in classified-ads, product-catalog, and user-upload datasets. The Pech-Pacheco method — variance of the Laplacian on the grayscale image — is the canonical one-liner: low variance means a flat second-derivative response (the image has no crisp edges, i.e. blurry); high variance means sharp transitions. You can either feed the raw score as a regression feature or threshold it (~100 is the textbook starting point) to binary-flag blurry listings. Used alongside dullness, whiteness, and edge-density scores to build a compact image-quality feature block on Avito Demand Prediction.
import cv2
def blur_score(path):
img = cv2.imread(path)
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
return cv2.Laplacian(gray, cv2.CV_64F).var()
def is_blurry(path, threshold=100.0):
return blur_score(path) < threshold
COLOR_BGR2GRAY)cv2.Laplacian(gray, cv2.CV_64F) — CV_64F is critical, uint8 clips negative second-derivative values and destroys the signal.var() on the Laplacian responseis_blurry flagdata-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