You are here : matlabImage Processingbwdistgeodesic

bwdistgeodesic() - Image Processing

D = bwdistgeodesic(BW,mask) computes
the geodesic distance transform, given the binary image 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.D = bwdistgeodesic(BW,C,R) computes
the geodesic distance transform of the binary image BW.
Vectors C and R contain the
column and row coordinates of the seed locations.D = bwdistgeodesic(BW,ind) computes
the geodesic distance transform of the binary image BW. ind is
a vector of linear indices of seed locations.D = bwdistgeodesic(...,method) specifies
an alternate distance metric.


Syntax

D = bwdistgeodesic(BW,mask)D = bwdistgeodesic(BW,C,R)D = bwdistgeodesic(BW,ind)D = bwdistgeodesic(...,method)


Example

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);


Output / Return Value


Limitations


Alternatives / See Also


Reference