Distance Calculation Methods

Source: Internet
Author: User
ArticleDirectory
    • Distance metrics
Manhattan distance

Taxi distanceTaxicab GeometryOrManhattan distanceCity block distance,Manhattan distance, OrManhattan Length

 

Distance from Manhattan-the distance between two points in the south and north plus the distance between East and West, that isD (I, j) = | Xi-XJ | + | Yi-YJ |.For a town street with regular layout in the north and south directions, the distance from one point to the other is the distance between the north and the south plus the distance between the East and the West, therefore, Manhattan distance is also called taxi distance. Manhattan distance is not a constant of distance. When the coordinate axis changes, the distance between points will be different.

Distance between Manhattan and Euclidean: red, blue, and yellow lines respectively indicate that all Manhattan has the same length (12), while the green line indicates that Euclidean distance is 6 × √ 2 ≈ 8.48.

Certificate ---------------------------------------------------------------------------------------------------------------------------------------

Euclidean distanceEuclidean distanceDistance measured with a ruler

In mathematics,Euclidean distanceOrEuclidean MetricIs the "ordinary" distance between two points that one wocould measure with a rstance, and is given by the Pythagorean Formula

Euclidean distance means that the difference between the two items is the sum of squares and the square root of the difference between the values of each variable.

 

 
3. Chebyshev distance
 
Have you ever played chess? The king can move one step to any of the eight adjacent squares. How many steps does the king need to move from a grid (x1y1) to a grid (x2y2? Try it by yourself. You will find that the minimum number of steps is always the max (| x2-x1 | y2-y1 |) step. There is a similar method for measuring the distance.
 
 

A B C D E F G H
8 8
7 7
6 6
5 5
4 4
3 3
2 2
1 1
A B C D E F G H
The Chebyshev distance between two spaces on   Chess   Board gives the minimum number of moves   Kingrequires to move between them. this is because a king can move diagonally, so that the jumps to cover the smaller distance parallel to a rank or column is too tively absorbed into the jumps covering the larger. abve are the Chebyshev distances of each square from the square F6. hour ------------------------------------------------- http://homepages.inf.ed.ac.uk/rbf/HIPR2/metric.htmDistance metrics

It is often useful in image processing to be able to calculate the distance between two pixels in an image, but this is not as straightforward as it seems. the presence of the Pixel Grid makes several so-calledDistance metricsPossible which often give different answers to each other for the distance between the same pair of points. We consider the three most important ones.

Euclidean distance

This is the familiar straight line distance that most people are familiar with. If the two pixels that we are considering have coordinates and, then the Euclidean distance is given:

City block distance

Also known as the Manhattan distance. this metric assumes that in going from one pixel to the other it is only possible to travel directly along Pixel Grid lines. diagonal moves are not allowed. therefore the 'city Block' distance is given:

Chessboard distance

This metric assumes that you can make moves on the Pixel Grid as if you were a king making moves in chess,I. e.A diagonal move counts the same as a horizontal move. This means that the metric is given:

Note that the last two metrics are usually much faster to compute than the Euclidean Metric and so are sometimes used where speed is critical but accuracy is not too important.

 
 
 
Refer:
 
Http://en.wikipedia.org/wiki/Distance_transform

Common metrics are :***************

    • Euclidean distance
    • Taxicab geometry, also knownCity block distanceOrManhattan distance.
    • Chessboard distance

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.