SemanticStitch: enhancing image coherence through foreground-aware seam carving

Ji-Ping Jin, Chen-Bin Feng, Rui Fan, Chi-Man Vong

Here is a concise, engaging summary of the paper "SemanticStitch: Enhancing Image Coherence through Foreground-Aware Seam Carving" tailored for a technically literate audience.

TL;DR

SemanticStitch is a novel deep learning framework for image stitching that preserves the semantic integrity of foreground objects by preventing seam lines from cutting through them. By combining a Transformer-based salient object detector with an area-based dynamic mask optimization loss, it achieves state-of-the-art visual coherence while dramatically reducing computational costs compared to existing deep learning methods.

What Problem Does This Paper Address?

Image stitching combines multiple overlapping photos into a single panoramic view. However, variations in camera angles, parallax, and moving objects often introduce severe misalignments and ghosting artifacts.

Traditional solutions rely on seam carving techniques like Graph Cut or Dynamic Programming to find an optimal path where the images can be joined seamlessly. The core limitation of these traditional methods is their semantic blindness: they optimize purely for low-level pixel features like color and gradient differences. As a result, the calculated seam lines frequently slice right through prominent foreground objects (e.g., cutting a pedestrian or a vehicle in half), destroying the visual continuity and realism of the final panorama.

Methods

SemanticStitch addresses this by introducing a three-stage, foreground-aware deep learning framework:

  1. Image Alignment Module: Uses a ResNet50 backbone to perform multi-scale feature extraction, progressively regressing a 4-point homography to coarsely warp and align the target and reference images.
  2. Salient Object Detector: Utilizes a Transformer-based network (SelfReformer) with a Pyramid Vision Transformer encoder to capture long-range dependencies and generate accurate semantic masks for foreground objects in both images. These are combined into a union mask ($M_{object}$).
  3. Object-Aware Seam Identification Module: Refines the features using a U-Net-like architecture optimized by the FastViT architecture to predict soft-coded seam masks ($L_1, L_2$) rather than rigid binary masks, allowing for smooth gradients and end-to-end backpropagation.
Overview of the proposed SemanticStitch architecture.

The Composite Coverage Loss

The framework's secret sauce is its novel loss function, which dynamically guides the seam line away from critical objects:

  • Dynamic Mask Optimization Loss ($L_{comp}$): Instead of using a static mask selection, it dynamically calculates the intersection area of the learned masks with the foreground object mask. It then prioritizes optimizing the mask that naturally covers the object better, minimizing background tearing.
  • Object Exclusivity Loss ($L_{excl}$): Ensures that the second learned mask does not overlap and obscure the target foreground object.
  • Smoothness Loss ($L_{smooth}$): Penalizes abrupt changes in mask values to ensure smooth transitions along the seam boundaries.

Datasets

The authors trained their network on the standard UDIS-D dataset (10,440 image pairs). However, because existing benchmarks lack complex scenarios where seams intersect moving objects, they introduced two new specialized evaluation datasets:

  • DAVISProcessed10: 1,770 image pairs generated by sampling the first and last frames of every 10-frame sequence from the DAVIS video dataset to simulate object displacement and camera angle variations.
  • RealWorld400: 400 paired real-world testing images featuring prominent foreground objects across diverse indoor, outdoor, daytime, and nighttime environments.
Overview and statistics of the newly introduced datasets.

Key Insights and Ideas

  • Dynamic vs. Static Masking: Traditional deep learning stitching often suffers from background tearing because it applies static mask constraints. By dynamically choosing the mask with the higher object overlap area during optimization, SemanticStitch lets the network naturally decide which source image provides the cleanest view of the foreground object.
  • Efficiency via Structural Reparameterization: By incorporating the FastViT architecture into the seam identification module, the network achieves massive computational savings without sacrificing performance, proving that semantic awareness doesn't require heavy computational overhead.

Key Results

  • Quantitative Superiority: SemanticStitch consistently outperformed traditional methods (Graph Cut, DP, Voronoi) and recent deep learning methods (UDIS++, TRIS, Recdiffusion) across three no-reference image quality metrics (NIQE, BRISQUE, PIQE) and the Perceptual Seam Quality (PSQ) metric across all datasets.
  • Massive Speedup: For a $512 \times 512$ image, SemanticStitch reduced the computational cost from UDIS++'s 80.46 GFLOPs down to just 10.77 GFLOPs while maintaining a similar parameter count (~33.5M).
  • Qualitative Excellence: Qualitative evaluations and user studies (50 participants) confirmed that the proposed method effectively prevents foreground object truncation and ghosting artifacts.
Detailed comparative results showing how SemanticStitch avoids truncating foreground objects compared to other mainstream methods.

Limitations and Future Work

While SemanticStitch excels at preserving the integrity of foreground objects, the authors note a trade-off: prioritizing the foreground can sometimes introduce noticeable segmentation artifacts or edge discontinuities at the boundary regions where the two images meet. Future work will likely focus on better balancing foreground object constraints with global boundary smoothing techniques.

Summary updated

BibTeX
@article{jin2026semanticstitch,
  author = {Ji-Ping Jin and Chen-Bin Feng and Rui Fan and Chi-Man Vong},
  title = {{SemanticStitch: enhancing image coherence through foreground-aware seam carving}},
  journal = {The Visual Computer},
  year = {2026},
  doi = {10.1007/s00371-025-04222-y},
}
Figure