Geodesic distance transform of binary image
D = bwdistgeodesic(BW,mask)
D = bwdistgeodesic(BW,C,R)
D = bwdistgeodesic(BW,ind)
D = bwdistgeodesic(...,method)
computes
the geodesic distance transform, given the binary image D
= bwdistgeodesic(BW
,mask
)BW
and
the seed locations specified by mask
. Regions where BW
is true
represent
valid regions that can be traversed in the computation of the distance
transform. Regions where BW
is false
represent
constrained regions that cannot be traversed in the distance computation.
For each true
pixel in BW
, the
geodesic distance transform assigns a number that is the constrained
distance between that pixel and the nearest true
pixel
in mask
. Output matrix D
contains
geodesic distances.
computes
the geodesic distance transform of the binary image D
= bwdistgeodesic(BW
,C,R
)BW
.
Vectors C
and R
contain the
column and row coordinates of the seed locations.
computes
the geodesic distance transform of the binary image D
= bwdistgeodesic(BW
,ind
)BW
. ind
is
a vector of linear indices of seed locations.
specifies
an alternate distance metric.D
= bwdistgeodesic(...,method
)

Binary image.  

Logical image the same size as  

Numeric vectors that contain the positive integer column and
row coordinates of the seed locations. Coordinate values are valid  

Numeric vector of positive integer, linear indices of seed locations.  

Type of distance metric.
Default: 

Numeric array of class 
BW
is a logical matrix. C
, R
,
and ind
are numeric vectors that contain positive
integer values. D
is a numeric array of class single
that
has the same size as the input BW
.
Compute the geodesic distance transformation of BW
based
on the seed locations specified by vectors C
and R
.
Output pixels for which BW
is false have undefined
geodesic distance and contain NaN values. Because there is no connected
path from the seed locations to element BW(10,5)
,
the output D(10,5)
has a value of Inf
.
BW = [1 1 1 1 1 1 1 1 1 1;... 1 1 1 1 1 1 0 0 1 1;... 1 1 1 1 1 1 0 0 1 1;... 1 1 1 1 1 1 0 0 1 1;... 0 0 0 0 0 1 0 0 1 0;... 0 0 0 0 1 1 0 1 1 0;... 0 1 0 0 1 1 0 0 0 0;... 0 1 1 1 1 1 1 0 1 0;... 0 1 1 0 0 0 1 1 1 0;... 0 0 0 0 1 0 0 0 0 0]; BW = logical(BW); C = [1 2 3 3 3]; R = [3 3 3 1 2]; D = bwdistgeodesic(BW,C,R);