Basic Morphology (Binary»Basic Morphology)

NI Vision Builder AI Vision Assistant

Basic Morphology (Binary»Basic Morphology)

Affects the shape of particles in binary images. Each particle or region is affected on an individual basis. You can use these functions for tasks such as expanding or reducing objects, filling holes, closing particles, or smoothing boundaries, which are tasks you perform to delineate objects and prepare images for quantitative analysis.

  • Basic Morphology
    Image Source Opens the original input image.
    Erode objects Eliminates pixels isolated in the background and erodes the contour of objects based on the structuring element. Erosion makes objects smaller.
    Dilate objects Eliminates tiny holes isolated in objects and expands the contour of the objects based on the structuring element. Dilation makes objects larger.
    Open objects Removes small objects and smoothes boundaries. An opening is an erosion followed by a dilation, which does not significantly alter the area or shape of objects. Borders removed by erosion are restored by dilation, but small objects that were removed during erosion do not reappear after dilation.
    Close objects Fills tiny holes and smoothes boundaries. A closing is a dilation followed by erosion, which does not significantly alter the area or shape of objects. Objects are expanded by the dilation and then reduced by erosion, so borders are smoothed and holes are filled.
    Proper Open Removes small particles and smoothes the contour of objects based on the structuring element. It is a finite and dual combination of openings and closings.
    Proper Close Fills tiny holes and smoothes inner contours of objects based on the structuring element. It is a finite and dual combination of closings and openings.
    Gradient In Extracts the interior contours of a particle.
    Gradient Out Extracts the exterior contours of a particle.
    Auto Median Simplifies objects based on the structuring element so that they have fewer details. The Auto Median function uses dual combinations of openings and closings.
    Thick Alters the shape of objects by adding parts to the object that match the pattern specified in the structuring element. Thickening is useful for filling holes and smoothing right angles along edges of objects.
    Thin Alters the shape of objects by eliminating parts of the object that match the pattern specified in the structuring element. Thinning is useful for removing single pixels isolated in the background and right angles along edges of objects.
  • Structuring Element
    2D array used as a binary mask to define the neighbors of a pixel. You can modify the structuring element by clicking its cells. If a cell is black, it has a value of 1. If a cell is white (empty), it has a value of 0. If cell is black, the corresponding pixel is considered to be a neighbor and its value is used during the morphology operation.
  • Size—Size of the structuring element. Valid values include 3 x 3, 5 x 5, and 7 x 7.
  • Iterations—Specifies the number of 3 x 3 erosions to apply to the image.
  • Square/Hexagon—Specifies the shape of the pixel frame during the transformation.
    Square pixel frame. Each pixel is surrounded by eight neighbors. The vertical and horizontal neighbors have a distance d from the pixel. Diagonal pixels have a slightly greater distance because they are farther away from the central pixel.
    Hexagon pixel frame. Each pixel is surrounded by six neighbors, which are each located at an equal distance from the central pixel.

Related Topics

Expanding (dilating) objects in binary images

Extracting the contours of a particle

Filling gaps and holes (close) in binary images

Filling holes and smoothing right angles

Reducing (eroding) objects in binary images

Removing single pixels and right angles

Removing small objects (open) from binary images

Smoothing object boundaries in binary images