sharp band
A
B
depth D

FlashReFocus

Interactive Image Refocusing in Seconds

1National Cheng Kung University2State University of New York at Albany3National Yang Ming Chiao Tung University* Equal contribution · † Corresponding author

FlashReFocus runs diffusion once per photograph, to restore the all-in-focus image with a one-step deblurrer and a decoder refiner; every later edit (focal point, blur strength, tilt-shift or several focal planes) is one pass of an ultra-lightweight renderer driven by an explicit defocus map. Every edit reuses the same restored image, so in-focus content stays unchanged between edits and each further edit takes 0.46 s at 1536×1536, far faster than existing methods. This enables interactive image refocusing and professional photo editing, and the same stability and speed carry over to refocusing video frame by frame.

2.45 scomplete refocus at 1536×1536
0.46 seach further focal edit
151×faster first refocus than GenRefocus
1 stepof diffusion per photograph

Controls and applications

Further controls and applications of the explicit defocus map

Six more controls and the applications they enable, from a detail dial for the restoration to refocusing video. Each control only changes the explicit defocus map given to the same renderer, and masks from SAM select regions whose depth is rewritten. Every example is a real photograph or video, and every control is zero-shot: the renderer was trained only with one focal plane and one strength per image, and nothing is retrained.

Spotlight in a concert video: input and result

Input, with its estimated depth and the SAM maskFlashReFocus, with the edited depth

An in-the-wild concert clip (the one at the top of the page), 6 s rendered at its native 4K resolution (3840×1720, 60 fps). SAM 3, prompted with the word “person”, segments and tracks every performer; the lead singer is picked automatically by her appearance and kept through cuts and lighting changes. In every frame her mask (white outline in the left inset) is set to the focal depth, and every other pixel is moved at least a fixed distance away from it (right inset); the renderer then blurs the dancers around her. Depth is estimated per frame and smoothed over time, and nothing is retrained.

Focus range

A thick focal plane: everything within a chosen depth range stays sharp, from the bottles alone to the floor and the street outside. The range and the aperture are separate dials, which one physical lens cannot separate.

Radial focus

A sharp disc follows a chosen centre and blur grows outward, the look of a Lensbaby lens; the depth map is replaced by the distance to the centre.

Tilt-shift at any angle

The sharp band tilts back and forth to follow the diagonal shoreline, so the surf and the black sand stay sharp while the slope blurs; the depth map is the distance to a rotated line.

Blur one side only

With the focus in the middle of a tug-of-war team, first only the background blurs and the two men in front stay sharp, then only the foreground blurs and the trees and tram behind turn sharp.

Three focal planes

Focal planes are added one at a time: the rock in front, then the soldier, then the parked car far behind, while the grass between them stays blurred.

Keep a subject sharp

A mask of the mushroom keeps it sharp while the focus moves from the grass in front to the trees behind, so the depth around it changes but the subject does not.

Portrait mode on sharp photographs

A photograph that is already sharp skips Stage I and goes straight to the renderer: the background rocks melt into bokeh behind the penguin, a divider compares the result with the sharp input, and focus then moves to the rocks, at about half a second per edit. This is the zero-shot bokeh rendering task of the paper.

Focus that follows a path

A drawn path along the train sets the focal point frame by frame, from the front car to the far end and back, like a cinematographer pulling focus.

Prompt-based focus

The prompts “the iced latte”, “the glass of coffee” and “the window” select a mask with CLIPSeg, an off-the-shelf segmenter that is not part of FlashReFocus; the focal depth is read from the mask and the subject is kept sharp.

Remove a photobomber

A click on the man beside her gives a SAM mask; his depth is pushed to the far background, so he melts into the bokeh while she stays sharp. No inpainting is involved.

Optical privacy blur

Six faces are marked and moved out of focus while everything else stays on the focal plane: the faces get lens blur instead of a mosaic.

Everyone in focus

