DiffCamera: Arbitrary Refocusing on Images

📄 arXiv: 2509.26599v1 📥 PDF

作者: Yiyang Wang, Xi Chen, Xiaogang Xu, Yu Liu, Hengshuang Zhao

分类: cs.CV

发布日期: 2025-09-30

DOI: 10.1145/3757377.3763827


💡 一句话要点

DiffCamera:提出一种基于扩散Transformer的图像任意重聚焦方法

🎯 匹配领域: 支柱一:机器人控制 (Robot Control)

关键词: 图像重聚焦 景深调整 扩散模型 Transformer 仿真数据 堆叠约束 生成式AI 计算机视觉

📋 核心要点

  1. 现有图像的景深效果固定,难以修改,当主体失焦时问题尤为突出。
  2. DiffCamera利用扩散Transformer框架,通过控制焦点和模糊程度实现图像重聚焦。
  3. 通过仿真数据训练,并引入堆叠约束,保证重聚焦结果的物理合理性。

📝 摘要(中文)

景深(DoF)效果可以引入美观的模糊,从而增强照片质量,但一旦图像创建完成,景深效果就是固定的,难以修改。当应用的模糊不理想时(例如,主体失焦),这会成为问题。为了解决这个问题,我们提出了DiffCamera,该模型能够根据任意新的焦点和模糊程度,对已创建的图像进行灵活的重聚焦。具体来说,我们设计了一个用于重聚焦学习的扩散Transformer框架。然而,训练需要同一场景下具有不同焦平面和散景级别的数据对,这很难获得。为了克服这个限制,我们开发了一个基于仿真的流程,以生成具有不同焦平面和散景级别的大规模图像对。通过模拟数据,我们发现仅使用vanilla扩散目标进行训练通常会导致不正确的DoF行为,因为任务的复杂性。这需要在训练期间施加更强的约束。受到不同焦平面的照片可以线性混合成多焦点图像的摄影原理的启发,我们提出了一个堆叠约束,以强制执行精确的DoF操作。这种约束通过施加物理上合理的重聚焦行为来增强模型训练,即聚焦结果应与场景结构和相机条件忠实对齐,以便可以将它们组合成正确的多焦点图像。我们还构建了一个基准来评估我们的重聚焦模型的有效性。大量实验表明,DiffCamera支持跨各种场景的稳定重聚焦,为摄影和生成式AI应用提供了对DoF调整的前所未有的控制。

🔬 方法详解

问题定义:论文旨在解决图像的重聚焦问题,即在图像生成后,能够根据用户指定的焦点和模糊程度,灵活地调整图像的景深效果。现有方法通常难以修改已拍摄图像的景深,或者需要复杂的硬件设置。当图像主体失焦时,缺乏有效的后期调整手段。

核心思路:论文的核心思路是利用扩散模型强大的生成能力,学习图像与景深之间的关系,从而实现任意的重聚焦。通过控制扩散过程中的条件(焦点和模糊程度),可以生成具有不同景深效果的图像。为了保证重聚焦结果的物理合理性,引入了堆叠约束,确保不同焦平面的图像可以线性混合成多焦点图像。

技术框架:DiffCamera采用扩散Transformer框架。整体流程包括:1) 使用仿真pipeline生成大规模的训练数据,包含不同焦平面和散景级别的图像对;2) 使用扩散Transformer模型学习从噪声到清晰图像的映射,其中焦点和模糊程度作为条件输入;3) 在训练过程中,引入堆叠约束,强制模型学习物理上合理的重聚焦行为;4) 在推理阶段,用户指定新的焦点和模糊程度,模型生成相应的重聚焦图像。

关键创新:论文的关键创新在于:1) 提出了一种基于扩散Transformer的重聚焦框架,能够实现任意的景深调整;2) 引入了堆叠约束,保证了重聚焦结果的物理合理性,避免了生成不自然的模糊效果;3) 构建了一个大规模的仿真数据集,克服了真实数据难以获取的难题。

关键设计:在训练过程中,堆叠约束通过最小化以下损失函数来实现:L_stack = || sum(w_i * I_i) - I_multi ||,其中I_i表示不同焦平面的图像,w_i表示权重,I_multi表示多焦点图像。扩散Transformer模型的具体结构未知,但应包含编码器-解码器结构,以及注意力机制,用于捕捉图像中的长程依赖关系。

📊 实验亮点

论文通过大量实验验证了DiffCamera的有效性。实验结果表明,DiffCamera能够生成具有逼真景深效果的重聚焦图像,并且在各种场景下都表现出良好的稳定性。与现有方法相比,DiffCamera能够实现更灵活的景深调整,并且避免了生成不自然的模糊效果。论文还构建了一个新的基准,用于评估重聚焦模型的性能。

🎯 应用场景

DiffCamera具有广泛的应用前景,包括:1) 摄影后期处理,允许用户在拍摄后调整焦点,避免因失焦而造成的遗憾;2) 生成式AI,可以用于生成具有逼真景深效果的图像,增强图像的真实感;3) 虚拟现实和增强现实,可以根据用户的视线动态调整焦点,提供更自然的视觉体验。

📄 摘要(原文)

The depth-of-field (DoF) effect, which introduces aesthetically pleasing blur, enhances photographic quality but is fixed and difficult to modify once the image has been created. This becomes problematic when the applied blur is undesirable~(e.g., the subject is out of focus). To address this, we propose DiffCamera, a model that enables flexible refocusing of a created image conditioned on an arbitrary new focus point and a blur level. Specifically, we design a diffusion transformer framework for refocusing learning. However, the training requires pairs of data with different focus planes and bokeh levels in the same scene, which are hard to acquire. To overcome this limitation, we develop a simulation-based pipeline to generate large-scale image pairs with varying focus planes and bokeh levels. With the simulated data, we find that training with only a vanilla diffusion objective often leads to incorrect DoF behaviors due to the complexity of the task. This requires a stronger constraint during training. Inspired by the photographic principle that photos of different focus planes can be linearly blended into a multi-focus image, we propose a stacking constraint during training to enforce precise DoF manipulation. This constraint enhances model training by imposing physically grounded refocusing behavior that the focusing results should be faithfully aligned with the scene structure and the camera conditions so that they can be combined into the correct multi-focus image. We also construct a benchmark to evaluate the effectiveness of our refocusing model. Extensive experiments demonstrate that DiffCamera supports stable refocusing across a wide range of scenes, providing unprecedented control over DoF adjustments for photography and generative AI applications.