hsi2rgb: HSI to RGB Conversion

Description Usage Arguments Details Value Author(s) References Examples

View source: R/hsi2rgb.R

Description

hsi2rgb transforms colors from HSI space (hue/saturation/intensity) into RGB space (red/green/blue)

Usage

1
hsi2rgb(h, s = NULL, i = NULL, maxColorValue = 255)

Arguments

h

vector of 'hue' values in [0,360] or 3-row hsi matrix

s

vector of 'saturation' values in [0,1], or NULL when r is a matrix

i

vector of 'intensity' values in [0,1], or NULL when r is a matrix

Details

HSI is a variation of the HSV model, which provides color scales with monotonically increasing or decreasing brightness after linear interpolation

Value

A matrix with a column for each color. The three rows of the matrix indicate "red","green","blue" values and are named "r", "g", and "b" in [0,255] accordingly.

Author(s)

Jiahua Liu

References

Keim, Daniel A, and Hans-Peter Kriegel. 1995. "Issues in Visualizing Large Databases." In Visual Database Systems 3, 203-14. Springer.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
x=c(0,360)
y=c(1,0.4)
f=approxfun(x,y) # linear introploation function
l <- 100000 # number of colors
H=seq(x[1],x[2],length.out = l)
I=f(H)
S=rep(1,length(H))
R=hsi2rgb(H,S,I)[1,]
G=hsi2rgb(H,S,I)[2,]
B=hsi2rgb(H,S,I)[3,]
col1=rgb(R,G,B,maxColorValue = 255)
gr1=(0.34*R+0.5*G+0.16*B)/255
col2=grey(gr1)
par(mfrow=c(2,1))
barplot(rep(1,length(H)),col = col1,border = NA,beside = FALSE,space = c(0,0),main="HSI color mapping")
barplot(rep(1,length(H)),col = col2,border = NA,beside = FALSE,space = c(0,0))

rwoldford/glyphs documentation built on Nov. 14, 2020, 2:29 a.m.