找回密码
 注册
查看: 332|回复: 0

R语言 spatstat包 im()函数中文帮助文档(中英文对照)

[复制链接]
发表于 2012-9-30 13:33:57 | 显示全部楼层 |阅读模式
im(spatstat)
im()所属R语言包:spatstat

                                        Create a Pixel Image Object
                                         创建一个像素图像对象

                                         译者:生物统计家园网 机器人LoveR

描述----------Description----------

Creates an object of class "im" representing a two-dimensional pixel image.
创建一个对象类"im"代表一个两维的像素的图像。


用法----------Usage----------


  im(mat, xcol=seq_len(ncol(mat)), yrow=seq_len(nrow(mat)),
   xrange=NULL, yrange=NULL,
   unitname=NULL)



参数----------Arguments----------

参数:mat
matrix or vector containing the pixel values of the image.  
矩阵或向量的图像中包含的像素值。


参数:xcol
vector of x coordinates for the pixel gid  
向量的x坐标的像素的gid


参数:yrow
vector of y coordinates for the pixel grid  
y向量坐标的像素网格


参数:xrange,yrange
Optional. Vectors of length 2 giving the x and y limits of the enclosing rectangle. (Ignored if xcol, yrow are present.)  
可选。矢量的长度为2x和y的包围矩形限制。 (如果xcol,yrow是存在。忽略)


参数:unitname
Optional. Name of unit of length. Either a single character string, or a vector of two character strings giving the singular and plural forms, respectively.  
可选。长度单位的名称。无论是单字符的字符串,或两个字符的字符串,分别给予单数和复数形式的向量。


Details

详细信息----------Details----------

This function creates an object of class "im" representing a two-dimensional pixel image. See im.object for details of this class.
这个函数创建一个对象类"im"代表一个二维像素的图像。见im.object:这个类的详细信息。

The matrix mat contains the "greyscale" values for a rectangular grid of pixels. Note carefully that the entry mat[i,j] gives the pixel value at the location (xcol[j],yrow[i]). That is, the row index of the matrix mat corresponds to increasing y coordinate, while the column index of mat corresponds to increasing x coordinate. Thus yrow has one entry for each row of mat and xcol has one entry for each column of mat. Under the usual convention in R, a correct display of the image would be obtained by transposing the matrix, e.g. image.default(xcol, yrow, t(mat)), if you wanted to do it by hand.
的矩阵mat包含灰度的值的像素的矩形栅格。请注意该条目mat[i,j]给出的像素值的位置处(xcol[j],yrow[i])。也就是说,矩阵mat对应于y坐标增加的行索引,而列索引mat对应于增加的x坐标。因此yrow具有一个条目的每一行的mat和xcolmat为每个列都有一个条目。在研发,按照通常的惯例,正确显示的图像将通过转置矩阵,例如: image.default(xcol, yrow, t(mat)),如果你想做到这一点的手。

The entries of mat may be numeric (real or integer), complex,  logical, character, or factor values. If mat is not a matrix, it will be converted into a matrix with nrow(mat) = length(yrow) and ncol(mat) = length(xcol).
mat的条目可以是数字的,复杂的逻辑,字符,或因子值(实数或整数)。 mat如果是不是矩阵,它会被转换成一个矩阵nrow(mat) = length(yrow)和ncol(mat) = length(xcol)。

To make a factor-valued image, note that  R has a quirky way of handling matrices with factor-valued entries. The command matrix cannot be used directly, because it destroys factor information. To make a factor-valued image, do one of the following:
为了使一个因素值图像,请注意,R有一个奇特的方式处理矩阵因子值的条目。命令matrix不能直接使用,因为它破坏因素的信息。为了使一个因素值图像,请执行下列操作之一:

Create a factor containing the pixel values, say mat <- factor(.....),  and then assign matrix dimensions to it by dim(mat) <- c(nr, nc) where nr, nc are the numbers of rows and columns. The resulting object mat is both a factor and a vector.
创建一个factor包含的像素值,说mat <- factor(.....),矩阵尺寸,然后分配给它的dim(mat) <- c(nr, nc)nr, nc行和列的数量。生成的对象mat是一个因素,一个向量。

Supply mat as a one-dimensional factor and specify the arguments xcol and yrow to determine the dimensions of the image.
供应mat作为一个一维的因素,并指定参数xcol和yrow,以确定的图像的尺寸。

Use the functions cut.im or eval.im to make factor-valued images from other images).
使用的功能cut.im或eval.im因子值图像图像)。

For a description of the methods available for pixel image objects, see im.object.
对于像素的图像对象的方法的描述,请参阅im.object。

To convert other kinds of data to a pixel image (for example, functions or windows), use as.im.
其他类型的数据转换到像素的图像(例如,函数或窗户),使用as.im。


警告----------Warnings----------

The internal representation of images is likely to change in future releases of spatstat. The safe way to extract pixel values from an image object is to use as.matrix.im or [.im.
图像的内部表示可能会发生变化,在未来版本的spatstat。从图像中提取像素值对象的安全方法是使用as.matrix.im或[.im。


(作者)----------Author(s)----------


Adrian Baddeley
<a href="mailto:Adrian.Baddeley@csiro.au">Adrian.Baddeley@csiro.au</a>
<a href="http://www.maths.uwa.edu.au/~adrian/">http://www.maths.uwa.edu.au/~adrian/</a>
and Rolf Turner
<a href="mailto:r.turner@auckland.ac.nz">r.turner@auckland.ac.nz</a>




参见----------See Also----------

im.object, as.im, as.matrix.im, [.im, eval.im
im.object,as.im,as.matrix.im,[.im,eval.im


实例----------Examples----------


   vec <- rnorm(1200)
   mat <- matrix(vec, nrow=30, ncol=40)
   whitenoise <- im(mat)
   whitenoise <- im(mat, xrange=c(0,1), yrange=c(0,1))
   whitenoise <- im(mat, xcol=seq(0,1,length=40), yrow=seq(0,1,length=30))
   whitenoise <- im(vec, xcol=seq(0,1,length=40), yrow=seq(0,1,length=30))
   plot(whitenoise)

   # Factor-valued images:[因子值图像:]
   f <- factor(letters[1:12])
   dim(f) <- c(3,4)
   Z <- im(f)

   # Factor image from other image:[其他因素图像图像:]
   cutwhite <- cut(whitenoise, 3)
   plot(cutwhite)

   # Factor image from raw data[图像原始数据的几个因素]
   cutmat <- cut(mat, 3)
   dim(cutmat) <- c(30,40)
   cutwhite <- im(cutmat)
   plot(cutwhite)

转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。


注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|小黑屋|生物统计家园 网站价格

GMT+8, 2025-6-14 13:02 , Processed in 0.020229 second(s), 16 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表