 Research
 Open Access
 Published:
Optimum design of chamfer masks using symmetric mean absolute percentage error
EURASIP Journal on Image and Video Processing volume 2019, Article number: 74 (2019)
Abstract
Distance transform, a central operation in image and video analysis, involves finding the shortest path between feature and nonfeature entries of a binary image. The process may be implemented using chamferbased sequential algorithms that apply smallneighborhood masks to estimate the Euclidean metric. Success of these algorithms depends on the cost function used to optimize chamfer weights. And, for years, mean absolute error and mean squared error have been used for optimization. However, studies have revealed weaknesses of these cost functions—sensitivity against outliers, lack of symmetry, and biasedness—which limit their application. In this work, we have proposed a robust and a more accurate cost function, symmetric mean absolute percentage error, which attempts to address some weaknesses. The proposed function averages the absolute percentage errors in a set of measurements and offers interesting mathematical properties (smoothness, differentiability, boundedness, and robustness) that allow easy interpretation and analysis of the results. Numerical results show that chamfer masks designed under our optimization criterion generate lower errors. The present work has also proposed an automatic algorithm that converts coefficients of the designed realvalued masks into integers, which are preferable in most practical computing devices. Lastly, we have modified the chamfer algorithm to improve its speed and then embedded the proposed weights into the algorithm to compute distance maps of real images. Results show that the proposed algorithm is faster and uses fewer number of operations compared with those consumed by the classical chamfer algorithm. Our results may be useful in robotics to address the matching problem.
1 Introduction
In computer vision and image processing fields, a distance transform (DT) refers to an operation that measures the degree of closeness between object and nonobject features in a binary image. The result of DT defines a map that holds grayscale values, with each value denoting the distance of an object from the nearest edge. DTs are useful in various image analysis tasks, such as skeletonization, segmentation, shape description, object detection and recognition, multiscale morphological filtering, and feature analysis [1, 2].
Traditionally, the Euclidean metric—a distance function that obeys four wellestablished axioms: nonnegativity, symmetry, identity of indiscernibles, and subadditivity—has been used to compute DTs. The Euclidean distance transform (EDT) possesses an isotropic nature, a desirable property required by sophisticated applications. But implementation of EDT follows irregular patterns that limit the development processes. Also, certain simple applications only demand rough distance estimations, which can quickly be computed in linear times. Therefore, variants of EDT algorithms that reasonably approximate the classical Euclidean metric have been proposed to address these research gaps [3–15].
Among a class of efficient algorithms to approximate EDT include those based on the chamfer metric [1, 16–25]. The chamferdriven DTs use weighted masks to propagate local distances over an image. The chamfering process can be engineered in two modes: parallel, which applies the whole mask to estimate EDT; and sequential, which requires that the mask is split into two halves, forward and backward masks. The parallel mode demands a special computing device with optimized computational resources. Our work is built on chamferbased sequential algorithms, which can be implemented in both special and general purpose processors.
The challenging task in DTs based on the chamfer metric is to design weights for the masks that can estimate more accurately the Euclidean metric. Chamfer masks are usually designed using cost functions and, for decades, mean absolute error (MAE) and mean squared error (MSE) have been used for this purpose. But both MAE and MSE endure some weaknesses: biasedness, lack of symmetry, and sensitivity to outliers [26], which may limit their usefulness.
In this work, we have proposed an alternative cost function, symmetric mean absolute percentage error (SMAPE), to design chamfer masks. SMAPE, which is widely used in weather forecasting applications, is a bounded function (0−100%)—a property that makes it easier to analyze and interpret—that computes average of the relative accuracy between reference and estimated values. SMAPE robustly rejects outliers and efficiently lowers influences of noise in the data [27, 28].
In resourcelimited settings, practitioners discourage realvalued chamfer masks because they limit speed and waste hardware computational resources. We have addressed this issue by developing an algorithm that automatically maps values in the designed masks into integers. The proposed weights were applied to the modified chamfer algorithm to produce distance maps of real edge images.
Experimental results demonstrate that most distance maps generated through the proposed weights give lower values of SMAPE, MAE, and MSE compared with those produced by previous studies. The observation confirms that our weights are relatively more accurate and may be applied in critical tasks.
Additionally, we have analyzed the firstpass stage of the original chamfer algorithm and developed a strategy to discard unnecessary operations. Experiments on synthetic singlefeature images show that the proposed strategy raises significantly speed of the classical chamfer algorithm, a result that may add value in realworld applications of DTs.
2 Methods
2.1 Preliminaries
Chamfer masks may be characterized based on two factors: size, which defines the physical dimensions of the mask, and local weights (Fig. 1). In the chamfering process, the algorithm estimates distance maps by propagating the local weights over an image. Larger chamfer masks holding accurate and optimized weights generate lower estimation errors.
The classical EDT gives a uniform disc of radius, r; the chamfer algorithm generates a regular polygon with number of sides dependent on the size of the mask. For example, a 3×3 mask produces an octagon. Each side of the polygon obeys the equation Uy+Vx=r, where U and V represent coefficients that define mask size. For instance, the 3×3 mask contains \(a\in \mathbb {R}\) and \(b\in \mathbb {R}\) as its local weights: U=b−a and V=a.
Figure 2a illustrates an octant part of the chamfer polygon generated by the 3×3 mask. We shall use this figure to generalize formulations for all mask sizes. Let f(θ) be a function that defines the length of \(\vec {t}\), an arbitrary distance from the polygon’s side to the center. Using sideangle relationship rules from trigonometry, we have
and
Combining (1) and (2), then simplifying the resulting equation, we get
in which f(θ) may be regarded as the radius of a chamfer polygon that estimates the Euclidean disc: U (coefficient of sinθ) and V (coefficient of cosθ) are functions of the chamfer weights.
SMAPE, detailed in the next sections, between r and f is then calculated as
which signifies mean of the positive difference between r and f. Chamfer polygons are symmetrical with respect to the coordinate axes, and thus the function Z is analyzed in an octant part or within θ∈[0,45^{∘}]. Z=0% when r=f, perfect match; and Z=100% when f=0, perfect mismatch. Robustness of SMAPE against outliers can be attributed from the averaging operation 1/(r+f) in Z. Therefore, for a series of data, SMAPE minimizes the effect of unusual measurements.
2.2 Optimization of chamfer masks
2.2.1 General principles
The primary goal when designing chamfer masks is to compute optimal weights in the masks that minimize the maximum possible error. In our case, SMAPE has been opted as an optimization criterion. Equivalently, we want to compute weights that minimize the maximum SMAPE within the defined region of the chamfer polygon.
For demonstration purposes, we give two scenarios to justify our decision to select SMAPE as an optimization rule:
 (1)
