image The segmented image considering only two classes (foreground and
background)
clusters The class of each pixel. For example, if ncluster = 3,
clusters will be a two-way matrix with values ranging from 1 to 3.
masks A list with the binary matrices showing the segmentation.
Arguments
img
An Image object.
bands
A numeric integer/vector indicating the RGB band used in the
segmentation. Defaults to 1:3, i.e., all the RGB bands are used.
nclasses
The number of desired classes after image segmentation.
invert
Invert the segmentation? Defaults to FALSE. If TRUE the
binary matrix is inverted.
filter
Applies a median filtering in the binary matrix? Defaults to
FALSE. Use a numeric integer to indicate the size of the median filter.
fill_hull
Fill holes in the objects? Defaults to FALSE.
plot
Plot the segmented image?
References
Hartigan, J. A. and Wong, M. A. (1979). Algorithm AS 136: A
K-means clustering algorithm. Applied Statistics, 28, 100–108.
tools:::Rd_expr_doi("10.2307/2346830")