Creates a binary image from a grayscale image using skimage texture calculation for thresholding.
plantcv.threshold.texture(gray_img, ksize, threshold, offset=3, texture_method='dissimilarity', borders='nearest')
returns thresholded/binary image
- gray_img - Grayscale image data
- ksize - Kernel size for texture measure calculation
- threshold - Threshold value (0-255)
- offset - Distance offsets (default offset=3)
- texture_method - Feature of a grey level co-occurrence matrix, either ‘contrast’, ‘dissimilarity’ (default), ‘homogeneity’, ‘ASM’, ‘energy’, or ‘correlation’. For equations of different features see this link
- borders - How the array borders are handled, either ‘reflect’, ‘constant’, ‘nearest’ (default), ‘mirror’, or ‘wrap’
- Used to threshold based on texture
- This function is computationally expensive and will likely take several minutes to run (even longer if images are large).
- Example use:
Original image (lightness channel)
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 = "plot" # Create binary image from a gray image based on texture values. texture_img = pcv.threshold.texture(gray_img, ksize=6, threshold=7, offset=3, texture_method='dissimilarity', borders='nearest')
Source Code: Here