You are on page 1of 5

34 A COMPARISON STUDY ON METHODS FOR MEASURING DISTANCE IN IMAGES

R. Balu
Ph.D Research Scholar Department of Computer Applications Bharathiar University, Coimbatore rvkbalu@yahoo.co.in

T. Devi
Reader and Head i/c Department of Computer Applications Bharathiar University, Coimbatore tdevi5@gmail.com

ABSTRACT
In image analysis, the distance transform is a derived representation of a digital image and is represented in the form of a matrix. The elements of the matrix represent the distance of each object point of in the image from the nearest boundary and is an important tool in computer vision, image processing and pattern recognition. In the distance transform, binary image specifies the distance from each pixel to the nearest non-zero pixel. The Euclidean distance is the straight-line distance between two pixels and is evaluated using the euclidean norm. The city block distance metric measures the path between the pixels based on a 4-connected neighbourhood. Pixels whose edges touch are 1 unit apart and pixels diagonally touching are 2 units apart. The chessboard distance metric measures the path between the pixels based on an 8-connected neighbourhood. The quasi-euclidean metric measures the total euclidean distance along a set of horizontal, vertical, and diagonal line segments. This paper describes and compares the distance measures methods such as Euclidean, Chamfer, Geodesic, Manhattan, City Block and Chessboard distance. Key words: Euclidean, Chamfer, Geodesic, Manhattan, City Block and Chessboard Distances

1. INTRODUCTION
A central problem in image recognition and computer vision is determining the distance between images and efforts have been made to define image distances that provide intuitively reasonable results [2-5]. Estimating distances in digital image is useful in many different shape representation and shape recognition tasks [7-10]. This paper explains and compares Euclidean, Chamfer, Geodesic, Manhattan, City block, and Chessboard distances; Section II describes an overview of the euclidean distance and euclidean functions, Section III represents chamfer distance, Section IV demonstrates a geodesic distance, Section V shows a manhattan distance; Section VI describes city block distance and Section VII discusses about chess board distance; and Finally, Section VIII concludes the paper. 2. EUCLIDEAN DISTANCE The euclidean distance is the distance between two points in euclidean space. The two points P and Q in two dimensional euclidean spaces and P with the coordinates (p1,p2), Q with the coordinates (q1,q2). The line segment with the endpoints of P and Q will form the hypotenuse of a right angled triangle. The distance between two points p and q is defined as the square root of the sum of the squares of the differences between the corresponding coordinates of the points. The two-dimensional euclidean geometry, the euclidean distance between two points a = (ax, ay) and b = (bx, by) is defined as [1]: In one dimension, the distance between two points, x1and x2, on a line is simply the absolute value of the difference between the two points as: Eculidean distance algorithm computes the minimum distance between a column vector x and a collection of column vectors in the code book matrix cb. The algorithm computes the minimum distance to x and finds the column vector in cb that is closest to x.

In two dimensions, the distance between P = (p1,p2) and q = (q1,q2) as:

February 2012

International Journal of Research in Computers

35
2. 1. Euclidean functions work The input source data is a feature class, it will first be converted internally to a raster before the euclidean analysis is performed. The resolution will be smaller of the height or width of the extent of the feature class, divided by 250 and the resolution can be set with the Output Cell Size parameter. The source data as a raster, assuming this conversion has already taken place. The euclidean distance is calculated from the center of the source cells to the center of each of the surrounding cells and true distance is calculated to each cell in the distance functions. The euclidean algorithm works as: for each cell, the distance is calculated to each source cell by calculating the hypotenuse, with the x-max and y-max as the other two legs of the triangle and derives the true Euclidean. The shortest distance to a source is determined if it is less than the specified maximum distance and the value is assigned to the cell location on the output raster [6]. the size of the neighborhood and the selection of the local distances [14]. Fig. 3. 1 shows chamfer distance. Chamfer distances are local distances which permit to deduce a distance from the distances of close neighbours, unlike dE. The computation of the medial axis is done by a local test. All computations are done by using integer numbers and linear operations {+; -;< } [16].

