Learn R Programming

patternize (version 0.0.5)

kImage: 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)

Value

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

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).

Examples

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

Run the code above in your browser using DataLab