Adaptive Threshold

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

plantcv.adaptive_threshold(img, maxValue, thres_type, object_type, device, debug=None)

returns device, thresholded image

Grayscale image (green-magenta channel)

Screenshot

from plantcv import plantcv as pcv

# Create binary image from a gray image based
device, threshold_gaussian = pcv.adaptive_threshold(img, 255, 'gaussian','dark', device, debug="print")

Auto-Thresholded image (gaussian)

Screenshot

from plantcv import plantcv as pcv

# Create binary image from a gray image based 
device, threshold_mean = pcv.adaptive_threshold(img, 255, 'mean','dark', device, debug="print")

Auto-Thresholded image (mean)

Screenshot