SegmentedImage = Watershed(Image, Marker);
2D matrix of type uint8
2D matrix of type boolean, blobs consisting of %t pixels are seeds of watershed transform
2D matrix of type int32, has the same dimensions as image
RGB = ReadImage('contrib\IPD-3.1\demos\teaset.png'); Image = RGB2Gray(RGB); Gradient = EdgeFilter(Image, EDGE_SOBEL); EdgeImage = ~SegmentByThreshold(Gradient, 60); DistanceImage = DistanceTransform(EdgeImage); ThresholdImage = SegmentByThreshold(DistanceImage, 8); MarkerImage = SearchBlobs(ThresholdImage); SegmentedImage = Watershed(Gradient, MarkerImage); figure(); ColorMapLength = length(unique(SegmentedImage)); ShowImage(SegmentedImage, ... 'Result of Watershed Transform', ... jetcolormap(ColorMapLength));