如何根据MATLAB中获得的距离变换进行手动计算?

How to do manual calculation based on distance transform obtain in MATLAB?

Euclideana 的距离变换。我正在使用 Euclidean = bwdist(a,'euclidean'); 基于此,我可以知道计算是如何进行的吗? from/to MATLAB在MATLAB的基础上计算得到欧几里德的什么点? 从公式 ,sqrt[(x2-x1)^2 + (y2-y1)^2],这意味着我们需要 2 个点。 MATLAB如何计算每个像素?谢谢

我觉得下面link对函数的解释比较直接。

https://uk.mathworks.com/help/images/ref/bwdist.html

D = bwdist(BW) computes the Euclidean distance transform of the binary image BW. For each pixel in BW, the distance transform assigns a number that is the distance between that pixel and the nearest nonzero pixel of BW.

对于你的第一个点a(1,1),最近的点是a(2,2),所以距离是sqrt(2)。

对于a(1,2),最近的非零也是a(2,2),所以距离是sqrt(1) = 1。

对于a(2,2),最近的非零是它自己,所以距离是sqrt(0) = 0。

祝你好运。