Landini Threshold - Automatic Segmentation
Version 1.0.2 (2.14 KB) by Robin Hartley
Implementation of a method for automatic adaptive local thresholding and segmentation of greyscale images.
Updated 28 Dec 2022
This is an implementation of the algorithm developed by:
G. LANDINI, D. A. RANDELL, S. FOUAD & A. GALTON, "Automatic thresholding from the gradients of region boundaries", Journal of Microscopy, Vol. 265, Issue 2 2017, pp. 185–195
"We present an approach for automatic threshold segmenta-tionofgreyscaleimages.Theprocedureisinspiredbyareinter-pretation of the strategy observed in human operators whenadjusting thresholds manually and interactively by means of‘slider’ controls. The approach translates into two methods.The first one is suitable for single or multiple global thresh-olds to be applied globally to images and consists of searchingfor a threshold value that generates a phase whose bound-ary coincides with the largest gradients in the original image.The second method is a variation, implemented to operate onthe discrete connected components of the thresholded phase(i.e. the binary regions) independently. Consequently, this be-comes an adaptive local threshold procedure, which operatesrelative to regions, rather than to local image subsets as is thecaseinmostlocalthresholdingmethodspreviouslypublished.Adding constraints for specifying certain classes of expectedobjects in the images can improve the output of the methodover the traditional ‘segmenting first, then classify’ approach"
Amin = min particle area to detect
Amax = max particle area to detect
Cmin = min particle circularity to detect
Lmin = Lower threshold grayscale level
Lmax = Upper threshold grayscale level
For very large images the "for" in line 46 can be swapped for "parfor" if you have the paralel computing toolbox. This will speed up the algorithm.
I = imread('coins.png');
Rfill = Landini_Threshold(I,Amin,Amax,Cmin,Lmin,Lmax);
Robin Hartley (2023). Landini Threshold - Automatic Segmentation (https://www.mathworks.com/matlabcentral/fileexchange/119913-landini-threshold-automatic-segmentation), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Created with R2022b
Compatible with any release
Platform CompatibilityWindows macOS Linux
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!
Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.