Abstract
When a camera is pointed at a strong light source, the resulting photograph may contain lens flare artifacts. Flares appear in a wide variety of patterns (halos, streaks, color bleeding, haze, etc.) and this diversity in appearance makes flare removal challenging. Existing analytical solutions make strong assumptions about the artifact's geometry or brightness, and therefore only work well on a small subset of flares. Machine learning techniques have shown success in removing other types of artifacts, like reflections, but have not been widely applied to flare removal due to the lack of training data. To solve this problem, we explicitly model the optical causes of flare either empirically or using wave optics, and generate semi-synthetic pairs of flare-corrupted and clean images. This enables us to train neural networks to remove lens flare for the first time. Experiments show our data synthesis approach is critical for accurate flare removal, and that models trained with our technique generalize well to real lens flares across different scenes, lighting conditions, and cameras.
Introduction
Removing lens flare from a single image is a long-standing challenge in computational photography. When a camera is directed toward a bright light source, such as the sun or a streetlamp, the resulting image often suffers from distracting artifacts like halos, streaks, and saturated blobs. While significant progress has been made in removing noise or reflections, lens flare has remained difficult to address due to the extreme diversity of its patterns and a total lack of paired training data.
The core hurdle is the inability to capture ground-truth pairs in the real world; one cannot simply "turn off" the physics of a lens without altering the scene's lighting. Consequently, existing software solutions often rely on simple heuristics that fail to handle complex, real-world streaks and haze.
Methods and Data Synthesis
The authors treat lens flare as an additive layer in linear optical space and propose a physically-grounded pipeline to synthesize realistic training data. They categorize flares into two primary optical components: scattering and reflection.
1. Scattering Flare (Haze and Streaks)
Caused by dust and scratches on the lens surface, these are modeled using wave optics. The authors generate synthetic "dirty" apertures and apply Fourier transforms to calculate the resulting Point Spread Function (PSF), allowing them to render how light sources interact with a specific dirty lens.
2. Reflective Flare (Blobs and Rings)
Internal reflections between lens elements are highly complex. Rather than pure simulation, the authors used a robot-controlled rotation stage in a dark room to capture thousands of real flare patterns from a smartphone camera, creating a high-dynamic-range (HDR) library of reflective artifacts.
3. Training Recipe
These synthetic and captured flares are composited onto 24,000 clean images from Flickr. To prevent the network from attempting to remove the actual light source (the illuminant), the authors utilize a specialized "Flare Loss" and a saturation mask. This forces the model to ignore the brightest pixels and focus exclusively on the semi-transparent flare layers.
Key Results
The resulting models (U-Net and CAN) were evaluated against standard baselines like dehazing and specialized spot removal tools.
- Quantitative Performance: On real-world test scenes, the U-Net variant achieved a PSNR of 25.55, significantly outperforming the input (18.57) and existing dehazing methods (17.47).
- Qualitative Improvement: The model successfully removes complex streaks and "veiling glare" (haze) that previous methods could not address. Furthermore, removing flare was shown to improve the accuracy of downstream AI tasks like semantic segmentation and depth estimation.
- User Preference: In a study with 20 participants, the proposed method's results were preferred between 84% and 95% of the time across various datasets.
Limitations and Future Work
While the model generalizes well to standard smartphone lenses, it can struggle with "exotic" glass, such as fisheye lenses, which produce unfamiliar patterns. Occasionally, the model may also mistake natural bright objects (like white clouds) for flare. Future work may involve domain adaptation to fine-tune models for specific professional camera lenses.
Summary updated