Papers
Topics
Authors
Recent
Search
2000 character limit reached

Convexified Shape Layers & Depth Ordering

Updated 18 January 2026
  • The paper presents a vectorization framework that decomposes quantized raster images into scalable vector shape layers with an explicit, energy-driven depth order.
  • It employs curvature-based convexification via variational inpainting to remove pixelation while preserving boundary smoothness and accurate occlusion relationships.
  • The pipeline integrates combinatorial graph construction, efficient Bézier curve fitting, and SVG export, achieving lower MSE and faster performance compared to previous methods.

Convexified shape layers with depth ordering is a framework for image vectorization that decomposes a color-quantized raster image into scalable vector shape layers with an explicit, energy-driven global depth order. The methodology integrates combinatorial graph construction, convexification via variational inpainting, and scalable SVG export with layer semantics. This approach addresses both the removal of pixelization and the preservation of boundary smoothness while simultaneously encoding relative depth relationships among segmented shapes. The pipeline leverages curvature-based inpainting to convexify occluded shapes, following a depth order inferred by pairwise covered-area measures, and outputs vector graphics amenable to editing and semantic grouping (Law et al., 2024).

1. Depth-Ordering Energy

Given an image grid Ω⊂Z2\Omega \subset \mathbb{Z}^2 and a KK-color quantization f:Ω→{cℓ}ℓ=1Kf:\Omega\to\{c_\ell\}_{\ell=1}^K, each connected component Si⊂ΩS_i \subset \Omega of a single color defines a shape layer with binary mask χi(x)=1Si(x)\chi_i(x) = 1_{S_i}(x). The pairwise covered-area measure for i≠ji \neq j is

A(i,j)=∫Ωχi(x) χjConv(x) dx∫Ωχi(x) dx∈[0,1],A(i,j) = \frac{\int_\Omega \chi_i(x)\,\chi_j^{\rm Conv}(x)\,dx}{\int_\Omega \chi_i(x)\,dx} \in [0,1],

where χjConv\chi_j^{\rm Conv} is the convex hull mask of SjS_j. This quantifies the fraction of SiS_i's area occluded by KK0's convex hull. The depth-ordering energy is then

KK1

Thresholding KK2 by KK3 leads to directed edges in a shape graph: if KK4, KK5 is above KK6; if KK7, KK8 above KK9; otherwise, no order is set. The resulting directed graph f:Ω→{cℓ}ℓ=1Kf:\Omega\to\{c_\ell\}_{\ell=1}^K0, with nodes for each f:Ω→{cℓ}ℓ=1Kf:\Omega\to\{c_\ell\}_{\ell=1}^K1, may have cycles. Cycles are broken by identifying the edge f:Ω→{cℓ}ℓ=1Kf:\Omega\to\{c_\ell\}_{\ell=1}^K2 in each cycle maximizing the convex-hull symmetric difference

f:Ω→{cℓ}ℓ=1Kf:\Omega\to\{c_\ell\}_{\ell=1}^K3

and removing edges accordingly until f:Ω→{cℓ}ℓ=1Kf:\Omega\to\{c_\ell\}_{\ell=1}^K4 is acyclic. A topological sort extracts the linear order f:Ω→{cℓ}ℓ=1Kf:\Omega\to\{c_\ell\}_{\ell=1}^K5. These steps involve combinatorial operations: Graham scan for convex hulls f:Ω→{cℓ}ℓ=1Kf:\Omega\to\{c_\ell\}_{\ell=1}^K6, raster intersections for area calculations, and no continuous optimization.

2. Curvature-Based Convexification via Inpainting

Given the total order f:Ω→{cℓ}ℓ=1Kf:\Omega\to\{c_\ell\}_{\ell=1}^K7, each f:Ω→{cℓ}ℓ=1Kf:\Omega\to\{c_\ell\}_{\ell=1}^K8 is convexified into f:Ω→{cℓ}ℓ=1Kf:\Omega\to\{c_\ell\}_{\ell=1}^K9, constrained to only grow into occluded regions

Si⊂ΩS_i \subset \Omega0

where Si⊂ΩS_i \subset \Omega1 groups small, spurious regions. The minimization target is Euler’s elastica energy,

Si⊂ΩS_i \subset \Omega2

for positive Si⊂ΩS_i \subset \Omega3 and curvature Si⊂ΩS_i \subset \Omega4, promoting smooth, near-convex boundaries into Si⊂ΩS_i \subset \Omega5.

