Cluster Contours

This function take a image with multiple contours and clusters them based on user input of rows and columns

platncv.cluster_contours(img, roi_objects, roi_obj_hierarchy, nrow=1,ncol=1)

returns grouped_contour_indexes, contours, hierarchy

ROI Objects Output

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"

# clusters them based on user input of rows and columns
clusters_i, contours,hierarchy = pcv.cluster_contours(img, roi_objects, roi_obj_hierarchy, 4, 6)

Cluster Contour Image

Screenshot