rgbim {spatstat}R Documentation

Create Colour-Valued Pixel Image

Description

Creates an object of class "im" representing a two-dimensional pixel image whose pixel values are colours.

Usage

  rgbim(R, G, B, maxColorValue=255)
  hsvim(H, S, V)

Arguments

R,G,B

Pixel images (objects of class "im") or constants giving the red, green, and blue components of a colour, respectively.

maxColorValue

Maximum colour value for R,G,B.

H,S,V

Pixel images (objects of class "im") or constants giving the hue, saturation, and value components of a colour, respectively.

Details

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.

Author(s)

Adrian Baddeley Adrian.Baddeley@csiro.au http://www.maths.uwa.edu.au/~adrian/ and Rolf Turner r.turner@auckland.ac.nz

See Also

im.object, rgb, hsv.

See colourtools for additional colour tools.

Examples

  # create three images with values in [0,1]
  X <- setcov(owin())
  X <- eval.im(pmin(1,X))
  Y <- as.im(function(x,y){(x+1)/2}, W=as.owin(X))
  Z <- as.im(function(x,y){(y+1)/2}, W=as.owin(X))
  RGB <- rgbim(X, Y, Z, 1)
  HSV <- hsvim(X, Y, Z)
  plot(RGB, valuesAreColours=TRUE)
  plot(HSV, valuesAreColours=TRUE)

[Package spatstat version 1.25-3 Index]