Imagine two sets of measurements: r_{1}=1, f_{1}(θ)=0.75 and r_{2}=0.75,f_{2}(θ)=1. Note that (r_{1},r_{2}) may be regarded as radii of the Euclidean disc, and (f_{1},f_{2}) as the lengths of vectors touching perpendicularly the polygon’s side. The absolute error in both cases is 0.25. But applying MAE on the measurements yields 25% and 33% for the first and the second cases, respectively. This variability of results makes MAE a poor statistical estimator. On the contrary, each of the pairs of measurements give a SMAPE value of 14.30%—signaling stability of the metric.
 (2)
Let f(θ) be corrupted by an additive noise, η. Incorporating this condition into (4) and simplifying the result, we get
$$ Z_{\eta}(\theta)=\frac{1\frac{f(\theta)}{r} + \frac{\eta}{r}}{1+\frac{f(\theta)}{r} + \frac{\eta}{r}}. $$(5)The term \(\frac {\eta }{r}\) in (5) minimizes the influence of noise in f(θ) or lowers the quantity Z_{η}(θ)−Z(θ).
In an unoptimized case, chamfer masks of sizes above three generate SMAPE curves with a single major error lobe—which defines the longest polygon’s edge and associates the global peak of Z—and several minor error lobes controlled by local weights with insignificant impacts on the maximum error (unless for improperly designed chamfer weights; a 3×3 mask contains a single error lobe).
Butt et al. proposed largeneighborhood masks to achieve even better approximations to the Euclidean distance [29]. The authors recommended that the main lobe can be optimized by using the following techniques:
 (1)
