Journal of Mathematical Imaging and Vision https://doi.org/10.1007/s10851-018-0805-1 Distance Functions Based on Multiple Types of Weighted Steps Combined with Neighborhood Sequences Benedek Nagy 1 · Robin Strand 2 · Nicolas Normand 3 Received: 7 June 2017 / Accepted: 3 March 2018 © Springer Science+Business Media, LLC, part of Springer Nature 2018 Abstract In this paper, we present a general framework for digital distance functions, defined as minimal cost paths, on the square grid. Each path is a sequence of pixels, where any two consecutive pixels are adjacent and associated with a weight. The allowed weights between any two adjacent pixels along a path are given by a weight sequence, which can hold an arbitrary number of weights. We build on our previous results, where only two or three unique weights are considered, and present a framework that allows any number of weights. We show that the rotational dependency can be very low when as few as three or four unique weights are used. Moreover, by using n weights, the Euclidean distance can be perfectly obtained on the perimeter of a square with side length 2n. A sufficient condition for weight sequences to provide metrics is proven. Keywords Distance functions · Weight sequences · Neighborhood sequences · Chamfer distances · Approximation of Euclidean distance 1 Introduction In a digital space (given for example by the pixels on a com- puter screen), not all properties of the Euclidean geometry are fulfilled. This is mainly due to the discrete (as opposed to continuous) structure of digital spaces. In the digital geom- etry framework, a classical way to define distance functions and metrics is by means of shortest paths or minimal cost paths. By doing so, the distance between two points is sim- ply the sum of weights along a given path. With appropriate, efficient algorithms, this allows completely error-free, and fast, computation of the distances in two and higher- dimen- sional digital spaces [1,17,21]. B Benedek Nagy nbenedek.inf@gmail.com Robin Strand robin@cb.uu.se Nicolas Normand Nicolas.Normand@polytech.univ-nantes.fr 1 Eastern Mediterranean University, Famagusta, North Cyprus Mersin-10, Turkey 2 Centre for Image Analysis, Uppsala University, Uppsala, Sweden 3 LS2N UMR CNRS 6004, Université de Nantes, Nantes, France The digital approach we follow, where connected paths are used to define distance functions, is fundamentally different from the approach when Euclidean distances are computed. This is usually done by vector propagation [5,14], fast march- ing [16], or by separable algorithms [2,4]. These algorithms either result in errors (i.e., deviations from the metrics under consideration due to approximation errors or deficiencies in the algorithm definition) and/or they don’t generalize to so- called constrained distance transform. See the discussion in [18]. Therefore, we believe that it is important to develop both the theory based on these digital distances and practical algorithms for image processing that can effectively utilize these distances. The cityblock and chessboard distances are the two dig- ital distances first described in the literature [15]. These distance functions have high rotational dependency, but are easy and efficient to compute. The theory of digital distances has developed rapidly from the 1980s. The weighted (cham- fer) distances [1], where the grid points together with costs to local neighbors form a graph in which the minimal cost path is the distance, are a well-known and often used con- cept in image processing. Contrary to weighted distances, the allowed steps may vary along the path with distances based on neighborhood sequences from a predefined set of steps [6], for instance, by mixing the cityblock and chessboard neigh- borhood. In [20,22], the concept of weighted distances is 123