Triangle Auto Threshold

Creates a binary image from a gray image using adaptive thresholding.

plantcv.threshold.triangle(gray_img, max_value, object_type="light", xstep=1)

returns thresholded/binary image

Grayscale image (green-magenta channel)

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"

# Create binary image from a gray image based
thresholded = pcv.threshold.triangle(gray_img, 255, 'light', xstep=10)

Triangle Auto-Thresholded image (xstep=10)

Screenshot 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"

# Create binary image from a gray image based 
thresholded = pcv.threshold.triangle(gray_img, 255, 'light', xstep=1)

Triangle Auto-Thresholded image (xstep=1)

Screenshot Screenshot