| [Top] [Up] [Prev] [Next] | [Up] [Basic Concepts] [Demonstrations] [Functions] | SDC Morphology Toolbox V1.1 15Jan02 |
y = mmdist( f, Bc, METRIC ) f: Binary image (logical uint8). Bc: Structuring element. (connectivity) Default: Elementary cross (mmsecross).METRIC: String. 'EUCLIDEAN' if specified. Default: No parameter.y: Gray-scale (uint8 or uint16) image. uint16 (distance image).mmdist creates the distance image y of the binary image f. The value of y at the pixel x is the distance of x to the complement of f, that is, the distance of x to nearest point in the complement of f. The distances available are based on the Euclidean metrics and on metrics generated by a a regular graph, that is characterized by a connectivity rule defined by the structuring element Bc. The implementation of the Euclidean algorithm is based on [LZ01] .a = mmframe(mmbinary(ones(5,9)),2,4) Warning: Converting image from double to uint16. a = 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 f4=mmdist(a) f4 = 6 5 4 3 2 3 4 5 6 5 4 3 2 1 2 3 4 5 4 3 2 1 0 1 2 3 4 5 4 3 2 1 2 3 4 5 6 5 4 3 2 3 4 5 6 f8=mmdist(a,mmsebox) f8 = 4 3 2 2 2 2 2 3 4 4 3 2 1 1 1 2 3 4 4 3 2 1 0 1 2 3 4 4 3 2 1 1 1 2 3 4 4 3 2 2 2 2 2 3 4 fe=mmdist(a,mmsebox,'EUCLIDEAN') fe = 4 4 3 2 2 2 3 4 4 4 3 2 1 1 1 2 3 4 4 3 2 1 0 1 2 3 4 4 3 2 1 1 1 2 3 4 4 4 3 2 2 2 3 4 4 |
f = mmreadgray('gear.tif'); f = mmneg(mmgradm(f)); d4=mmdist(f); d8=mmdist(f,mmsebox); de=mmdist(f,mmsebox,'EUCLIDEAN'); mmshow(f); mmshow(mod(double(d4),8)); Warning: Converting image from double to uint16. mmshow(mod(double(d8),8)); Warning: Converting image from double to uint16. mmshow(mod(double(de),8)); Warning: Converting image from double to uint16.
|




function g = mmdist_equ(f,Bc) z = logical(uint8(0)); g = mmgray(f,'uint8',1); ero = f; while ~mmisequal(ero,z) ero = mmero(ero,Bc); g = mmaddm(g,mmgray(ero,'uint8',1)); end
| [Top] [Up] [Prev] [Next] | [Up] [Basic Concepts] [Demonstrations] [Functions] |
|
| Copyright (c) 1998-2002 by SDC Information Systems | ||