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.
- Threshold—(Grayscale»Threshold) Threshold the image to isolate the objects you want to segment from the rest of the image.
- 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.
- 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.
- 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)