TL;DR AnyBokeh edits a photo from any focus and aperture to any other. Instead of discarding the source blur, it reads it as an optical fingerprint and transfers it to the target setting, with no all-in-focus reconstruction needed.
Depth-of-field control is a fundamental tool in photography, yet post-capture bokeh editing from a single image remains challenging. A practical editor should handle images captured under arbitrary focus and aperture settings. Existing methods typically assume an all-in-focus input, or first recover an all-in-focus image before rendering new bokeh. Such pipelines can discard useful blur cues from the source image and propagate reconstruction artifacts into the final edit. We introduce AnyBokeh, a physics-guided framework for any-to-any bokeh editing. Instead of treating source blur merely as a degradation to be removed, AnyBokeh estimates the source blur state with a signed circle-of-confusion map and a disparity map. By modeling the linear relation between signed circle of confusion and disparity difference, AnyBokeh estimates a source-specific optical fingerprint and transfers the source optical characteristics to the desired focus and aperture setting. A generative editor conditioned on both source and target circle-of-confusion maps then performs relative blur synthesis, enabling spatially adaptive deblurring, preservation, and defocus rendering. To support physically supervised learning, we further construct a high-fidelity synthetic dataset with accurate depth, focus distance, and full EXIF metadata. Experiments on real-world benchmarks show that AnyBokeh achieves faithful and controllable editing across any-to-any bokeh editing, all-in-focus-to-bokeh rendering, and defocus deblurring, while avoiding all-in-focus reconstruction and test-time bokeh-level calibration commonly required by existing approaches.
Video
A quick look at any-to-any focus and aperture editing from a single input photo.
Interactive Demo
Given a single photo with any source optical state, AnyBokeh refocuses on any chosen point and re-renders the bokeh at any target aperture.
Input
f/2
Drag the slider to sweep the target aperture from f/2 to f/20, and pick a focus point (marked in red on the input); click a thumbnail to switch scenes.
Comparisons
The same AnyBokeh model handles any-to-any editing, bokeh rendering from all-in-focus inputs, and defocus deblurring, compared here against task-specific baselines.
Drag the slider to compare with AnyBokeh. The crops zoom into the dashed box; click one to put that method in the slider. Note: recovering detail from defocus blur is ill-posed, so deblurred regions may differ from the GT.
Blur State Estimation
Stage 1 predicts the source CoC and scene disparity directly from the input, whether it is shallow or deep depth-of-field.
Drag either slider to reveal the predicted map over the input, switch between CoC and disparity, and click a thumbnail to try other inputs.
Method
Read the blur already in the photo, transfer its optical fingerprint to the target setting, then edit relative to it.
Stage 1: From a single image in any bokeh state, a generative predictor jointly estimates the signed source CoC map and the disparity map, recovering both the blur already present and the scene geometry behind it.
Target CoC: Signed CoC is linear in disparity, with slope κsrc as the optical fingerprint. Scaling it by the aperture ratio and shifting the in-focus plane to the chosen point gives the target CoC, without the need for test-time calibration.
Stage 2: A dual-CoC-conditioned editor takes the source image together with the source and target CoC maps. Their relative blur transition tells it, region by region, whether to deblur, preserve, or add bokeh.
Click the image to choose a new focus point and drag the aperture slider. The target CoC map and the CoC–disparity line update live following CoCtgt = raκsrc(Dfocus − D).
| κsrc | |
| ra = Nsrc/Ntgt | |
| κtgt |
Source CoC and disparity are ground truth from our UnrealBokeh dataset.
@inproceedings{hou2026anybokeh,
title = {AnyBokeh: Physics-Guided Any-to-Any Bokeh Editing with Optical Fingerprint Transfer},
author = {Hou, Xinyu and Li, Xiaoming and Yue, Zongsheng and Loy, Chen Change},
booktitle = {Advances in Neural Information Processing Systems (NeurIPS)},
year = {2026}
}