kImageHSV: 'kmeans' clustering of image imported as a RasterStack. This...

View source: R/kImageHSV.R

kImageHSVR 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

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

Arguments

image

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

ignoreHSVvalue

Whether to ignore the HSV value (~darkness).

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)


StevenVB12/patternize documentation built on Nov. 2, 2023, 8:01 p.m.