medianRgb: Calculate the median RGB colour of an image.

Description Usage Arguments Value Examples

View source: R/cultural-analytics.r

Description

Calculate the median values for the RGB values of the image. The colour returned is not necessarily a colour in the image, it just contains the median values.

Usage

1
medianRgb(rgbs)

Arguments

rgbs

colorspace library RGB values

Value

A colorspace library RGB object representing the median RGB colour of the image. This may not match a colour actually in the image.

Examples

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])
rgbs<-imageToRgb(img)
rgbMed<-medianRgb(rgbs)

CulturalAnalytics documentation built on May 31, 2017, 3:28 a.m.