Three people at different distances are clicked and placed on one focal plane, and everything else is pushed farther from it, so the people between them and the crowd behind blur strongly.

Blur per layer

Two SAM masks split the temple into a left layer, a right column and the rest; each layer gets its own depth offset, so each blurs by its own amount, then the order is reversed.

Depth for a flat picture

The door is almost flat, so its estimated depth gives little to refocus. A mask of the padlock and latch moves them in front of the door, and the focus can then move between them.

Fidelity or perceptual detail

One weight ω in Stage I trades pixel fidelity for perceptual detail; the crop sweeps from the defocused input through ω = 0 to 1.75 and back. Lower values stay closest to the input (PSNR peaks at ω = 0.5–0.75), higher values add detail (LPIPS, DISTS and FID are best at 1.25–1.5); the released model uses 1.25.

Video: focus pull

Each frame of a sharp clip goes through depth and the renderer, with depth and focal depth smoothed over time: focus moves from the rider on the right to the car on the left. The output changes less from frame to frame than the input (ratio 0.69), so no flicker is added.

Video: click prompt with SAM

One click on the woman in the orange jacket gives SAM a point prompt; the resulting mask follows her down the street and keeps her sharp while the shop windows and the street behind her blur. Frame-to-frame change ratio 0.75.

Video: box prompt with SAM

Two boxes on the first frame, one around the horse and one around the jockey, are segmented by SAM; each later frame is prompted with the previous masks' boxes, so both stay sharp from the far shot to the close-up while the track and the stands blur. Frame-to-frame change ratio 0.69.

Abstract

Motivation and approach

Single-image refocusing changes the focal plane and depth of field of a photograph after it is taken. People try many focal settings on the same photograph or video, so each edit has to be fast, has to leave the content unchanged, and has to give explicit control over where and how much to blur, and the method has to work on cameras and lenses it was not trained on. The left card lists where current methods fall short of this; the right card lists how FlashReFocus meets it.

Where prior methods fall short

  • Minutes per edit. Single-stage and two-stage generative methods run a large diffusion model for every focal edit; at 1536×1536 a further edit takes 217 s with GenRefocus and 183 s with AnyBokeh.
  • Too slow for video, and it flickers. At 217 s per frame, a ten-second clip at 24 fps would take about 14.5 hours with GenRefocus and about 12 hours with AnyBokeh. Diffusion also resynthesizes the whole image, so content changes even where the focus did not move (in-focus PSNR against the input is 29.0 dB for GenRefocus), and frames regenerated one by one flicker.
  • No global, explicit control. Focus and blur enter as implicit conditions, with no editable map of where and how much to blur, so effects beyond one focal plane, such as tilt-shift, several focal planes or blur chosen region by region, cannot be specified.
  • Unsuited to interactive editing and personalised media. When each edit takes minutes and the blur cannot be specified directly, users cannot adjust focus while they watch the result, and personalised uses, such as choosing which people stay sharp in a family photograph or refocusing one's own clips for social media, are impractical.
  • Soft newly focused regions. Recovering detail and rendering blur in one pass often leaves regions brought into focus insufficiently sharp.
  • Lightweight renderers cannot restore. Feed-forward bokeh renderers are fast but only add blur, so anything captured out of focus stays blurred.
  • Weak on unseen cameras. Bokeh depends on the camera and lens, and learned renderers tend to fit the optics they were trained on. On EBB! Val176 and on 3CReal, whose three camera–lens systems are excluded from training, the best prior LPIPS is 0.202 and 0.230, against 0.181 and 0.218 for FlashReFocus.

