Watershed Segmentation

This function is based on code contributed by Suxing Liu, Arkansas State University. For more information see https://github.com/lsx1980/Leaf_count. This function uses the watershed algorithm to detect boundry of objects. Needs a mask file which specifies area which is object is white, and background is black

plantcv.watershed_segmentation(rgb_img, mask, distance=10, filename=False)**

returns watershed_header, watershed_data, analysis_images

Original image

Screenshot

from plantcv import plantcv as pcv

# Set global debug behavior to None (default), "print" (to file), or "plot" (Jupyter Notebooks or X11)
pcv.params.debug = "print"

# Segment image with watershed function
watershed_header, watershed_data, analysis_images = pcv.watershed_segmentation(crop_img, thresh, 10, './examples')

print(watershed_header)
print(watershed_data)

Watershed Segmentation

Screenshot

('HEADER_WATERSHED', 'estimated_object_count')
('WATERSHED_DATA', 10)