The sharp-interface elastica formulation is approximated with a Modica–Mortola diffuse interface:

  • The phase field Si⊂ΩS_i \subset \Omega6 satisfies Si⊂ΩS_i \subset \Omega7 inside, Si⊂ΩS_i \subset \Omega8 outside.
  • The double-well potential Si⊂ΩS_i \subset \Omega9 penalizes intermediate values.

Diffuse elastica energy: χi(x)=1Si(x)\chi_i(x) = 1_{S_i}(x)0 subject to χi(x)=1Si(x)\chi_i(x) = 1_{S_i}(x)1 on χi(x)=1Si(x)\chi_i(x) = 1_{S_i}(x)2 and χi(x)=1Si(x)\chi_i(x) = 1_{S_i}(x)3 on χi(x)=1Si(x)\chi_i(x) = 1_{S_i}(x)4. As χi(x)=1Si(x)\chi_i(x) = 1_{S_i}(x)5, this χi(x)=1Si(x)\chi_i(x) = 1_{S_i}(x)6-converges to sharp-interface elastica plus fidelity at inpainting data χi(x)=1Si(x)\chi_i(x) = 1_{S_i}(x)7.

The solver introduces χi(x)=1Si(x)\chi_i(x) = 1_{S_i}(x)8 and splits the problem into two linear subproblems, each efficiently solved by FFT due to the choice of Laplacian discretization and Dirichlet boundary conditions. Thresholding χi(x)=1Si(x)\chi_i(x) = 1_{S_i}(x)9 yields the convexified region i≠ji \neq j0.

3. Bézier Curve Fitting and SVG Layered Export

The boundary of i≠ji \neq j1 is extracted as the zero-level set i≠ji \neq j2, then sampled into a closed, ordered set of points i≠ji \neq j3. Discrete curvature,

i≠ji \neq j4

is computed at each sample to identify curvature extrema above threshold i≠ji \neq j5, which demarcate Bézier curve segments.

For each segment, cubic Bézier curves with control points i≠ji \neq j6 are fitted via least-squares minimization,

i≠ji \neq j7

with i≠ji \neq j8 the normalized arc-length parameter of each point. Segments with Hausdorff distance exceeding a threshold i≠ji \neq j9 are subdivided and re-fitted recursively.

SVG export creates one <path> element per fitted Bézier, grouped by shape-layer index A(i,j)=∫Ωχi(x) χjConv(x) dx∫Ωχi(x) dx∈[0,1],A(i,j) = \frac{\int_\Omega \chi_i(x)\,\chi_j^{\rm Conv}(x)\,dx}{\int_\Omega \chi_i(x)\,dx} \in [0,1],0. Layers are ordered in SVG z-order according to reverse A(i,j)=∫Ωχi(x) χjConv(x) dx∫Ωχi(x) dx∈[0,1],A(i,j) = \frac{\int_\Omega \chi_i(x)\,\chi_j^{\rm Conv}(x)\,dx}{\int_\Omega \chi_i(x)\,dx} \in [0,1],1 (bottom-to-top). Each path is filled with its original color A(i,j)=∫Ωχi(x) χjConv(x) dx∫Ωχi(x) dx∈[0,1],A(i,j) = \frac{\int_\Omega \chi_i(x)\,\chi_j^{\rm Conv}(x)\,dx}{\int_\Omega \chi_i(x)\,dx} \in [0,1],2 and full opacity; SVG <g> wrappers encode grouping for semantic units.

4. Algorithmic Workflow and Computational Complexity