What FlashReFocus does instead

  • Seconds, not minutes. A complete refocus takes 2.45 s and each further edit 0.46 s at 1536×1536 on one RTX PRO 6000: 151× faster than GenRefocus for the first refocus and 472× for every edit after it, with the fewest parameters (1.70 B) and 113 TFLOPs instead of tens of thousands.
  • Diffusion only where it helps. One step of diffusion with a decoder refiner restores the all-in-focus image, the one ill-posed part; it gives the best LPIPS and BRISQUE on both DPDD and RealDOF. Rendering is left to a 1.3M-parameter network.
  • Consistent across edits and frames. Every edit is a residual to the same reconstruction, so in-focus regions stay at 44.4 dB PSNR against the input, against 29.0 dB for GenRefocus, which regenerates the image at every edit. On video nothing is regenerated, so the result does not flicker: in our refocused clips the change from one frame to the next is smaller than in the input clip itself.
  • Best bokeh on cameras it never saw. On EBB! Val176 and our three-camera 3CReal it leads every method in LPIPS, LPIPS-VGG, DISTS, MS-SSIM and CLIP-I, and on 3CReal also in PSNR and SSIM.
  • A strength dial that behaves like an aperture. Blur follows the strength setting more faithfully than every diffusion-based method (LVCorr 0.857 and 0.839), and on real aperture series from MODEST the chosen strength rises with the aperture in 16 of 17 cases (Spearman ρ = 0.985).
  • An explicit map you can edit. Focus, aperture and spatial blur are set by an explicit defocus map with defocus-bias attention, so editing the map gives tilt-shift at any angle, two or more focal planes, a focus range, radial focus, one-sided blur, depth swaps, and mask-driven edits such as removing a photobomber, optical privacy blur or prompt-based focus.
  • Blurry or sharp, photo or video. Defocused photographs are restored first; photographs that are already sharp go straight to the renderer; and the same pipeline runs frame by frame on video.

01 / Results

All-in-focus restoration of defocused photographs

Stage I recovers the all-in-focus image that every later edit reuses. Drag the divider on any card; the left side is the input and the right side is FlashReFocus.

Inputs at a long side of 1280, restored in one diffusion step with ω = 1.25 and the decoder refiner.

02 / Interactive

Interactive demo: click to refocus and set the aperture

Click anywhere in the photograph to focus there, and turn the aperture ring to set the depth of field. Every frame is a renderer output from one restored image.

Click anywhere to refocus

Click to focus

Aperture ring

deep depth of fieldshallow

Scroll the mouse wheel over the ring to turn it, or click a stop.

Show

Focal point
–
Focal depth Df
–
Aperture
–
Strength K
–
Download focal stack

Precomputed renderer outputs from one restored image: 24 focal depths × 6 apertures, rendered at 1280 px and played back here. The aperture ring uses a thin-lens mapping K = 2.8 / N, so K = 1, the trained maximum, at f/2.8; on MODEST, strengths selected for real apertures rise with the aperture (Spearman ρ = 0.985 against 1/N). Photographs from Unsplash and DIV2K.

Real apertures: MODEST

Real capture
Real capture, f/2.8
FlashReFocus render
FlashReFocus from the f/22 input
deep depth of fieldshallow

MODEST captures one scene at f/22, f/16, f/9, f/5 and f/2.8 with a real lens. FlashReFocus renders from the f/22 photograph alone, with the strength chosen per aperture by SSIM against the real capture. The chosen strength rises with the aperture in 16 of 17 series (Spearman ρ = 0.985 against 1/N), the highest of the methods in the paper.

03 / Real time

Editing speed compared with GenRefocus

In the recording, both methods start on the same photograph and each FlashReFocus result appears after its measured time; GenRefocus needs 370.65 s for its first refocus. The race below adds AnyBokeh on the same clock.

Played in real time at 1536×1536 on one NVIDIA RTX PRO 6000. The scripted session was timed in an earlier run (2.50 s for the first refocus and 0.47 s per further edit); the paper reports 2.45 s and 0.46 s. Frames are model outputs shown at a long side of 1024.

Same clock, three methods

Elapsed0.0 s
FlashReFocus2.45 s for the first refocus · 0.46 s per further edit
AnyBokeh191.38 s for the first refocus · 183.38 s per further edit
GenRefocus370.65 s for the first refocus · 217.32 s per further edit

