| im {spatstat} | R Documentation |
Creates an object of
class "im" representing a two-dimensional pixel image.
im(mat, xcol=seq(ncol(mat)), yrow=seq(nrow(mat)), lev=levels(mat))
mat |
matrix or vector containing the pixel values of the image. |
xcol |
vector of x coordinates for the pixels |
yrow |
vector of y coordinates for the pixels |
lev |
possible factor levels, if mat should be interpreted
as a factor.
|
This function creates an object of class "im" representing
a two-dimensional pixel image. See im.object
for details of this class.
If mat is not a matrix, it will first be converted into
a matrix with nrow(mat) = length(yrow) and
ncol(mat) = length(xcol).
Note that the row index of the matrix mat corresponds
to increasing y coordinate, while the column index of mat
corresponds to increasing x coordinate. Thus
xrow has one entry for each row of mat
and ycol has one entry for each column of mat. A correct
display of the image would be obtained by transposing, e.g.
image.default(xcol, yrow, t(mat)), if you wanted to do it by hand.
The internal representation of images is likely to change in the next release of this package.
Adrian Baddeley adrian@maths.uwa.edu.au http://www.maths.uwa.edu.au/~adrian/ and Rolf Turner rolf@math.unb.ca http://www.math.unb.ca/~rolf
whitenoise <- im(matrix(rnorm(10000), 100, 100)) image(whitenoise)