Analyze Shape Characteristics of Object

Shape analysis outputs numeric properties for an input object (contour or grouped contours), works best on grouped contours.

analyze_object(img, imgname, obj, mask, device, debug=False, filename=False)

returns device, shape data headers, shape data, image with shape data

  • Parameters:
    • img - image object (most likely the original), color(RGB)
    • imgname - name of image
    • obj - single or grouped contour object
    • device - Counter for image processing steps
    • debug - Default value is False, if True, intermediate image with ROI will be printed
    • filename - False or image name. If defined print image
  • Context:
    • Used to output shape characteristics of an image, including height, object area, convex hull, convex hull area, perimeter, extent x, extent y, longest axis, centroid x coordinate, centroid y coordinate, in bounds QC (if object touches edge of image, image is flagged).
  • Example use:

Original image

Screenshot

import plantcv as pcv

# Characterize object shapes

device, shape_header,shape_data,shape_img = pcv.analyze_object(img, imgname, objects, mask, device, debug=True, /home/malia/setaria_shape_img.png)

Image with identified objects

Screenshot

Image with shape characteristics

Screenshot