The vectorization procedure follows:

  1. Color quantization (K-means) yielding A(i,j)=∫Ωχi(x) χjConv(x) dx∫Ωχi(x) dx∈[0,1],A(i,j) = \frac{\int_\Omega \chi_i(x)\,\chi_j^{\rm Conv}(x)\,dx}{\int_\Omega \chi_i(x)\,dx} \in [0,1],3.
  2. Extraction of shape layers A(i,j)=∫Ωχi(x) χjConv(x) dx∫Ωχi(x) dx∈[0,1],A(i,j) = \frac{\int_\Omega \chi_i(x)\,\chi_j^{\rm Conv}(x)\,dx}{\int_\Omega \chi_i(x)\,dx} \in [0,1],4; denoising forms A(i,j)=∫Ωχi(x) χjConv(x) dx∫Ωχi(x) dx∈[0,1],A(i,j) = \frac{\int_\Omega \chi_i(x)\,\chi_j^{\rm Conv}(x)\,dx}{\int_\Omega \chi_i(x)\,dx} \in [0,1],5.
  3. For all A(i,j)=∫Ωχi(x) χjConv(x) dx∫Ωχi(x) dx∈[0,1],A(i,j) = \frac{\int_\Omega \chi_i(x)\,\chi_j^{\rm Conv}(x)\,dx}{\int_\Omega \chi_i(x)\,dx} \in [0,1],6: compute convex hulls, A(i,j)=∫Ωχi(x) χjConv(x) dx∫Ωχi(x) dx∈[0,1],A(i,j) = \frac{\int_\Omega \chi_i(x)\,\chi_j^{\rm Conv}(x)\,dx}{\int_\Omega \chi_i(x)\,dx} \in [0,1],7, and A(i,j)=∫Ωχi(x) χjConv(x) dx∫Ωχi(x) dx∈[0,1],A(i,j) = \frac{\int_\Omega \chi_i(x)\,\chi_j^{\rm Conv}(x)\,dx}{\int_\Omega \chi_i(x)\,dx} \in [0,1],8; build directed graph A(i,j)=∫Ωχi(x) χjConv(x) dx∫Ωχi(x) dx∈[0,1],A(i,j) = \frac{\int_\Omega \chi_i(x)\,\chi_j^{\rm Conv}(x)\,dx}{\int_\Omega \chi_i(x)\,dx} \in [0,1],9.
  4. Remove cycles in χjConv\chi_j^{\rm Conv}0 by deleting maximal χjConv\chi_j^{\rm Conv}1 edges; topologically sort to obtain χjConv\chi_j^{\rm Conv}2.
  5. For each χjConv\chi_j^{\rm Conv}3 (following χjConv\chi_j^{\rm Conv}4): construct occlusion mask χjConv\chi_j^{\rm Conv}5; solve diffuse elastica χjConv\chi_j^{\rm Conv}6 with FFT splitting; extract χjConv\chi_j^{\rm Conv}7; sample boundary and curvature extrema; fit cubic Béziers.
  6. Export SVG, stacking layers by χjConv\chi_j^{\rm Conv}8.

Computational complexity per stage:

  • Convex hull per shape: χjConv\chi_j^{\rm Conv}9.
  • Pairwise measures: SjS_j0.
  • Cycle removal: SjS_j1.
  • Inpainting: SjS_j2 per shape.
  • Bézier fitting: linear in boundary length.

For typical settings (SjS_j3–SjS_j4, image size SjS_j5), the entire pipeline executes in tens of seconds on modern CPUs. The iterative elastica solver converges in SjS_j6–SjS_j7 iterations, with SjS_j8-convergence ensuring alignment with the sharp-interface elastica minimizer as SjS_j9.

5. Empirical Comparison with Prior Layered Vectorization Methods

Quantitative and qualitative performance was assessed against LIVE [Ma et al. 2022], DiffVG [Li et al. 2020], and LIVSS [Wang et al. 2024] on benchmark scenes (e.g., SiS_i0 pixels). Representative numeric results:

Method # Bézier Curves MSE↓ PSNR↑ Time (s)
Ours (≈7 layers) 93 13.4 41.6 dB 37
LIVE (32 paths) 128 28.6 38.3 dB 20,640
DiffVG (128 paths) 517 71.4 34.4 dB 194
LIVSS 200–500 – – 888

This framework accurately recovers the correct depth ordering of occluded regions, yields fewer Bézier segments per semantic shape, produces lower rasterization error (MSE) than LIVE and DiffVG, and executes SiS_i1–SiS_i2 faster than LIVE in experimental runs.

Limitations include instability for quantizations generating very small noisy shapes (mitigated by pre-grouping), potential over-convexification of highly concave objects, and sensitivity to pairwise area cues where T-junctions are ambiguous.

6. Theoretical and Practical Implications

By convexifying image shape layers and establishing explicit, globally consistent depth orderings, this approach offers a principled tool for producing editable vector representations, compatible with human visual perceptual biases (e.g., boundary smoothness, convex completion). The integration of variational inpainting and combinatorial depth inference differentiates this pipeline from previous layer-based vectorization techniques.

The methodology is closely tied to SiS_i3-convergence theory (ensuring the diffuse interface energy converges to the elastica), links to raster-to-vector learning paradigms, and provides a foundation for further integration of learned depth cues, interactive layer annotation, or GPU-accelerated elastica solvers. Grouping of shape layers for semantic vectorization is also considered, suggesting directions for future work in semantic abstraction and user-guided editing (Law et al., 2024).

Definition Search Book Streamline Icon: https://streamlinehq.com
References (1)

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Convexified Shape Layers with Depth Ordering.