rgbim {spatstat} | R Documentation |
Creates an object of
class "im"
representing a two-dimensional pixel image
whose pixel values are colours.
rgbim(R, G, B, A, maxColorValue=255, autoscale=FALSE) hsvim(H, S, V, A, autoscale=FALSE)
R,G,B |
Pixel images (objects of class |
A |
Optional. Pixel image or constant value giving the alpha (transparency) component of a colour. |
maxColorValue |
Maximum colour channel value for |
H,S,V |
Pixel images (objects of class |
autoscale |
Logical. If |
These functions take three pixel images, with real or integer pixel values, and create a single pixel image whose pixel values are colours recognisable to R.
Some of the arguments may be constant numeric values, but at least one of the arguments must be a pixel image. The image arguments should be compatible (in array dimension and in spatial position).
rgbim
calls rgb
to compute the colours,
while hsvim
calls hsv
. See the help for the relevant
function for more information about the meaning of the colour
channels.
Adrian Baddeley Adrian.Baddeley@curtin.edu.au, Rolf Turner r.turner@auckland.ac.nz and Ege Rubak rubak@math.aau.dk.
See colourtools
for additional colour tools.
# create three images with values in [0,1] X <- setcov(owin()) X <- eval.im(pmin(1,X)) M <- Window(X) Y <- as.im(function(x,y){(x+1)/2}, W=M) Z <- as.im(function(x,y){(y+1)/2}, W=M) # convert RGB <- rgbim(X, Y, Z, maxColorValue=1) HSV <- hsvim(X, Y, Z) opa <- par(mfrow=c(1,2)) plot(RGB, valuesAreColours=TRUE) plot(HSV, valuesAreColours=TRUE) par(opa)