Fig.3.1 Chamfer Distance [16] 4. GEODESIC DISTANCE The geodesic distances on a three dimensional surface, is important in many fields of computer graphics and geometric modelling. Normally, geodesic paths on a surface are critical in surface segmentation and editing methods since cutting the surface along the geodesic paths produces better results [17, 18] and minimum distortion parameterization or remeshing of 3D models are based on the knowledge of geodesic distances [19-21]. The applications include isometry-invariant shape classification [22, 23], skinning [24], medical imaging and geophysics [25]. Fig. 4. 1. shows difference between Euclidean Distance and Geodesic Distance. Geodesic has shortest paths, and perturbation of a geodesic curve will increase its length. The minimal length path between two points on the surface is the minimal geodesics connecting those points and minimizes the euclidean distance on a surface. A geodesic distance between two vertices of a triangle mesh surface can be computed using a shortest path algorithm on the mesh graph with an edge is its length. The Dijkstra algorithm [26], can compute path lengths very quickly, but produce paths quite different from true geodesics and the paths they create pass only through the mesh vertices. The research on geodesic computation on a surface focuses on solving the eikonal equation [27]. Kimmel and Sethian [28] proposed an optimal time algorithm for computing the geodesic distances and extracting shortest paths on triangulated manifolds using the Fast Marching Method [29]. The geodesic paths between two vertices in O(n log n) time per path by numerically solving the eikonal equation (n is the number of vertices in the mesh). Mitchell et al [30] presented an algorithm for determining the shortest path

SOURCE _ GRID Fig.2.1 Euclidean functions work The output values for the euclidean distance raster are floating-point distance values and the cell is at an equal distance to two or more sources, the cell is assigned to the source that is first encountered in the scanning process. The euclidean distance raster tells how close each cell is to the nearest source and raster defines which source zone and cell value is the closest. The euclidean direction identifies the direction to the closest source cell [6]. Fig 2. 1 shows how euclidean function works. 3. CHAMFER DISTANCE The chamfer distances are widely used in image analysis of the euclidean distance with integers [15]. Chamfer distances are used for computing geodesic diameters to propagate chamfer distances from a binary image (the marker), constrained to another binary image. The chamfer distance transformations rely on the assumption that it is possible to deduce the value of the distance at a pixel from the value of the distance at its neighbours [11] [12] and which offer a good approximation to the desired euclidean distance transform which is computationally very intensive [13]. Chamfer distance transforms are a class of discrete algorithms that offer a good approximation and euclidean distance transform at a lower computational cost [14]. The distance approximates the global distance computation with repeated propagation of local distances within a small neighborhood mask. The approximation error depends upon

February 2012

International Journal of Research in Computers

36
between a source and a destination on an arbitrary polyhedral surface, and seeking to approximate distance maps on a parametric surface [27] and the eikonal equation on a discrete grid obtained by sampling the parametric domain. An efficient O(n) numerical algorithm for first-order approximation of geodesic distances on parametric surfaces, where n is the number of points on the surface. The chamfer distance is faster than the city-block distance and city-block distance largely overestimates distances towards 45directions. This makes the needed rectangular area around the moving object, larger for the city-block distance than for the chamfer distance [34].

Fig. 4. 1. Difference between Euclidean Distance and Geodesic Distance [31]


5. MANHATTAN DISTANCE The distance between two points in a grid is based on a strictly horizontal and/or vertical path as opposed to the diagonal. The Manhattan distance is the simple sum of the horizontal and vertical components, whereas the diagonal distance might be computed by applying the Pythagorean Theorem [33]. The Manhattan distance function computes the distance that would be travelled to get from one data point to the other if a grid-like path is followed and manhattan distance between two items is the sum of the differences of their corresponding components. Fig 5.1 shows the difference between Euclidean Distance and Manhattan Distance. The formula for this distance between a point X=(X1, X2, etc.) and a point Y=(Y1, Y2, etc.) is [32]:

Fig.6.1. Difference between Euclidean Distance and City Block Distance [36] 7. CHESS BOARD DISTANCE Chessboard distance is a metric that can be used to measure distances and it assumes that you can make moves. Fig 7. 1 shows difference between Euclidean Distance and Chess Board Distance. The chessboard distance between two points is defined as:

Danielsson (1980) asserted that both Manhattan and chessboard distance are rarely used. The recent publication of a few transforms that use Manhattan distance in particular, due to the speed of calculation but resulting in a coarse solution [37]. Fig. 7. 2. shows difference between Euclidean Distance and Chess Board Distance Matrix.

Manhattan

Euclidean

Fig.7.1. Difference between Euclidean Distance and Chess Board Distance [36]

Fig. 5.1. Difference between Euclidean Distance and Manhattan Distance [32]
6. CITY BLOCK DISTANCE The City block distance is always greater than or equal to zero. The measurement would be zero for identical points and high for points that show little similarity. The city-block distance measuring horizontal and vertical directions and the chessboard distance takes diagonal directions.

