Lighting Normalize
Eliminate 「只是光线变了」 skepticism before any simulation or comparison.
When to Apply
- Clinic phone photos vs ring-light after (hypothetical)
- Different sessions, windows, flash
- Before/after slider UI where fairness is critical
Methods (pick one)
| Method | Speed | Best for |
|---|---|---|
| Histogram matching | Fast | Same scene, different exposure |
| Retinex (SSR/MSR) | Medium | Uneven shadow on face |
| Reference color transfer (Reinhard) | Medium | Different color temperature |
| CLAHE on L channel (Lab) | Fast | Local contrast normalization |
Workflow
python scripts/normalize_lighting.py before.jpg after.jpg --output after_normalized.jpg --method reinhard
For single-image prep before simulation:
python scripts/normalize_lighting.py patient.jpg --reference clinic_standard.jpg --output patient_norm.jpg
Standard Reference
Maintain a clinic_reference.jpg (neutral frontal, D65 lighting) in project assets.
All patient photos normalized toward this reference before entering sim pipeline.
Guardrails
- Don't normalize so aggressively that skin pathology signals disappear
- Keep original + normalized pair for medical records
- Document:
lighting_normalized: truein output manifest
Integration
Run before:
- facial-proportion-analysis (fair measurements)
- before-after-morph (fair morph)
- aesthetic-postop-sim (consistent input)