Segmenting an image using a watershed transform

NI Vision Assistant

Segmenting an image using a watershed transform

Note  The watershed function works only with 8-bit and 16-bit images.

The following steps illustrate one method of segmenting objects.

  1. Threshold—(Grayscale»Threshold) Threshold the image to isolate the objects you want to segment from the rest of the image.
  2. Remove Noise—(Binary»Advanced Morphology or Binary»Particle Filter) Remove extraneous information from the binary image using various morphology operations. For example, you can fill in holes with the Advanced Morphology option Fill holes or remove noise with the Particle Filter function.
  3. Create Distance Map—(Binary»Advanced Morphology) Use the Danielsson option to transform the binary image into a grayscale image in which the center of each object represents a local maximum in the image. If you were to look at the topographical surface of the image after applying the distance map, each object would appear as a smooth, gradual peak.
  4. Apply Watershed Transform—(Grayscale»Watershed Segmentation) Apply the watershed transform to segment the image into local zones. A zone is determined by the watershed line that separates the influence zone of each peak.

Refer to the NI Vision Concepts Manual for more information about thresholding, morphology, distance transforms, or watershed transforms.

Related Topics

Threshold (Grayscale»Threshold)

Morphology (Binary»Advanced Morphology)

Particle Filter (Binary»Particle Filter