Fig.7. 2. Difference between Euclidean Distance and Chess Board Distance Matrix [37]

February 2012

International Journal of Research in Computers

37
8. CONCLUSION The relationship and understanding among different distance measures is helpful in choosing a relevant method for a particular application. This paper compares euclidean distance measures to other measures obtained from chamfer, geodesic, manhattan, city block and chess board distance. This paper highlights an overview of euclidean distance and how it functions and introduces the chamfer distance. In addition, this paper illustrates the differences between geodesic and euclidean distance; and also demonstrates the differences between manhattan and euclidean distance, euclidean and city block distance. This work can be further extended by applying euclidean distance to analyze and identify the acute appendicitis on sonographic images. [12] Borgefors G, "Distance transformation in arbitrary dimensions" Computer Vision, Graphics, and Image Processing 1984, 27:321-345. [13] Shengwen Guo, Jinshan Tang, Youping Deng and Qun Xia, "An improved approach for the segmentation of starch granules in microscopic images", International Conference on Bioinformatics & Computational Biology, 2009 . [14] Muhammad Akmal Butt and Petros Maragos, "Optimum Design of Chamfer Distance Transforms", IEEE Transactions on Image Processing, Vol. 7, no. 10, October 1998 [15] Eric Remy and Edouard Thiel, "Optimizing 3D chamfer masks with normConstraints", 7th IWCIA, International Workshop on Combinatorial Image Analysis, (Ed.), pp. 3956, Caen, July 2000. [16] "Chamfer Distance-distance " at http://www.kxcad.net/ SolidWorks/SolidWorks_Online_User_Guide/Features/ Chamfer_Distance-distance.htm [17] S. Katz and A. Tal, "Hierarchical mesh decomposition using fuzzy clustering and cuts", In SIGGRAPH '03: ACM SIGGRAPH 2003 Papers, pages 954-961, New York, NY, USA, [18] T. Funkhouser, M. Kazhdan, P. Shilane, P. Min, W. Kiefer, A. Tal, S. Rusinkiewicz, and D. Dobkin. "Modelling by example", ACM Trans. Graph., 23(3):652-663, 2004 [19] K. Zhou, J. Synder, B. Guo, and H.-Y. Shum, "Isocharts: stretch-driven mesh parameterization using spectral analysis", In SGP '04: Proceedings of the 2004 Eurographics/ ACM SIGGRAPH symposium on Geometry processing, pages 45-54, New York, NY, USA [20] G. Peyre and L. D. Cohen, "Geodesic remeshing using front propagation", Int. J. Comput. Vision, 69(1):145156, 2006 [21] O. Sifri, A. Sheffer, and C. Gotsman,"Geodesic-based surface remeshing", In Proc. 12th International Meshing Roundtable, pages 189-199, 2003. [22] A. Elad and R. Kimmel, "On bending invariant signatures for surfaces", IEEE Transactions on Pattern Analysis and Machine Intelligence, 25(10):1285-1295, 2003. [23] M. Hilaga, Y. Shinagawa, T. Kohmura, and T. L. Kunii., "Topology matching for fully automatic similarity estimation of 3d shapes", In SIGGRAPH '01: Proceedings of the 28th annual conference on Computer graphics and interactive techniques, pages 203-212, New York, NY, USA. [24] P.-P. J. Sloan, I. Charles F. Rose, and M. F. Cohen, "Shape by example", In I3D '01: Proceedings of the 2001 symposium on Interactive 3D graphics, pages 135-143, New York, NY,USA. [25] J. A. Sethian and A. M. Popovici, "3-d traveltime computation using the fast marching method", Geophysics, 64(2):516-523, 2006.

