kImage {patternize}R Documentation

kmeans clustering of image imported as a RasterStack. This function is used by patLanK and patRegK.

Description

kmeans clustering of image imported as a RasterStack. This function is used by patLanK and patRegK.

Usage

kImage(image, k = 5, startCenter = NULL, maskToNA = NULL, kmeansOnAll = FALSE)

Arguments

image

Image imported as a RasterStack for k-means clustering.

k

Integer for number of k-means clusters (default = 3).

startCenter

A matrix of cluster centres to start k-means clustering from (default = NULL).

maskToNA

Replace the color value used for masking (i.e. 0 or 255) with NA.

kmeansOnAll

Whether to perform the kmeans clusters on the combined set of pixels of all images first (default = FALSE).

Value

List including the k-means clustered RasterSatck returned as an array and object of class "kmeans".

Examples

image <- raster::stack(system.file("extdata", "BC0077.jpg", package = "patternize"))
out <- kImage(image, 6)


[Package patternize version 0.0.5 Index]