NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Image Matting with Local and Nonlocal Smooth Priors

Xiaowu Chen, Dongqing Zou, Steven Zhiying Zhou, Qinping Zhao, Ping Tan

Introduction

Extracting a foreground object from a background—a process known as image matting—remains a fundamental challenge in computer vision. The goal is to calculate an "alpha matte," a grayscale mask representing the opacity of the foreground at every pixel. This paper introduces a novel framework that unifies local and nonlocal smooth priors into a single graph-based model. By combining the strengths of traditional local smoothness with long-range color consistencies, the proposed method achieves state-of-the-art performance on industry-standard benchmarks.

The Challenge of Image Matting

Mathematically, image matting is an ill-posed problem. For every pixel, we are given a single color value but must solve for three unknowns: the foreground color, the background color, and the alpha value. To resolve this ambiguity, researchers rely on "priors" or assumptions about the image structure.

Traditional approaches typically utilize local priors, assuming that alpha values change smoothly within small, immediate neighborhoods. However, these methods often struggle with complex textures or require precise "window size" tuning; a window that is too small misses broader context, while one that is too large can violate the underlying color assumptions. Conversely, nonlocal priors can link distant pixels with similar colors, but they frequently fail to accurately model semi-transparent regions.

A Unified Graph Model

The authors propose a unified graph model that balances three distinct components to overcome these limitations:

  1. Local Smooth Term: This utilizes the well-known "matting Laplacian," which enforces smoothness within a $3 \times 3$ window based on the color line model. This term is excellent at capturing fine, fuzzy boundaries.
  2. Nonlocal Smooth Term: The method adapts a manifold-preserving propagation technique. Pixels are treated as points in a high-dimensional feature space (RGB color + XY coordinates). By finding the $K$ nearest neighbors for each pixel—regardless of their spatial distance—the model ensures that similar colors across the image maintain consistent alpha values.
  3. Data Term (Color Sampling): An initial alpha estimate is generated using a simple sampling method (via the FLANN library), which looks at nearby known foreground and background pixels defined in a user-provided trimap.
Conceptual overview of local vs. nonlocal priors. (a) Image space neighborhoods. (b) Manifold-preserving nonlocal links.

These components are integrated into a quadratic energy function. Because the resulting function is quadratic, the optimal alpha matte can be found by solving a single large system of linear equations. This provides a closed-form solution that is both globally optimal for the defined energy and computationally efficient.

Key Insights

The core innovation lies in the complementary strengths of the two priors. The local Laplacian handles semi-transparent boundaries where colors blend, while the nonlocal manifold prior ensures global consistency—for example, ensuring that disconnected parts of a single object (like leaves on opposite sides of a tree) share consistent alpha values.

Furthermore, by incorporating the nonlocal term, the method becomes significantly less sensitive to the choice of local window size, a common pain point in traditional matting algorithms. The use of the RGBXY feature space effectively propagates information across the entire image lattice based on color similarity rather than just spatial proximity.

Results and Evaluation

The method was rigorously evaluated using the alphamatting.com benchmark, the industry standard for the field. This dataset includes challenging subjects such as hair, fine nets, and transparent objects.

Qualitative comparison against existing methods on the alphamatting.com benchmark.

At the time of publication, the proposed method achieved the #1 ranking on the global benchmark for three out of four primary metrics:

  • SAD (Sum of Absolute Differences): Best performance.
  • MSE (Mean Squared Error): Best performance.
  • Gradient Error: Best performance.
  • Connectivity Error: Ranked 3rd.

Qualitatively, the method excels at "difficult" images, such as nets with intricate holes or semi-transparent plastic bags, where previous methods often produced noisy or disconnected results.

Conclusion and Future Work

While the method swept the top spots for accuracy, its third-place ranking in "connectivity error" suggests that it may occasionally create small, disconnected fragments in the matte. Future work could involve integrating more sophisticated color sampling techniques into the graph model or optimizing the linear solver for higher-resolution images. Nonetheless, the unification of local and nonlocal priors represents a significant step forward in robust, high-quality image matting.

Summary updated

BibTeX
@inproceedings{chen2013image,
  author = {Xiaowu Chen and Dongqing Zou and Steven Zhiying Zhou and Qinping Zhao and Ping Tan},
  title = {{Image Matting with Local and Nonlocal Smooth Priors}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2013},
  doi = {10.1109/cvpr.2013.248},
}
Figure