Deep Video Harmonization With Color Mapping Consistency

Xinyuan Lu, Shengyuan Huang, Li Niu, Wenyan Cong, Liqing Zhang

Abstract

Video harmonization is the process of adjusting the appearance of a foreground object to match a new background video, ensuring seamless integration. While image-based harmonization has seen significant progress, video harmonization introduces the critical challenge of temporal consistency. Traditional methods relying on optical flow are often computationally expensive and prone to artifacts. This paper introduces CO2Net (COlor mapping COnsistency Network), a novel framework that achieves temporal stability by leveraging global color mapping statistics. Additionally, we present HYouTube, the first large-scale public dataset specifically curated for training and evaluating video harmonization models.

Introduction

When a foreground object is composited into a different background, discrepancies in lighting, color temperature, and saturation often result in a visual mismatch. Video harmonization aims to rectify these differences. However, applying image harmonization techniques frame-by-frame typically results in "flickering"—high-frequency temporal inconsistencies that are highly distracting to viewers.

Existing solutions to this problem frequently utilize optical flow to track pixels across frames, ensuring that the harmonization remains smooth over time. Unfortunately, optical flow is computationally intensive and often fails in complex scenes with occlusions or rapid movement. Furthermore, the development of video harmonization has been hindered by the lack of a standardized, large-scale public dataset. This work addresses both the algorithmic and data-driven gaps in the field.

The HYouTube Dataset

To facilitate progress in video harmonization, the authors developed HYouTube, the first public dataset of its kind. Built upon the YouTube-VOS 2018 dataset, HYouTube contains 3,194 pairs of synthetic composite videos and their corresponding real-world ground truths.

To create realistic training data, the researchers employed a "de-harmonization" strategy. They took original, high-quality videos and applied 100 diverse, manually selected 3D Lookup Tables (LUTs) to the foreground objects. This process creates a realistic mismatch between the foreground and background while preserving the original video as a perfect ground truth for the model to reconstruct.

Methodology: CO2Net

CO2Net moves away from spatial pixel-tracking in favor of a "correspondence-free" approach based on the insight that while pixels move, the global color transformation required for harmonization should remain stable across adjacent frames.

Color Mapping Consistency

The framework operates on the principle that the ideal color mapping for a target frame can be informed by its neighbors. If an image harmonization network provides a reasonably accurate (though perhaps slightly inconsistent) result for several frames, the aggregate color statistics of those frames can serve as a stabilizing anchor.

Architecture

The CO2Net architecture consists of three primary components:

  1. Backbone Network: An existing image harmonization model (such as iS2AM or RainNet) provides an initial harmonized estimate for the current frame.
  2. LUT Branch: The system calculates a 3D Lookup Table (LUT) based on the harmonized versions of neighboring frames. This LUT represents the optimal color transformation for the current temporal window.
  3. Refinement Module: A lightweight convolutional module integrates the initial backbone estimate, the LUT-transformed result, and internal features to produce the final, flicker-free frame.

This heuristic approach to LUT calculation avoids complex optimization problems, making the refinement process extremely fast and adding negligible overhead to the base network.

Experimental Results

CO2Net was evaluated against several state-of-the-art baselines using both quantitative metrics and user studies.

Quantitative Performance

Using the iS2AM backbone, CO2Net achieved a Foreground Mean Squared Error (fMSE) of 186.72, a significant improvement over the 203.77 achieved by the frame-by-frame approach. More importantly, the model excelled in temporal stability. The Temporal Loss (TL), which measures flickering, was recorded at 5.11 for CO2Net. In contrast, individual frame harmonization using DoveNet spiked the error to 13.86, demonstrating the effectiveness of the color mapping consistency approach.

Qualitative and Efficiency Gains

In user studies, participants consistently ranked CO2Net's outputs as more realistic and temporally stable than previous methods. Furthermore, because the model avoids the use of optical flow, it maintains high efficiency, making it suitable for practical video editing workflows.

Conclusion and Future Work

CO2Net demonstrates that global color statistics can provide a robust and efficient alternative to pixel-tracking for maintaining temporal consistency in video harmonization. By introducing the HYouTube dataset, the authors have also provided a vital resource for the research community.

However, the method is currently limited by its backbone dependency; if the underlying image harmonization network fails significantly on a specific sequence, the LUT-based refinement may lack the necessary information to correct the output. Future research may explore end-to-end architectures that integrate temporal consistency checks deeper into the initial harmonization process to further improve robustness in extreme lighting conditions.

Summary updated

BibTeX
@inproceedings{lu2022deep,
  author = {Xinyuan Lu and Shengyuan Huang and Li Niu and Wenyan Cong and Liqing Zhang},
  title = {{Deep Video Harmonization With Color Mapping Consistency}},
  booktitle = {International Joint Conference on Artificial Intelligence},
  year = {2022},
  doi = {10.24963/ijcai.2022/172},
}
Figure