Skip to content

PlantCV

Requirements#

Requires the image-dataset-converter-plantcv library.

Example input#

The following binary image of a plant has been taken from this plantcv tutorial:

Example binary image of a plant (plant_binary.png)

Skeletonize a plant#

The pipeline below turns the binary image of a plant into a skeleton representation, i.e., 1-pixel wide:

idc-convert \
  -l INFO \
  from-data \
    -l INFO \
    -t od \
    -i {CWD}/input/plant_binary.png
  pcv-dilate \
    -k 3 \
    -i 1 \
  pcv-erode \
    -k 3 \
    -i 1 \
  pcv-fill \
    -s 30 \
  pcv-fill-holes \
  pcv-skeletonize \
    -p \
    -s 50 \
  pcv-skeletonize \
    -p \
    -s 50 \
  to-data \
    -l INFO \
    -o {CWD}/output

Generates the following output:

Skeletonized plant image (plant_binary-skeleton.png)

Find branches#

The pipeline below turns the binary image of a plant into a skeleton representation, i.e., 1-pixel wide:

idc-convert \
  -l INFO \
  from-data \
    -l INFO \
    -t od \
    -i {CWD}/input/plant_binary.png
  pcv-dilate \
    -k 3 \
    -i 1 \
  pcv-erode \
    -k 3 \
    -i 1 \
  pcv-fill \
    -s 30 \
  pcv-fill-holes \
  pcv-skeletonize \
    -p \
    -s 50 \
  pcv-find-branch-points \
  any-to-rgb \
  add-annotation-overlay-od \
    --text_format="" \
    --outline_thickness 3 \
    --bbox_outline_outwards \
    -c 255,0,0 \
  to-data \
    -l INFO \
    -o {CWD}/output

NB:: add-annotation-overlay-od requires the imgvis plugins.

Generates the following output (annotations overlaid onto skeletonized image):

Composite image of skeletonized plant image with branch locations (plant_binary-branches.png)