Simulated from the measured times in the paper's cost table (1536×1536, one NVIDIA RTX PRO 6000, after warm-up), not a recording. Each bar shows the edit in progress; the count on the right is the number of finished edits.

04 / Method

Pipeline: one-step restoration, then a lightweight renderer for every edit

Recovering an all-in-focus image from a defocused photograph is highly ill-posed and benefits from a generative prior, whereas rendering blur is largely determined by depth and the focal plane. FlashReFocus therefore splits refocusing into two stages with very different costs.

  • Stage I adapts a diffusion prior to a single step with dual LoRAs: the weight ω blends a pixel pass and a detail pass to balance fidelity and perceptual quality, and a lightweight decoder refiner restores fine structure such as edges and text.
  • Stage II turns monocular depth and the selected focal point into an explicit defocus map and renders each edit as a residual to the fixed reconstruction, in one feed-forward pass of a 1.3M-parameter network.
  • Defocus-bias attention favors tokens of similar blur magnitude, so blur changes sharply at depth boundaries and focused content is left as restored.

Refocusing paradigms

Three refocusing paradigms and a log-scale bar chart of seconds per stage for GenRefocus, AnyBokeh, DiffCamera, MagicBokeh and FlashReFocus

(a) Single-stage diffusion and (b) two-stage generative refocusing run a large diffusion model for every focal edit. (c) FlashReFocus restores the all-in-focus image once and renders each new focal setting with a lightweight defocus-aware network. (d) Seconds at 1536×1536 for every stage of a refocusing session.

Architecture

Overview of FlashReFocus

Abstract

Single-image refocusing changes the focal plane and depth of field of a photograph after capture. Users compare focal choices on one photograph, so content stability across edits matters alongside quality and speed. Recent generative methods rerun large diffusion models for every edit, even when they first restore an all-in-focus image, so content can change inconsistently between edits. Yet only this restoration is highly ill-posed and benefits from a generative prior, whereas rendering blur is largely determined by depth and the focal plane. We therefore propose FlashReFocus, which runs diffusion once per photograph and renders each edit with a lightweight network. A one-step diffusion deblurrer with a decoder refiner recovers fine detail efficiently while balancing fidelity and perceptual quality. The renderer uses an explicit defocus map for control and defocus-bias attention to promote information exchange between tokens with similar blur magnitudes. Because every edit reuses the same reconstruction, in-focus content stays consistent across edits, and editing the map enables tilt-shift and two-plane effects. We further collect 3CReal, a benchmark of 89 pairs from three camera–lens systems, to evaluate generalization to unseen optics. For zero-shot bokeh rendering on EBB! Val176 and 3CReal, FlashReFocus leads the evaluated methods in fidelity and perceptual quality. At 1536×1536, a complete refocus takes 2.45 s and each subsequent edit 0.46 s on one RTX PRO 6000.

05 / Numbers

Benchmarks

Excerpts of the paper's tables. The full tables compare seven deblurring and nine bokeh-rendering methods and add RealBokeh validation, LFDOF and MODEST.

Seconds per refocus

1536×1536 on one NVIDIA RTX PRO 6000, after warm-up. † Renders directly from the input, without restoration.

Refocusing cost

MethodParams (B)First (s)New focus (s)TFLOPs firstTFLOPs newMem. (GiB)
DiffCamera12.33136.35136.3519,36319,36328.37
GenRefocus18.30370.65217.3242,06124,76342.82
AnyBokeh12.09191.38183.3825,36824,24024.93
BokehDiff†3.83–3.43–73.411.82
MagicBokeh†1.73–6.13–1135.29
FlashReFocus1.702.450.461130.8516.84

First covers restoration and the first rendering; new focus is each further edit on the same image.

Zero-shot bokeh rendering

