The aim of this paper is to find an optimal matching between manifold-valued curves, and thereby adequately compare their shapes, seen as equivalent classes with respect to the action of reparameterization. Using a canonical decomposition of a path in a principal bundle, we introduce a simple algorithm that finds an optimal matching between two curves by computing the geodesic of the infinite-dimensional manifold of curves that is at all time horizontal to the fibers of the shape bundle. We focus on the elastic metric studied in [10] using the so-called square root velocity framework. The quotient structure of the shape bundle is examined, and in particular horizontality with respect to the fibers. These results are more generally given for any elastic metric. We then introduce a comprehensive discrete framework which correctly approximates the smooth setting when the base manifold has constant sectional curvature. It is itself a Riemannian structure on the product manifold M n of "discrete curves" given by n points, and we show its convergence to the continuous model as the size n of the discretization goes to ∞. Illustrations of optimal matching between discrete curves are given in the hyperbolic plane, the plane and the sphere, for synthetic and real data, and comparison with dynamic programming [16] is established. c (u), or when there is no ambiguity on the choice of the curve c, u t1,t2 , or even u to lighten notations in some cases. We associate to each curve c its renormalized speed vector field v := c /|c |, and to each vector field t → w(t) along c, its tangential and normal components w T := w, v v and w N := w − w T . Finally, for all x ∈ M we denote by exp x : T x M → M the exponential map on M and by log x : M → T x M its inverse map. 2.2 The space of smooth parameterized curves 2.2.1 The Riemannian structure We represent open oriented curves in M by smooth immersions, i.e. smooth curves with velocity that doesn't vanish. The set M of smooth immersions in M is an open submanifold of the Fréchet manifold C ∞ ([0, 1], M ) [14] and its tangent space at a point c is the set of infinitesimal deformations of c, which can be seen as vector fields along the curve c in M M = {c ∈ C ∞ ([0, 1], M )|c (t) = 0, ∀t ∈ [0, 1]}, T c M = {w ∈ C ∞ ([0, 1], T M )|w(t) ∈ T c(t) M, ∀t ∈ [0, 1]}.Reparametrizations are represented by increasing diffeomorphisms ϕ : [0, 1] → [0, 1] (so that they preserve the end points of the curves), and their set is denoted by