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.
ThresholdML(im, k, thr = "fast", sn = 30, mcn = 100, limit = 100,
intervalnumber = 1000, returnvalue = FALSE)
a grayscale image of class cimg
level of thresholding. k is ignored when thr is a numeric vector.
thresholds, either numeric vector, or "fast", or "precise", or "manual".
population size. sn is ignored except when thr is "manual".
maximum cycle number. mcn is ignored except when thr is "manual".
abandonment criteria. limit is ignored except when thr is "manual".
interval number of histogram. intervalnumber is ignored except when thr is "manual".
if returnvalue is TRUE, returns threshold values. if FALSE, returns a grayscale image of class cimg.
a grayscale image of class cimg or a numeric vector
Ming-HuwiHorng (2011). Multilevel thresholding selection based on the artificial bee colony algorithm for image segmentation. Expert Systems with Applications.
# NOT RUN {
g <- grayscale(boats)
ThresholdML(g, k = 2) %>% plot
# }
Run the code above in your browser using DataLab