Description Usage Arguments Value Examples
This function uses k-means clustering to extract a palette from a data.frame representing the RGB values of pixels in an image. This is not the most state-of-the-art method of extracting a palette, but works as well as most photo editing software.
1 | dataFramePalette(dataframe, count)
|
dataframe |
A data.frame representing the colours of the pixels in the image,
generated by |
count |
The number of colours to try to extract |
A vector of colorspace library RGB objects.
1 2 3 4 5 6 7 | library(CulturalAnalytics)
library(jpeg)
imgdir<-paste(system.file(package = "CulturalAnalytics"), "images", sep = "/")
imgs<-paste(imgdir, dir(path = imgdir, pattern = ".jpg"), sep = "/")
img<-readJPEG(imgs[1])
df<-imageToDataFrame(img)
palette<-dataFramePalette(df, 8)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.