Segment a Skeleton¶
Turn a skeletonized image into separate pieces.
plantcv.morphology.segment_skeleton(skel_img, mask=None)
returns Segmented image, segment objects
- Parameters:
- skel_img - Skeleton image (output from plantcv.morphology.skeletonize)
- mask - Binary mask for debugging (optional). If provided, debug image will be overlaid on the mask.
- Context:
- Breaks skeleton into segments. Performs the exact same process as plantcv.morphology.prune
when
size=0
. If the prune function is performed, usingplantcv.morphology.segment_skeleton
is redundant.
- Breaks skeleton into segments. Performs the exact same process as plantcv.morphology.prune
when
Reference Images
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"
# Adjust line thickness with the global line thickness parameter (default = 5),
# and provide binary mask of the plant for debugging. NOTE: the objects and
# hierarchies returned will be exactly the same but the debugging image (segmented_img)
# will look different.
pcv.params.line_thickness = 3
segmented_img, obj = pcv.morphology.segment_skeleton(skel_img=skeleton)
segmented_img2, obj = pcv.morphology.segment_skeleton(skel_img=skeleton,
mask=plant_mask)
Segmented Image without Mask
Segmented Image with Mask