PTDiffusion: Free Lunch for Generating Optical Illusion Hidden Pictures with Phase-Transferred Diffusion Model

Xiang Gao, Shuai Yang, Jiaying Liu

Introduction

Optical illusions that embed hidden references within natural scenes—such as a face appearing in a forest or a word formed by mountain ridges—have long fascinated viewers. Creating these "hidden pictures" computationally requires a delicate balance: the hidden structure must be discernible from a distance yet subtle enough to preserve the natural aesthetic of the primary scene. PTDiffusion introduces a novel, training-free approach to this problem, leveraging the phase spectrum of latent features in diffusion models to achieve high-quality synthesis without model fine-tuning.

The Structure-Semantic Conflict

The primary challenge in generating hidden picture illusions is the "structure-semantic conflict." Traditional methods often struggle to integrate a reference geometry (the "hidden" image) into a target scene (the "primary" image) without creating visual artifacts. For instance, tools like ControlNet often impose rigid edges that make the illusion look like a forced overlay, while simple image-to-image methods like SDEdit may lose the reference structure entirely if the text prompt deviates significantly from the source image. PTDiffusion addresses this by moving beyond pixel-wise constraints and focusing on the frequency domain.

Methodology: The Phase Transfer Module (PTM)

The core innovation of PTDiffusion is the Phase Transfer Module (PTM). This module is based on a fundamental principle of digital signal processing: in the Fourier transform of an image, the phase spectrum determines the structural composition (edges and geometry), while the magnitude spectrum determines the style and texture.

PTDiffusion operates across three parallel trajectories within the Latent Diffusion Model (LDM) space:

  1. Inversion Trajectory: The reference image is converted into Gaussian noise.
  2. Reconstruction Trajectory: The reference image is recovered from noise to provide structural "guidance" features.
  3. Sampling Trajectory: A new image is generated based on a text prompt (e.g., "an oil painting of a mountain stream").

During the denoising process, the PTM extracts the phase from the reconstruction trajectory and injects it into the sampling trajectory. This allows the model to "plant" the structure of the reference image into the semantic context of the text-guided scene.

Controlling the Illusion: Asynchrony and Blending

To provide users with control over the visibility of the hidden image, the authors introduced two key mechanisms:

  • Asynchronous Phase Transfer: By transferring phase information from a later step in the reconstruction trajectory to an earlier step in the sampling trajectory (defined by an "async distance" parameter $d$), the structural signal can be strengthened or weakened. This acts as a "transparency" slider for the illusion.
  • Decayed Blending & Refining: To ensure the final output looks natural, the phase injection is gradually reduced as the denoising process nears completion. This "refining" stage allows the diffusion model to autonomously polish textures and lighting, ensuring the final image is a cohesive artistic work rather than a mere composite.

Experimental Evaluation

PTDiffusion was evaluated against several state-of-the-art methods, including ControlNet, SDEdit, and specialized diffusion techniques like PAP and FBSDiff. Using a dataset of 80 reference images (faces, animals, text) and various artistic prompts, the researchers found that PTDiffusion consistently outperformed competitors.

  • Quantitative Performance: The method achieved a top Aesthetic Score of 6.37 and a CLIP Score of 0.31, indicating a superior balance between visual beauty and adherence to the text prompt.
  • Qualitative Harmony: Unlike the "ghostly" overlays often produced by ControlNet, PTDiffusion’s results appear as genuine landscapes where the hidden structure emerges naturally from the environment's elements, such as the specific placement of trees or rocks.
  • User Preference: A study involving 16 participants confirmed that PTDiffusion was significantly preferred for its "Contextual Naturalness" and "Illusion Balance."

Conclusion and Future Work

PTDiffusion offers a "free lunch" for creators, providing a plug-and-play module that requires zero optimization or additional training. While currently dependent on the underlying base model (such as Stable Diffusion v1.5), the method demonstrates the power of frequency-domain manipulation in generative AI. Future work will focus on extending the method to more advanced architectures like SDXL and automating the selection of hyperparameters to make the tool more accessible to non-expert users.

Summary updated

BibTeX
@inproceedings{gao2025ptdiffusion,
  author = {Xiang Gao and Shuai Yang and Jiaying Liu},
  title = {{PTDiffusion: Free Lunch for Generating Optical Illusion Hidden Pictures with Phase-Transferred Diffusion Model}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2025},
  doi = {10.1109/cvpr52734.2025.01700},
}
Figure