A fast algorithm for elastic shape distances between closed planar curves

Günay Dogan, Javier Bernal, Charles R. HagwoodCVPR 2015

Abstract

Comparing closed planar curves is a fundamental task in computer vision and geometric morphometrics. However, the computational cost of finding optimal reparametrizations—aligning points along curves to minimize distance—has historically been a significant bottleneck, scaling at $O(N^3)$. This paper presents a novel iterative algorithm that reduces this complexity to approximately $O(N^2)$, and often near-linear in practice. By combining a restricted-search Dynamic Programming (DP) initialization with a fast nonlinear optimizer that utilizes $O(N)$ gradient and Hessian calculations, the proposed method achieves order-of-magnitude speedups and improved accuracy over traditional discrete DP approaches.

Introduction: The Reparametrization Bottleneck

In shape analysis, comparing two objects requires invariance to position, scale, rotation, and reparametrization. The "elastic" framework treats curves as points on an infinite-dimensional manifold, where the distance is defined by the geodesic path deforming one shape into another. The primary mathematical challenge is finding the optimal reparametrization—essentially sliding points along one curve to best match the other. Prior state-of-the-art methods relied on Dynamic Programming (DP) with $O(N^3)$ complexity, making analysis of high-resolution curves or large databases computationally prohibitive.

Methodology: A Two-Stage Optimization

The authors propose a "coarse-to-fine" strategy that decouples the search for the starting point and rotation from the search for the optimal reparametrization.

1. Fast Dynamic Programming (Initialization)

Instead of searching the entire $N \times N$ grid of possible point matches, the algorithm restricts the search to a narrow strip of width $d$ around the diagonal. This "Fast-DP" step provides a rapid, global approximation of the optimal reparametrization.

Restricted search space in Fast-DP

2. Iterative Nonlinear Refinement

The Fast-DP result serves as the starting point for a constrained nonlinear optimizer (specifically, an interior-point method). The "secret sauce" of this optimization is the derivation of formulas for the energy gradient and Hessian-vector products that can be computed in $O(N)$ time using cumulative sums (cumsum). This allows the optimizer to reach a precise minimum in continuous space much faster than standard gradient descent or full-grid DP.

Experimental Evaluation

The algorithm was evaluated on a diverse set of data, including synthetic shapes (ellipses, limaçons, epitrochoids) for accuracy testing, biological boundary curves of various cell types, and standard computer vision benchmarks like the MPEG-7 and Leaf datasets.

Key Results: Speed and Precision

Empirical tests demonstrated that the new algorithm scales sub-quadratically, showing a nearly linear trend in running time as the number of nodes increases.

Performance comparison across datasets

As shown in the performance tables, for curves with $N=4096$ nodes, the original $O(N^3)$ algorithm required approximately 93 seconds, while the new fast-DP+iter approach finished in roughly 6 seconds—a 13x to 15x speedup. Furthermore, the iterative optimizer often found lower energy values (better matches) than the original DP because it operates in continuous space, bypassing the limitations of a discrete node grid.

Conclusion

By exploiting the mathematical structure of the shape-matching energy functional, the authors developed a highly efficient algorithm that makes large-scale elastic shape analysis feasible. While currently focused on 2D planar curves, the $O(N)$ gradient and Hessian techniques provide a promising foundation for future extensions to 3D surfaces and more complex manifolds.

Summary updated

BibTeX
@inproceedings{dogan2015fast,
  author = {Günay Dogan and Javier Bernal and Charles R. Hagwood},
  title = {{A fast algorithm for elastic shape distances between closed planar curves}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2015},
  doi = {10.1109/cvpr.2015.7299050},
}
Figure