Considering −Z(0^{∘})=Z_{m}, where
$$ Z_{\mathrm{m}}=\frac{\sqrt{U^{2}+V^{2}}  1}{\sqrt{U^{2}+V^{2}}+1} $$(6)denotes the global maximum of Z that occurs at
$$ \theta_{\mathrm{m}}=\arctan\left(\frac{U}{V}\right); \text{~~and~~} $$(7)  (2)
Ensuring that the border line segments subtended by an angle
$$ \alpha=\arccos\left(\frac{VU\sqrt{U^{2}+V^{2}1}}{U^{2}+V^{2}}\right) $$(8)in the chamfer octant are equal.
The maximum error can also be located at α. Hence, the maximum SMAPE on the major error lobe can be computed by the equation
General proofs shared by all chamfer masks are shown in Appendices Appendix 1: Existence of maximum in SMAPE, Appendix 2: Intercepts on the SMAPE curve, and Appendix 3: Optimum chamfer weights: existence of the maximum on the SMAPE curve, intercepts of Z on the θaxis, and computation of optimal chamfer weights, respectively.
2.2.2 3×3 neighborhood
In a 3×3 mask, two nonredundant local distances, a and b, should be optimized (Fig. 1). Let \(\vec {t}\) be a vector from the disc’s origin to an edge of the chamfer polygon, and r be the radius of a disc generated by the global Euclidean metric. Then, optimization demands values of a and b that minimize the maximum of an error \(r{\lVert }{\vec {t}}{\rVert }/(r+{\lVert }{\vec {t}}{\rVert })\). We analyze errors in the wedgeshaped region {(x,y):x≥0, y≥0, and y≤x} because the chamfer polygon supports symmetry properties along the axes and diagonals (Fig. 2). In this region, points on portion of the polygon’s side, line segment \(\overline {AC}\), satisfy the equation (b−a)y+ax=r.
The length of \(\vec {t}\) is given by
where
Simplifying (10) yields
Plugging (11) into the SMAPE formula, we have
Thus, (comparing Eqs. 4 and 12) U=b−a and V=a. For the Euclidean metric, a=1 and \(b=\sqrt {2}\). Therefore, the maximum of Z becomes
and is located at
Under optimal conditions, \(b=\sqrt {2}a\) or \(\overline {OA'}=\overline {OC'}\) in Fig. 2b, and
or −Z(0^{∘})=Z_{m}, which simplify to the optimal weights
and b_{opt}=1.3593. These proposed weights give a maximum SMAPE of 1.979%, a value that improves an error of EDT by 50% (Fig. 3).
2.2.3 5×5 neighborhood
The 5×5 mask holds three nonredundant local distances: a, horizontal/vertical; b, diagonal; and c, offdiagonal knight’s move (Fig. 1). If all weights are used, the mask generates a regular hexadecagon that contains wedgeshaped octants, each extended by two line segments. Same as before, symmetry allows us to analyze errors within an octant.
From Fig. 4, applying the sine rule yields the length of \(\vec {t}\) as
and that of \(\vec {s}\) as
where
The SMAPE formulae corresponding to f_{1} and f_{2} are
major error lobe; and
minor error lobe.
Considering the major error lobe, we have U=c−2a and V=a. In the Euclidean case, a=1 and \(c=\sqrt {5}\). These unoptimized values give a maximum SMAPE of
that occurs at \(\arctan \left (\sqrt {5}2\right)=13.28^{\circ }\).
Using the similar optimization strategy, \(\overline {AE}\) in Fig. 4 must be pushed outwards such that −Z_{1}(0^{∘})=Z_{1m} and \(c=\sqrt {5}a\). These conditions give
and c_{opt}=2.2059 as optimal weights of the chamfer mask. In this case, the maximum SMAPE reduces to Z_{1opt}=0.68% (Fig. 5).
The value of b should be selected carefully such that growth of the minor lobe is restricted to the bound given by Z_{1opt}. That is, allowable ranges of b can be obtained by solving
Simplifying (19) yields
where
The roots of (20) are 1.2193, 1.3189, 1.3281, and 1.4276. Hence, we recommend to select b between 1.2193<b<1.3189 or 1.3281<b<1.4276. Figure 6a shows how b influences SMAPE values within the minor lobe.
2.2.4 7×7 neighborhood
This mask uses five nonredundant local distances, namely a, b, c, d, and e, to generate a 32sided regular polygon, which is more accurate compared to those generated by 3×3 and 5×5 masks. Some weights in the 7×7 mask are unimportant because they form multiples of other variables in the mask (Fig. 1).
Consider the foursided portion of the chamfer polygon generated by a 7×7 mask (Fig. 7). Also, let f_{1}(θ), f_{2}(θ), f_{3}(θ), and f_{4}(θ) be the lengths of \(\vec {t}\), \(\vec {s}\), \(\vec {q}\), and \(\vec {p}\), respectively. Applying the sine rule, we get
and
where
Therefore, the SMAPE formulae corresponding to f_{1}, f_{2}, f_{3}, and f_{4} are
and
Considering Z_{1}(θ), the major error lobe, we have U=d−3a and V=a. For the Euclidean case, a=1 and \(d=\sqrt {10}\). These values produce a maximum SMAPE of
that occurs at \(\arctan (\sqrt {10}3)=9.22^{\circ }\). To reduce Z_{1m}, we consider the conditions \(d=\sqrt {10}a\) and −Z_{1}(0^{∘})=Z_{1m} and obtain the optimal weights
and d_{opt}=3.1417, which give a maximum SMAPE of Z_{1opt}=0.32% (Fig. 8).
The values of b, c, and e are less important, but they should be chosen such that the minor lobes fail to explode above Z_{1opt}, or
where Z_{2},(U,V)=(3c−2d,d−c); Z_{3},(U,V)=(2e−3c,2c−e); and Z_{4},(U,V)=(3b−e,e−2b). Substituting definitions of U and V into (31), then rewriting and simplifying the resulting equations, we get
and
where J is as defined in (21). As depicted by Fig. 6b–d, solving (32) yields 2.1483<c<2.1979 and 2.2006<c<2.2502 as valid ranges of the local weight c. The natural choice is the Euclidean value \(c=\sqrt {5}\). Solving (33) and (34) is rather challenging because the values of b and e depend on each other and are implicitly defined in the equations. To address the problem, we substituted the chosen value of c into (33) and solved for the valid range of e, then selected the value of e in the range and substituted it into (34) to get the possible valid values of b. Lastly, the computed range of b was inspected for a subset that restricts errors in both minor and major lobes within the acceptable range (0% to 0.32%). Following this strategy, we achieved 3.5266<e<3.6288, e=3.5830; and 1.4051<b<1.4224, \(b=\sqrt {2}\). Figure 6b, d show the variations of SMAPE with the local weights b and e in minor error lobes, respectively.
3 Integer approximations
In previous sections, we have proposed realvalued chamfer weights for various sizes of masks. However, timedriven tasks require integers to accelerate computations. Additionally, integersteered masks allow hardware platforms to use computational resources more efficiently, an advantage that lowers manufacturing costs. Therefore, an automatic and a simple technique has been developed to generate integers from realvalued masks. Our desire is to achieve the following qualities of integers: lower relative errors, common divisor, and convenient magnitudes—preferably in the order of ones, tens, or hundreds.
The proposed algorithm operates as follows: firstly, weights are multiplied by integers, i, between two and the selected maximum, say 1000. Next, each multiplication is treated by floor and ceil operators, one after another. Next, corresponding absolute values are taken. Finally, the value of i that minimizes errors due to all multiplied weights become a common divisor.
Algorithm 1 summarizes our approach to compute intervalued chamfer masks. From the Algorithm, 0<ε<1 defines fidelity of the results and can be manually set: smaller values of ε give more accurate integer weights. This work used ε=0.0025 as a thresholding constant to convert realvalued chamfer weights into integers. And, for simplicity, we have selected a 3×3 mask—but the idea may be extended to larger chamfer masks.
4 Fast chamfer algorithm
Distance transforms may be implemented through the chamfering process that uses two masks, forward and backward, to propagate local distances over an image. The process undertakes two passes to estimate EDT and operates as follows: in the first pass, nonfeature entries of a target image are initialized with a suitably large number, as Fig. 9a depicts. Next, the forward mask is pushed from leftright and topdown directions of an image, and at each movement step, masks’ weights are added to the corresponding image’s entries below them. Then, an entry in the image just below the zerovalued mask’s location (center of the whole mask) is replaced by minimum of the additions, as shown in Fig. 9b. These procedures are repeated until the forward mask covers pixels in the bottom right portion of the image. Lastly, the second pass applies the backward mask and uses similar operations like those in the forward mask to propagate distance vectors from the image’s rightleft and bottomup directions. Figure 9c shows the distance image after both first and second passes have been executed.
The chamfer algorithm based on sequential masks is relatively fast because it involves only two passes to generate the distance image. Some previous works have shown that the computational times of both parallel and sequential driven algorithms are comparable ([30, 31], and references therein). Speed of the traditional chamfer algorithm can, however, be further improved.
Traditional implementation of the chamfer algorithm requires every location of an image to be operated by the masks. Observing results from the first pass, as demonstrated by Fig. 9b, we see that the process leaves some pixels in the image unchanged. In particular, for a 7×7 image with one feature pixel at its center, more than 55% of the pixels retain their initial states after execution. In this work, we have developed a simple strategy to skip these unnecessary operations in the first pass.
For demonstration purposes, consider a onefeature image with M_{1} rows and M_{2} columns. Then our technique operates as follows: Firstly, position (row,column) of a feature pixel is determined. Secondly, the for loops in the first pass are explored and their initial indices are updated accordingly to contain values of the determined position. Thirdly, the forward mask is moved along row from column to M_{2}. Fourthly, column is decremented by one and a condition to check its lower bound is evaluated. The mask is allowed to move in this fashion until it reaches the bottomright corner pixel of the image. As Fig. 9b depicts, the final image in the first pass contains a trapeziumshaped geometrical structure of the realvalued distance values. This way, less important operations are ignored.
To count the algorithmic number of operations, we employed a simple strategy of embedding counters into the inner for loops of the algorithm. During program execution of the forward pass, the first counter iteratively gets updated to record the temporary value of the number of operations. In the backward pass, the second counter builds from the first one to accumulate the total algorithmic operations count. The algorithm can be tested on all types of binary images, but superior results may be achieved for larger images with many nonfeature entries.
Algorithm 2 summarizes the technique to improve speed of the chamfering process. Figure 10 shows that the proposed chamfer algorithm executes fewer operations compared with those pursued by the classical chamfer algorithm. This speed improvement may benefit applications that demand realtime processing of input images.
5 Experiments
Several experiments were conducted to test performances of our methods. In the first experiment, we evaluated the speed of the modified chamfer algorithm using singlefeature binary images of different resolutions, 300×300 to 6000×6000. The second experiment compared performances of our local weights and those proposed from previous studies: Euclidean DT [11, 32–34], Butt et al. [29], and Verwer [35]. Therefore, masks of different sizes were applied to estimate chamfer balls of radii r=1. Next, three error metrics, namely SMAPE, MAE, and MSE, were used to compute the approximation errors. In the third experiment, the purpose was to compute distance fields from real images. To this end, we used cameras embedded in the surface mount technology machine of our laboratory to capture images of surface mount devices with smalloutline packages. Then, the images were thresholded to create edge maps that DT operators could act upon (Fig. 11). Lastly, the images were operated by DTs to produce their corresponding distance and error maps. As in the first experiment, we used SMAPE, MAE, and MSE to evaluate accuracies of both designed and classical weights.
6 Results and discussions
Figure 10 demonstrates that the proposed DT algorithm to estimate EDT is faster because it requires approximately 37.58% operations of the classical chamfer algorithm. This speed improvement is attributed to the reduced number of operations in the firstpass stage of the old chamfer algorithm. In future, it may be interesting to explore the secondpass stage for redundancies and unnecessary executions.
Results from Table 1 show that the new weights achieve lower SMAPE in all cases. One would expect this observation because weights from the classical methods were designed using MAE and MSE cost functions. Nevertheless, a robust cost function should produce optimal weights with higher degree of accuracies for all evaluation indices. As expected, the last column of Table 1 shows that our approach, which is adapted to SMAPE, produces MAE values slightly higher than those of Butt et al. These two methods are competitive and hence were considered further in the next experiments to evaluate a superior one.
Table 2 shows that the proposed realvalued weights generate lower values of SMAPE, MAE, and MSE compared with those of Butt et al. Furthermore, for the 3×3 and 5×5 masks, our integervalued masks demonstrate superior performances. This evidence suggests a possible usefulness of our weights to practical computing devices. Also, the results emphasizes on the earlier assertion that SMAPE offers higher robustness capabilities. But the 7×7 mask embedded with the proposed integervalued weights demonstrates relatively higher error values, and we think that the result may be attributed to the higher sensitivity of the larger chamfer masks to local weights: a marginal departure of the integervalued weights from the optimal realvalued weights amplifies the errors. Additionally, visual results show that the present approach produces distance maps with lower errors (Fig. 12) and that are closer to the reference distance maps (Fig. 13).
In [36], the authors proposed the RLog metric to optimize chamfer masks. This metric finds the relative logarithm between the estimated and the ideal disc. Both SMAPE, proposed in the current work, and RLog generate similar weights of the chamfer masks, but SMAPE offers an additional advantage of being robust against outliers and noise. When applied as a performance evaluation index, the averaging characteristic of SMAPE helps to suppress extraneous details. Therefore, derivations of the chamfer masks may remain accurate even under undesirable conditions of data.
Our derivations of chamfer masks have been presented for twodimensional cases. Hence, the proposed masks can be applied on twodimensional images to compute distance maps. Future studies may explore possibilities of extending our ideas to higher dimensional planes. Derivation of the 3×3 threedimensional chamfer masks, for instance, require extending Fig. 2 to a sphere containing a chamfer polygon with sides representing planes. This modification may be useful in various visionrelated tasks, including those based on the analysis and interpretation of 3D medical images.
7 Conclusion
This work has proposed the cost function, SMAPE, that helps to derive optimization problems for designing chamfer masks. Results show that the function generates more accurate local weights—which give lower errors even when tested under MAE and MSE criteria—compared with those proposed from previous researches. Also, the present study has given formulations to show how ranges of some masks’ weights can be selected, and this selection procedure is important because it restricts the maximum error of minor lobes from exploding beyond the defined limits.
Additionally, an automatic algorithm has been proposed to compute integervalued chamfer masks from their corresponding realvalued counterparts. The algorithm produces masks with simple integers that depict lower errors. The reason for mapping realvalued masks into integers is to allow DTs optimize computational resources and accelerate speed.
Furthermore, we have proposed a technique to boost speed of the classical chamfer algorithm. In particular, the technique exploits unimportant cells in the image covered by the moving forward mask and skips unnecessary operations. Consequently, the evolving system halts prematurely with results similar to those achieved by the old approach.
Finally, the designed local weights and the modified chamfer algorithm were applied on real images to generate distance maps. Empirical results show that our weights produce lower visible errors that reflect smaller values of SMAPE, MAE, and MSE.
8 Appendix 1: Existence of maximum in SMAPE
Given that the SMAPE error curve, Z(θ) with θ∈[0,45^{∘}], is smooth and differentiable to the second order. We want to prove that Z contains a maximum, which occurs when the function qualifies the second derivative test, Z_{θθ}≤0. Computing first and second derivatives of Z gives
and
where U sinθ+V cosθ≠−1. From Z_{θθ} in (36), Z possesses the maximum.
9 Appendix 2: Intercepts on the SMAPE curve
Locations on the chamfer polygon with radius f(θ)=r and touching the reference disc of radius r have Z=0. Substituting the condition in the SMAPE formula, we find that the curve Z(θ) crosses the θaxis when
10 Appendix 3: Optimum chamfer weights
When designing coefficients in the chamfer kernels, the optimality conditions are −Z(0^{∘})=Z(θ_{m}), or
and
where β and γ depends on the size of the mask (Table 3). Substituting the value of U in (39) into (38), we get
The general Eqs. (39) and (40) can be used to compute optimal values for any size of the chamfer masks. Entries of Table 1 can be extended using the Farey sequences [29, 37], which define corner points of the chamfer polygon.
Availability of data and materials
Data and implementation codes for all experiments have been shared in the MATLAB Central^{Footnote 1}.
Abbreviations
 DT:

