一些距离测算方法

曼哈顿距离

出租车距离Taxicab geometry曼哈顿距离 city block distance, Manhattan distance, or Manhattan length

 

曼哈顿距离——两点在南北方向上的距离加上在东西方向上的距离,即d(i,j)=|xi-xj|+|yi-yj|。对于一个具有正南正北、正东正西方向规则布局的城镇街道,从一点到达另一点的距离正是在南北方向上旅行的距离加上在东西方向上旅行的距离,因此曼哈顿距离又称为出租车距离,曼哈顿距离不是距离不变量,当坐标轴变动时,点间的距离就会不同。

 

曼哈顿与欧几里得距离: 红、蓝与黄线分别表示所有曼哈顿距离都拥有一样长度(12),而绿线表示欧几里得距离有6×√2 ≈ 8.48的长度。

---------------------------------------------------------------------------------------------------------------------------------------

欧几里得距离Euclidean distance ,用尺子测量的距离

In mathematics, the Euclidean distance or Euclidean metric is the "ordinary" distance between two points that one would measure with a ruler, and is given by the Pythagorean formula

欧式距离即两项间的差是每个变量值差的平方和再平方根。

 

 

3、切比雪夫距离 Chebyshev distance 
 国际象棋玩过么?国王走一步能够移动到相邻的8个方格中的任意一个。那么国王从格子(x1y1)走到格子(x2y2)最少需要多少步?自己走走试试。你会发现最少步数总是max( | x2-x1 |  | y2-y1 | ) 步 。有一种类似的一种距离度量方法叫切比雪夫距离。
 
Solid white.svgabcdefghSolid white.svg
8a8 fiveb8 fourc8 threed8 twoe8 twof8 twog8 twoh8 two8
7a7 fiveb7 fourc7 threed7 twoe7 onef7 oneg7 oneh7 two7
6a6 fiveb6 fourc6 threed6 twoe6 onef6 white kingg6 oneh6 two6
5a5 fiveb5 fourc5 threed5 twoe5 onef5 oneg5 oneh5 two5
4a4 fiveb4 fourc4 threed4 twoe4 twof4 twog4 twoh4 two4
3a3 fiveb3 fourc3 threed3 threee3 threef3 threeg3 threeh3 three3
2a2 fiveb2 fourc2 fourd2 foure2 fourf2 fourg2 fourh2 four2
1a1 fiveb1 fivec1 fived1 fivee1 fivef1 fiveg1 fiveh1 five1
Solid white.svgabcdefghSolid white.svg
The Chebyshev distance between two spaces on a   chess  board gives the minimum number of moves a   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 effectively absorbed into the jumps covering the larger. Above are the Chebyshev distances of each square from the square f6.
 
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

http://homepages.inf.ed.ac.uk/rbf/HIPR2/metric.htm

Distance 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-called distance metrics possible 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 Eqn:eqnmet1 and Eqn:eqnmet2, then the Euclidean distance is given by:

Eqn:eqnmet3
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 by:

Eqn:eqnmet4
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 by:

Eqn:eqnmet5

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.

 
参考:
http://en.wikipedia.org/wiki/Distance_transform

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

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值