MethodPSNR ↑SSIM ↑MS-SSIM ↑LPIPS ↓DISTS ↓CLIP-I ↑LVCorr ↑
EBB! Val176
BokehMe24.520.89290.90070.20200.12350.96960.7879
BokehDiff23.870.85680.87450.21370.11820.96360.8281
GenRefocus23.800.86800.88150.20250.11110.96440.6898
MagicBokeh23.140.84410.86290.23980.14450.93310.7987
AnyBokeh22.810.86110.89020.22910.13080.94160.6720
FlashReFocus24.520.89170.90320.18050.10390.97250.8570
3CReal
BokehMe27.580.88350.93420.24710.15690.97610.7768
BokehDiff25.800.81150.86100.31120.15890.95660.7972
GenRefocus26.380.85280.92180.24260.14930.97150.6658
MagicBokeh25.640.83290.89570.25430.15530.94300.7589
AnyBokeh24.740.83880.91960.22980.13780.95430.6719
FlashReFocus27.980.88550.93750.21780.13680.98070.8391

Every method receives the same all-in-focus input and focal point. 3CReal contains 89 small- and large-aperture pairs from three camera–lens systems excluded from renderer training. LVCorr in the EBB! block is measured on LFDOF; for GenRefocus and AnyBokeh, which need a full diffusion pass per strength, it uses the first 20 scenes of each set. Bold marks the best among all nine methods in the paper; DeepLens, not shown here, has the highest LVCorr (0.887 and 0.875).

Defocus deblurring

MethodDPDDRealDOF
PSNR ↑LPIPS ↓DISTS ↓PSNR ↑LPIPS ↓DISTS ↓
Restormer25.980.17620.120425.080.28630.1573
GenRefocus23.930.16860.084323.490.24470.1148
FlashReFocus (ω = 1)24.610.17180.098023.700.25270.1227
FlashReFocus + refiner (ω = 1.25)25.370.15570.087024.250.24370.1187

Bold marks the best among all nine entries in the paper's deblurring table; the highest PSNR belongs to regression restorers (ViTDeblur 26.12 on DPDD, DRBNet 25.74 on RealDOF), which can over-smooth fine detail.

06 / FAQ

Questions

Why run diffusion only once?

Recovering detail that the lens never captured sharply is ill-posed, so it benefits from a generative prior. Rendering blur for a chosen focal plane is largely determined by depth and the circle of confusion, so a compact feed-forward network suffices. FlashReFocus spends diffusion on the first problem only and reuses its result for every edit.

Does the subject change between edits?

Every edit is rendered as a residual to the same restored image, so in-focus content stays close to it. On three 3CReal scenes with matched background blur, in-focus PSNR against the restored image is 44.4 dB for FlashReFocus and 29.0 dB for GenRefocus, which regenerates the image at every edit.

How fast is it, and on what hardware?

At 1536×1536 on one NVIDIA RTX PRO 6000, a complete refocus (restoration plus the first edit) takes 2.45 s with 16.84 GiB peak memory, and each further edit takes 0.46 s because the restored image and depth are reused.

What can I control?

The focal point, the blur strength, and the defocus map itself. The renderer is trained for strengths 0 to 1; larger values extrapolate. Editing the map gives effects beyond one physical lens, such as tilt-shift and two focal planes.

What is 3CReal?

A benchmark of 89 small- and large-aperture pairs captured with three camera–lens systems that are excluded from renderer training, used to test generalization to unseen optics. It is available on Hugging Face.

Can I try it?

Yes. The Hugging Face demo lets you upload a photograph, click a focal point and set the strength; code is on GitHub.

Citation

BibTeX

@misc{cheng2026flashrefocus,
  title         = {FlashReFocus: Interactive Image Refocusing in Seconds},
  author        = {Cheng, Ching-Heng and Lee, Chia-Ming and Chang, Ming-Ching and
                   Li, Xin and Hsu, Chih-Chung},
  year          = {2026},
  eprint        = {2610.23297},
  archivePrefix = {arXiv},
  primaryClass  = {cs.CV},
  url           = {https://arxiv.org/abs/2610.23297}
}