powered by
image_palette() creates image palettes by applying the k-means algorithm to the RGB values.
image_palette()
image_palette(img, npal = 5, proportional = TRUE, plot = TRUE)
image_palette() returns a list with two elements:
palette_list A list with npal color palettes of class Image.
palette_list
npal
Image
joint An object of class Image with the color palettes
joint
proportions The proportion of the entire image corresponding to each color in the palette
proportions
rgbs The average RGB value for each palette
rgbs
An image object.
The number of color palettes.
Creates a joint palette with proportional size equal to the number of pixels in the image? Defaults to TRUE.
TRUE
Plot the generated palette? Defaults to TRUE.
# \donttest{ library(pliman) img <- image_pliman("sev_leaf.jpg") pal <- image_palette(img, npal = 4) image_combine(pal$palette_list) # }
Run the code above in your browser using DataLab