# MorphologicalTransform

MorphologicalTransform[image,f]

applies the function f to the 3×3 neighborhood of each pixel in a binary image image.

MorphologicalTransform[image,rule]

applies a morphological transformation specified by a rule number rule.

MorphologicalTransform[image,"name"]

uses a named transformation "name".

MorphologicalTransform[image,transformation,n]

applies n iterations of transformation on image.

# Details and Options

• In MorphologicalTransform[image,f], f is a function that maps arbitrary binary 3×3 matrices to 0s and 1s.
• MorphologicalTransform[image,{f1,f2,},n] applies the functions fi sequentially, iterating n times.
• MorphologicalTransform operates on a binary image or a list of binary images.
• The following named function specifications are supported.
• Finding features:
•  "EndPoints" find endpoints "SkeletonEndPoints" find endpoints of a skeleton object "SkeletonBranchPoints" find branch points of a skeleton
• Connecting regions:
•  "Bridge" set the center pixel to 1 if it connects two or more disconnected neighbor regions
• Filling and clearing:
•  "Clean" flip foreground pixels that have no direct neighbors "Flip" flip background and foreground pixels that have direct neighbors of same value "Fill" set pixels whose direct neighbors are white "Remove" clear pixels whose direct neighbors are white, leaving the perimeter "Break" clear the connecting pixel in H-shaped configurations "BoundingBoxes" fill gaps such that the object grows to its bounding box "BoundingDiamonds" fill gaps such that the object grows to its bounding diamond "DiagonalFill" fill diagonals "CornerFill" fill corners "BoundaryStraighten" clean ragged boundaries
• Totalistic and outer totalistic operations:
•  "Max" dilation with a 3×3 box matrix "Min" erosion with a 3×3 box matrix "Commonest" set the most frequent pixel value of the neighborhood "LifeGame" Game of Life operation
• Translation operations:
•  "Top" translate up by one pixel "Bottom" translate down by one pixel "Left" translate left by one pixel "Right" translate right by one pixel "TopLeft" translate top-left by one pixel "TopRight" translate top-right by one pixel "BottomLeft" translate bottom-left by one pixel "BottomRight" translate bottom-right by one pixel

# Examples

open allclose all

## Basic Examples(6)

Replace each pixel with the maximum value in each 3×3 neighborhood:

 In[1]:=
 Out[1]=

Use a rule that effectively finds isolated foreground pixels:

 In[1]:=
 Out[1]=

Use a sequence of operations to create a morphological opening:

 In[1]:=
 Out[1]=

Find the upper horizontal boundaries:

 In[1]:=
 Out[1]=

Use a named rule:

 In[1]:=
 Out[1]=

Iterate a transformation until convergence:

 In[1]:=
 Out[1]=