ThresholdML {imagerExtra} | R Documentation |
Multilevel Thresholding
Description
Segments a grayscale image into several gray levels. Multilevel thresholding selection based on the artificial bee colony algorithm is used when thr is not a numeric vector. Preset parameters for fast computing is used when thr is "fast". Preset parameters for precise computing is used when thr is "precise". You can tune the parameters if thr is "manual". Also you can specify the values of thresholds by setting thr as a numeric vector.
Usage
ThresholdML(im, k, thr = "fast", sn = 30, mcn = 100, limit = 100,
intervalnumber = 1000, returnvalue = FALSE)
Arguments
im |
a grayscale image of class cimg |
k |
level of thresholding. k is ignored when thr is a numeric vector. |
thr |
thresholds, either numeric vector, or "fast", or "precise", or "manual". |
sn |
population size. sn is ignored except when thr is "manual". |
mcn |
maximum cycle number. mcn is ignored except when thr is "manual". |
limit |
abandonment criteria. limit is ignored except when thr is "manual". |
intervalnumber |
interval number of histogram. intervalnumber is ignored except when thr is "manual". |
returnvalue |
if returnvalue is TRUE, returns threshold values. if FALSE, returns a grayscale image of class cimg. |
Value
a grayscale image of class cimg or a numeric vector
Author(s)
Shota Ochi
References
Ming-HuwiHorng (2011). Multilevel thresholding selection based on the artificial bee colony algorithm for image segmentation. Expert Systems with Applications.
Examples
g <- grayscale(boats)
ThresholdML(g, k = 2) %>% plot