Hyperpigmentation
Overview
Section titled “Overview”Hyperpigmentation measures areas of skin that are darker than the surrounding tissue — sun damage, post-inflammatory marks, melasma overlap, age spots. The finding also returns two sub-scores in sum_measures: a diffuse area component and a discrete dark-spot component. hyperpigmentation_adjusted is an alternative overall pigmentation score, calculated differently from hyperpigmentation (see Choosing metrics). The visualization channel returns spot-type features — one feature per detected pigmented spot, suitable for marker overlays.
component: hyperpigmentationrequest: query: "components=hyperpigmentation,hyperpigmentation_adjusted,hyperpigmentation_visualization"response_path: "results[].description == \"hyperpigmentation\""value_range: [0, 1]also_request: - hyperpigmentation_adjusted # alternative overall score - hyperpigmentation_visualization # spot-type features, intensity range [0..400]warnings: [401]Visualization example
Section titled “Visualization example”Code: metrics/hyperpigmentation.js. Change the code to change the picture.
renderMetric and drawSpot come from the rendering recipes guide (Recipe 1 — spots); get them as files. Edits stay in this browser tab.
This picture shows the metric's visualization_data from a recorded response, drawn on the photo that was analyzed. Click a thumbnail to select a different model. Hold the photo to hide the overlay.
When to use which variant
Section titled “When to use which variant”| Goal | Use |
|---|---|
| User-relative dashboard (“your level vs. last month”) | hyperpigmentation |
| Integrations set up with the variant (Metric variants) | hyperpigmentation_adjusted |
| Per-spot marker rendering on the face | hyperpigmentation_visualization |
Rendering notes
Section titled “Rendering notes”const hp = response.results.find((r) => r.description === "hyperpigmentation");const score = Math.round(hp.value * 100);Beyond the top-level value, the finding exposes two sum_measures — area (diffuse pigmentation) and spot (discrete dark spots), each 0..1. Each measurement_locations[] entry carries the same area / spot measures plus its own value and mask_shapes.
When a region’s mask can’t be sampled, that region signals unavailability in two different ways — guard for both:
- its
areaandspotmeasures come back as-1; - the region’s own
valuecomes back asnull, not-1.
Either way it means “region unavailable,” not a real low score. (The standalone melasma, freckles and dark_spots metrics are simpler here — their region value is -1 in the same situation.)
For per-spot markers, iterate each measurement location’s visualization_data[] (each feature is a single spot — length: 1, x[0] / y[0] is the centroid, intensity is the feature’s severity in [0..400]). The marker colours are ones you choose, so colour balance doesn’t apply to them; only re-bias a CV-measured colour with inverse_color_balance_rb if you overlay one. Paste-ready: Rendering recipes → Spots.
hyperpigmentation_visualization contains only the dark-spot features. Its default threshold can differ from that of dark_spots_visualization; when both are requested, they match.
local_warnings[]
Section titled “local_warnings[]”Inherits global image-quality codes. Region-mask failures surface as idx: 401.
Related
Section titled “Related”- Standalone pigmentation metrics:
melasma,freckles,dark_spots. - Choosing metrics —
hyperpigmentation_adjustedis covered under Metric variants. - Visualization data — Cat D (AOI + mask + advanced); spot-type features, intensity range
[0..400]. - Rendering recipes → Spots — paste-ready dot / box / cross renderers.