Distance transform
 EDT:

Euclidean distance transform
 MAE:

Mean absolute error
 MSE:

Mean squared error
 SMAPE:

Symmetric mean absolute percentage error
References
PK Saha, G Borgefors, GS di Baja, A survey on skeletonization algorithms and their applications. Pattern Recogn. Lett.76:, 3–12 (2016).
P Maragos, Differential morphology and image processing. IEEE Trans. Image Process.5(6), 922–937 (1996).
GJ Grevera, in Deformable Models. Distance transform algorithms and their implementation and evaluation (SpringerNew York, 2007), pp. 33–60.
W Liu, H Jiang, X Bai, G Tan, C Wang, W Liu, K Cai, Distance transformbased skeleton extraction and its applications in sensor networks. Parallel Distrib. Syst. IEEE Trans.24(9), 1763–1772 (2013).
D Xu, H Li, Y Zhang, in Research in Computational Molecular Biology. Fast and accurate calculation of protein depth by Euclidean distance transform (SpringerNew York, 2013), pp. 304–316.
Y Mishchenko, A fast algorithm for computation of discrete Euclidean distance transform in three or more dimensions on vector processing architectures. SIViP. 9:, 19–27 (2015).
D Salvi, K Zheng, Y Zhou, S Wang, in Applications of Computer Vision (WACV), 2015 IEEE Winter Conference on. Distance transform based active contour approach for document image rectification (IEEENew York, 2015), pp. 757–764.
JC ElizondoLeal, EF ParraGonzález, JG RamírezTorres, The exact Euclidean distance transform: a new algorithm for universal path planning. Int. J. Adv. Robot. Syst.10:, 266–275 (2013).
E Linnér, R Strand, in Discrete Geometry for Computer Imagery. Antialiased Euclidean distance transform on 3D sampling lattices (SpringerNew York, 2014), pp. 88–98.
KC Ciesielski, X Chen, JK Udupa, GJ Grevera, Linear time algorithms for exact distance transform. J. Math. Imaging Vis.39(3), 193–209 (2011).
CR Maurer, R Qi, V Raghavan, A linear time algorithm for computing exact Euclidean distance transforms of binary images in arbitrary dimensions. IEEE Trans. Pattern. Anal. Mach. Intell.25(2), 265–270 (2003).
G Borgefors, Distance transformations in arbitrary dimensions. Comput. Vis. Graph. Image Proc.27(3), 321–345 (1984).
R Strand, N Normand, Distance transform computation for digital distance functions. Theor. Comput. Sci.448:, 80–93 (2012).
R Strand, B Nagy, C Fouard, G Borgefors, Generating distance maps with neighbourhood sequences. Lect. Notes Comput. Sci. 4245:, 295 (2006).
B Nagy, R Strand, N Normand, in International Symposium on Mathematical Morphology and Its Applications to Signal and Image Processing. A weight sequence distance function (SpringerNew York, 2013), pp. 292–301.
J Dong, C Sun, W Yang, in Intelligence Science and Big Data Engineering. An improved method for oriented chamfer matching (SpringerNew York, 2013), pp. 875–879.
D Tzionas, J Gall, in Pattern Recognition. A comparison of directional distances for hand pose estimation (SpringerNew York, 2013), pp. 131–141.
P Kaliamoorthi, R Kakarala, Directional chamfer matching in 2.5 dimensions. Signal Process. Lett. IEEE. 20(12), 1151–1154 (2013).
DT Nguyen, in Computer Vision and Pattern Recognition (CVPR), 2014 IEEE Conference on. A novel chamfer template matching method using variational mean field (IEEENew York, 2014), pp. 2425–2432.
DW Paglieroni, Distance transforms: Properties and machine vision applications. CVGIP: Graph. Model. Image Process.54:, 56–74 (1992).
L Dantanarayana, R Ranasinghe, G Dissanayake, in 2013 IEEE/RSJ International Conference on Intelligent Robots and Systems. CLOG: A Chamfer Distance based method for localisation in occupancy gridmaps (IEEENew York, 2013), pp. 376–381.
T Ma, X Yang, LJ Latecki, in Computer Vision–ECCV 2010. Boosting chamfer matching by learning chamfer distance normalization (SpringerNew York, 2010), pp. 450–463.
E Thiel, A Montanvert, in Visual Form. Shape splitting from medial lines using the 3–4 chamfer distance (SpringerNew York, 1992), pp. 537–546.
MP Tran, 3D Contour Closing: A local operator based on Chamfer distance transformation (2013). https://hal.archivesouvertes.fr/hal00802068/file/cclose_tran.pdf.
MK Bhuyan, VV Ramaraju, Y Iwahori, Hand gesture recognition and animation for local hand motions. Int. J. Mach. Learn. Cybern.5(4), 607–623 (2014).
Z Wang, AC Bovik, Mean squared error: love it or leave it? A new look at signal fidelity measures. IEEE Signal Proc. Mag.26:, 98–117 (2009).
S Kim, H Kim, A new metric of absolute percentage error for intermittent demand forecasts. Int. J. Forecast.32(3), 669–679 (2016).
JS Armstrong, LR Forecasting, From crystal ball to computer (Wiley, New York, 1985).
MA Butt, P Maragos, Optimum design of chamfer distance transforms. Image Proc. IEEE Trans.7(10), 1477–1484 (1998).
OK Kwon, JW Suh, Improved 3 × 3 sequential Euclidean distance transform. IEEJ Trans. Electr. Electron. Eng.8(3), 305–307 (2013).
Y Dou, M Ye, P Xu, Pei L, Z Liu, Object detection based on two level fast matching. International Journal of Multimedia and Ubiquitous Engineering. 10(12), 381–394 (2015).
O Cuisenaire, B Macq, Fast Euclidean distance transformation by propagation using multiple neighborhoods. Comp. Vision Image Underst.76(2), 163–172 (1999).
T Saito, JI Toriwaki, New algorithms for euclidean distance transformation of an ndimensional digitized picture with applications. Pattern Recog.27(11), 1551–1565 (1994).
FY Shih, YT Wu, Fast Euclidean distance transformation in two scans using a 3 × 3 neighborhood. Comp. Vision Image Underst.93(2), 195–205 (2004).
BJ Verwer, Local distances for distance transformations in two and three dimensions. Pattern Recogn. Lett.12(11), 671–682 (1991).
BJ Maiseli, L Bai, X Yang, Y Gu, H Gao, Robust cost function for optimizing chamfer masks. Vis. Comput., 1–16 (2017).
J Hulin, É Thiel, in International Workshop on Combinatorial Image Analysis. Farey sequences and the planar Euclidean medial axis test mask (SpringerNew York, 2009), pp. 82–95.
Acknowledgements
The author of the current manuscript would like to sincerely thank Prof. Huijun Gao and Prof. Yanfeng Gu from the Harbin Institute of Technology, P.R. China, for their guidance and support on this research. The raw images in Fig. 11 (first row) were adapted from the research laboratory under Prof. Huijun Gao.
Funding
This work was not funded by any organization.
Author information
Authors and Affiliations
Contributions
Authors’ contributions
The sole author of this manuscript undertook all the tasks: doing the experiments and writing and submitting the manuscript. The author read and approved the final manuscript.;
Authors’ information
Baraka Maiseli earned his Doctoral degree in 2015 from the Harbin Institute of Technology (HIT), PR China, where he was also awarded the honorary certificate as the best international scholar of the year. Currently, Maiseli pursues postdoctoral studies at HIT. He has published several articles in referred Journals, and is a verified peer reviewer for various international journals: IEEE Transactions on Industrial Electronics, Neurocomputing, IET Biometrics, Signal Processing, and International Journal of Remote Sensing, among others. His research interests are in machine learning, computer vision, image and video processing, artificial intelligence, and embedded electronics. Maiseli works at the University of Dar es Salaam (UDSM), Department of Electronics and Telecommunication Engineering, as a lecturer. With more than 10 years of teaching experience at UDSM, Maiseli has been supervising both undergraduate and postgraduate students in their projects, researches, and practical trainings.
Corresponding author
Ethics declarations
Competing interests
The authors declare that they have no competing interests.
Additional information
Publisher’s Note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Rights and permissions
Open Access This article is distributed under the terms of the Creative Commons Attribution 4.0 International License (http://creativecommons.org/licenses/by/4.0/), which permits unrestricted use, distribution, and reproduction in any medium, provided you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license, and indicate if changes were made.
About this article
Cite this article
Maiseli, B.J. Optimum design of chamfer masks using symmetric mean absolute percentage error. J Image Video Proc. 2019, 74 (2019). https://doi.org/10.1186/s136400190475y
Received:
Accepted:
Published:
DOI: https://doi.org/10.1186/s136400190475y
Keywords
 Symmetric mean absolute percentage error
 Euclidean
 Distance transform
 Optimization
 Mean squared error