TL;DR
Generative Refocusing (GenRefocus) transforms a single image—whether sharp or blurry—into a fully controllable virtual camera. By decoupling the task into a deblurring stage and a bokeh synthesis stage, the framework allows users to precisely adjust the focus plane, aperture size, and even customize aperture shapes after the shot is taken.
What Problem Does This Paper Address?
Adjusting the depth-of-field and focus point after capturing an image (post-capture refocusing) is a highly sought-after feature in photography. However, doing this from a single image is incredibly challenging. Existing computational approaches suffer from three major bottlenecks:
- Input Constraints: Most methods require perfectly sharp, all-in-focus inputs to begin with.
- Lack of Realism: They rely heavily on synthetic data from simulators, which fails to capture authentic real-world lens aberrations and characteristics.
- Limited Control: Current tools typically only allow control over aperture size, completely ignoring aperture shape (such as creative heart- or star-shaped bokeh).
Furthermore, trying to estimate depth directly from an already blurry image is notoriously brittle, frequently leading to artifacts and misfocus.
Methods
To overcome these limitations, the authors propose GenRefocus, a two-stage pipeline built on top of the FLUX-1-dev diffusion model backbone, fine-tuned using Low-Rank Adaptation (LoRA).
- Stage 1: Defocus Deblurring (DeblurNet): Instead of trying to refocus directly, the model first strips away any existing blur. It takes a potentially blurry input image and reconstructs a high-quality, all-in-focus (AIF) image.
- Stage 2: Shallow Depth-of-Field Synthesis (BokehNet): Using the clean AIF image, an off-the-shelf depth estimator calculates a depth map ($D$). The user then specifies a target focus plane ($D_{\text{focus}}$) and a bokeh intensity level ($K$). These parameters are combined into a defocus map: $$D_{\text{def}} = K \cdot |D - D_{\text{focus}}|$$ BokehNet uses this map, along with an optional user-defined aperture shape mask ($A$), to synthesize the final refocused image.
Hybrid Training Scheme
A core innovation is how BokehNet is trained. The authors combine synthetic data (for geometric consistency) with real-world datasets. Because real-world datasets often lack precise blur-level metadata, the authors introduce a simulator-in-the-loop calibration technique. This method sweeps through blur parameters to find the best pseudo-labels for real images, allowing the model to learn authentic lens characteristics directly from real photographs.
Datasets
The framework is trained and evaluated using a mix of existing benchmarks and newly introduced datasets:
- DPDD & RealBokeh: Used to train DeblurNet on real paired defocus-blur data.
- ITW (In-The-Wild) & LFDOF: Real-world bokeh datasets used for training BokehNet.
- PointLight-1K (New): A specialized dataset consisting of 1,000 synthesized night-time images with prominent point lights. This was created because standard images lack the strong point-light stimuli needed to teach the model shape-conditioned bokeh responses.
- LF-Bokeh & LF-Refocus (New): New light-field evaluation benchmarks used to test bokeh synthesis and refocusing fidelity.
Key Insights and Ideas
- Divide and Conquer: Separating deblurring from bokeh rendering is crucial. Estimating depth from a blurry image is highly inaccurate; by deblurring first, the depth estimation step becomes significantly more reliable.
- Unlocking Real-World Data: Rather than discarding real-world datasets because they lack precise calibration metadata (like f-stop or focus distance), the simulator-in-the-loop optimization bridges the gap between synthetic perfection and real-world lens imperfections.
- The Point-Light Catalyst: The model cannot easily learn custom aperture shapes from standard images because the shape of a blur is only clearly visible on point lights. Introducing
PointLight-1Kforces the diffusion model to correctly attend to shape-conditioned tokens.
Key Results
- Defocus Deblurring: DeblurNet outperformed competing architectures (like Restormer and Bokehlicious) on the RealDOF and DPDD benchmarks, showing a significant reduction in LPIPS and DISTS metrics while preserving fine text details faithfully.
- Bokeh Synthesis & Refocusing: On the LF-Bokeh dataset, GenRefocus achieved the highest fidelity scores among diffusion-based baselines (an LPIPS of 0.0833 compared to BokehDiff's 0.1708).
- Creative Control: The model successfully demonstrates simultaneous control over the focus plane, aperture size, and custom shapes (triangles, hearts, stars), rendering physically consistent bokeh gradients around complex occlusions.
Limitations and Future Work
- Depth Dependency: Because the pipeline relies heavily on the estimated defocus map, any errors or imperfections in the monocular depth estimation step propagate directly into incorrect blur assignments.
- Transparent Surfaces: The depth estimator struggles with transparent objects (like a glass cup), often capturing only the front surface and failing to correctly blur the background seen through it.
- Hallucination under Severe Blur: In cases of extreme defocus blur, the generative prior of the diffusion model can sometimes hallucinate incorrect textures or details rather than perfectly recovering the true underlying scene.
- Future Work: The authors suggest expanding the aperture vocabulary to support richer, user-drawn custom designs.
Summary updated