Abstract
Integrating a foreground object into a background scene with illumination harmonization is an important but challenging task in computer vision and augmented reality community. Existing methods mainly focus on foreground and background appearance consistency or the foreground object shadow generation, which rarely consider global appearance and illumination harmonization. In this paper, we formulate seamless illumination harmonization as an illumination exchange and aggregation problem. Specifically, we firstly apply a physically-based rendering method to construct a large-scale, high-quality dataset (named IH) for our task, which contains various types of foreground objects and background scenes with different lighting conditions. Then, we propose a deep image-based illumination harmonization GAN framework named DIH-GAN, which makes full use of a multi-scale attention mechanism and illumination exchange strategy to directly infer mapping relationship between the inserted foreground object and the corresponding background scene. Meanwhile, we also use adversarial learning strategy to further refine the illumination harmonization result. Our method can not only achieve harmonious appearance and illumination for the foreground object but also can generate compelling shadow cast by the foreground object. Comprehensive experiments on both our IH dataset and real-world images show that our proposed DIH-GAN provides a practical and effective solution for image-based object illumination harmonization editing, and validate the superiority of our method against state-of-the-art methods.
Introduction
A common operation in image editing is the composition of a foreground object into a new background scene. However, simple "cut and paste" operations often result in visual inconsistencies because the lighting on the object does not match the environmental illumination of the target scene. Furthermore, the absence of realistic shadows further degrades the perceived realism. Achieving "illumination harmonization"—where the object's appearance and its cast shadows are consistent with the new environment—is a fundamental challenge in computer vision.
Traditional approaches often rely on inverse rendering to estimate 3D geometry, material properties, and light sources. These methods are computationally expensive and prone to errors in estimation, which lead to "uncanny" results. In contrast, we propose DIH-GAN, an end-to-end deep learning framework that bypasses explicit 3D reconstruction by learning illumination mapping directly from image data.
Methodology: The DIH-GAN Framework
DIH-GAN is a Generative Adversarial Network designed for multi-task collaboration, consisting of two primary parallel branches:
- Relighting Network (R-Network): This branch processes global image features to generate the final relighted composite. It utilizes a U-Net-style architecture enhanced with a multi-scale attention mechanism. This allows the network to selectively refine features and accurately place shadows based on the background context.
- Illumination Network (I-Network): This branch predicts illumination maps for both the foreground object and the background scene.
- Illumination Exchange Mechanism: At the heart of our approach is a strategy that extracts illumination features from the background and "exchanges" them with the foreground object's features. This guides the R-Network to apply the correct environmental lighting to the inserted object.
The framework is optimized using a multi-component loss function, including reconstruction loss ($L_1$), perceptual loss for semantic consistency, adversarial loss for realism, and a specialized non-illumination feature loss based on Retinex theory to preserve the object's intrinsic reflectance.
The IH Dataset
To train a robust model, we developed the IH Dataset, a large-scale benchmark for illumination harmonization. This dataset addresses the lack of high-quality training data in the field:
- Scale and Diversity: The dataset contains 89,898 six-tuples, including naive composites, masks, and ground truth relighted images.
- Data Generation: We utilized 2,686 high-quality HDR panoramas for realistic lighting environments and 60 diverse 3D models.
- Physically-Based Rendering: Using Blender, we generated ground truth examples that provide a gold standard for how objects should appear under specific lighting conditions, enabling effective supervised learning.
Experimental Results
We evaluated DIH-GAN against several state-of-the-art methods, including DoveNet (harmonization) and ARShadowGAN (shadow generation).
Quantitative Evaluation
DIH-GAN outperformed existing methods across all key metrics on the IH dataset. It achieved a Root Mean Square Error (RMSE) of 6.421 and a fractional Structural Similarity Index (fSSIM) of 0.882, indicating superior accuracy in both color matching and structural preservation.
Qualitative and Perceptual Analysis
Visual comparisons demonstrate that DIH-GAN produces more realistic shadows and better lighting integration than competing methods, which often produce "flat" or incorrectly lit objects. In a perceptual study involving 100 participants, 44.2% of DIH-GAN's results were judged as "real," approaching the 52.4% baseline for actual real-world photographs.
Conclusion and Future Work
DIH-GAN provides a practical, image-based solution for seamless object integration. By treating illumination as a transferable property through an exchange mechanism, it achieves high-quality relighting and shadow generation without explicit 3D modeling.
Current limitations include a bias toward outdoor scenes and simplified planar shadow assumptions. Future research will focus on extending this framework to complex indoor environments with multiple point-light sources and improving shadow generation for non-planar surfaces and video sequences.
Summary updated