This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)

MorphologicalTransform

MorphologicalTransform
applies the function f to the 3×3 neighborhood of each pixel in a binary image image.
MorphologicalTransform
applies a morphological transformation specified by a rule number rule.
MorphologicalTransform
uses a named transformation .
MorphologicalTransform
applies n iterations of transformation on image.
  • 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
Replace each pixel with the maximum value in each 3×3 neighborhood:
Use a rule that effectively finds isolated foreground pixels:
Use a sequence of operations to create a morphological opening:
Find the upper horizontal boundaries:
Use a named rule:
Iterate a transformation until convergence:
Replace each pixel with the maximum value in each 3×3 neighborhood:
In[1]:=
Click for copyable input
Out[1]=
 
Use a rule that effectively finds isolated foreground pixels:
In[1]:=
Click for copyable input
Out[1]=
 
Use a sequence of operations to create a morphological opening:
In[1]:=
Click for copyable input
Out[1]=
 
Find the upper horizontal boundaries:
In[1]:=
Click for copyable input
Out[1]=
 
Use a named rule:
In[1]:=
Click for copyable input
Out[1]=
 
Iterate a transformation until convergence:
In[1]:=
Click for copyable input
Out[1]=
Endpoints of a skeleton object:
Branch points of a skeleton object:
Fill one-pixel-wide gaps in images:
Delete isolated foreground pixels:
Delete isolated background pixels:
Flip the background and foreground pixel values while preserving the boundaries:
Find the perimeter of the objects:
Remove the 8-connectivity of the background:
Fill corners until convergence:
Find nonoverlapping bounding diamonds of objects:
Break the H-like features of the image:
Smooth boundaries and remove noise:
Translate objects by two pixels along the specified direction:
Straighten ragged boundaries:
Find branch points in a numeric array:
Replace the center pixels with the most common pixel value of the neighbors:
Compute the rule number that corresponds to a general transformation:
Rule number for a set of replacement rules that remove isolated foreground pixels:
Rule number corresponding to the Min function:
Find external boundaries of an image:
Negate an image:
Game of life:
New in 8