9. REFERENCES
[1] "Introduction to Euclidean Distance" http:// en.wikipedia.org/wiki/Euclidean_distance [2] D.P. Huttenlocher, G.A. Klanderman, and W.J. Rucklidge, "Comparing Images Using the Hausdorff Distance," IEEE Trans. Pattern Analysis and Machine Intelligence, vol. 15, no. 9, pp. 850-863, Sep.1993. [3] P. Simard, Y.L. Cun, and J. Dender, "Efficient Pattern Recognition Using a New Transformation Distance," Advances in Neural Information Processing Systems, pp. 5058, 1993. [4] R.Bajcsy, and S. Lovacic, "Multiresolution Elastic Matching," Computer Vision, Graphics, and Image Processing, vol. 46, pp. 1-21, 1989. [5] J. Li, G. Chen, and Z. Chi, "A Fuzzy Image Metric with Application to Fractal Coding," IEEE Trans. Image Processing, vol. 11, no. 6, pp. 636-643, June 2002. [6] "How Euclidean functions ", at workhttp:// resources.esri.com/help/9.3/arcgisdesktop/com/ gp_toolref/ spatial_analyst_tools/how_e uclidean_functions_work.htm [7] U. Montanari, A method for obtaining skeletons using a quasi-Euclidean distance, J. Assoc. Comput. Mach. 15, 1968, 600-624. [8] A. Rosenfeld and J. L. Pfaltz, Sequential operations in digital picture processing, J. Assoc. Comput. Mach. 13, 1966, 471-494. [9] A. Rosenfeld and J. L. Pfaltz, "Distance functions on digital pictures, Pattern Recog". 1, 1968, 33-61. [10] G. Borgefors, "Applications using distance transforms, in Aspects of Visual Form Processing"(C. Arcelli, L. P. Cordella, and G. Sanniti di Baja, Eds.), pp. 83-108, World Scientific, Singapore, 1994. [11] Borgefors G, "Distance transformations in digital images" Computer Vision, Graphics, and Image Processing 1986, 34:344-371.

February 2012

International Journal of Research in Computers

38
[26] S. S. Skiena, "The algorithm design manual", Springer, 2000. [27] A. M. Bronstein, M. M. Bronstein, Y. S. Devir, and R. Kimmel, "Parallel algorithms for approximation of distance maps on parametric surfaces", Technical Report, 2007. [28] R. Kimmel and J. Sethian, "Computing geodesic paths on manifolds", In Proceedings of National Academy of Sciences, pages 8431-8435, 1998. [29] J. Sethian, "A fast marching level set method for monotonically advancing fronts", In Proc. Natl. Acad. Sci., volume 93, pages 1591-1595, February 1996. [30] J. S. B. Mitchell, D. M. Mount, and C. H. Papadimitriou, "The discrete geodesic problem", SIAM J. Comput.,16(4):647-668, 1987. [31] "Introduction to Geodesic Distance " at http:// brainvis.wustl.edu/wiki/index.php/Caret: Documentation: MetricSmoothing [32] "Overview of Manhattan Distance" at http:// www.improvedoutcomes.com/docs/WebSiteDocs/Clustering/Clustering_Parameters / anhattan_Distance_Metric.htm [33] "Manhattan distance", http://en.wiktio nary .org/ wiki/ Manhattan_distance [34] Theo E. Schouten, Harco Kuppens and Egon L. van den Broek, "Timed Fast Exact Euclidean Distance (tFEED) Maps", Nijmegen Institute for Computing and Information Science, Radboud University Nijmegen. [35] "Distance functions in the Pattern Recognition Toolbox " at http://www.new folderconsulting.com/prtdoc/ prtDocDista nce.html [36] Sarah F. Frisken Gibson, "Calculating the Distance Map for Binary Sampled Data" , TR99-26 December 1999 [37] Antoni Moore, "The case for approximate Distance Transforms", SIRC 2002 - The 14th Annual Colloquium of the Spatial Information Research Centre University of Otago, Dunedin, New Zealand December 3-5th 2002 Mr. R. Balu received his Master of Computer Science from Bharathidasan University, Trichy in 2005 and M.Phil in Computer Science from Bharathiar University, Coimbatore in 2008. Currently, he is a working a guest faculty in Department of Computer Application, School of Computer Science and Engg., Bharathiar University, Coimbatore. He is pursuring his Ph.D. in Computer Science. His current research interests are in the fields of Image Mining, Networks, Multimedia and Data Mining. He is a member of IEEE, CSS, IET, and IAENG. Dr. T. Devi received Master of Computer Applications from P.S.G. College of Technology, Coimbatore in 1987 and PhD from the University of Warwick, United Kingdom in 1998 and awarded " Excellent innovation". She is, presently working as a Reader and Head i/c in Department of Computer Application, Bharathiar University, Coimbatore. Prior to joining Bharathiar University, she was an Associate Professor in Indian Institute of Foreign Trade, New Delhi. Her current research includes Software Engineering, Product Introduction, Technical Process Management and Concurrent Engineering. She has contributed more than 74 papers in various National / International conference / journals.

February 2012

International Journal of Research in Computers

You might also like