Here's an example code to perform seed-based region growing segmentation for a grayscale image in MATLAB using the watershed transform:
main.m523 chars25 lines
The code above first threshold the input grayscale image and then compute its Euclidean distance transform. The regional minima of the distance transform are then computed and marked as markers for the watershed segmentation. Finally, the watershed transform is applied on the distance transform using the markers as seed regions to segment the grayscale image. The result is then displayed using different colors for each segmented region.
gistlibby LogSnag