readImage(EBImage)
readImage()所属R语言包:EBImage
Image I/O
图像I / O
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Functions to read and write images from/to files and URL's. The supported image formats depend on the capabilities of ImageMagick.
从/到文件和URL的读取和写入图像的函数。 ImageMagick的功能取决于所支持的图像格式。
用法----------Usage----------
readImage(files, colormode)
writeImage(x, files, quality = 100)
参数----------Arguments----------
参数:files
A character vector of file names or URLs. If missing, an interactive file chooser is displayed.
一个文件名或URL的字符向量。如果缺少一个互动的文件选择显示。
参数:x
An Image object or an array.
Image对象或数组。
参数:quality
A numeric, ranging from 1 to 100. Default is 100.
一个数字,从1到100不等。默认值为100。
参数:colormode
Deprecated.
已过时。
Details
详情----------Details----------
When writing images in formats supporting lossy compression (like JPEG), the quality can be specified used a quality value in the range [1,100]. The best quality is obtained with 100.
支持有损压缩格式(如JPEG)在写作时的图像质量,可以指定使用范围quality[1,100]值。得到最好的质量为100。
The file format is deduced from the file name extension.
推导出的文件扩展名的文件格式。
ImageMagick is used to perform all image I/O operations. Therefore, the package supports all the file types supported by ImageMagick.
ImageMagick用来执行所有图像I / O操作。因此,该软件包支持所有文件类型ImageMagick支持。
When reading images, files of different formats can be mixed in any sequence, including mixing single 2D images with TIFF image stacks. The result will contain a stack with all images and stacks, at the size of the first image read. Subsequent images are cropped (if larger) or filled with background (if smaller).
读取图像时,不同格式的文件可以在任何顺序混合,包括TIFF图像栈混合单一的二维图像。结果将包含一个堆栈,所有图片和栈大小的图像读取。后续图像被裁剪(如果较大),或填充背景(如小)。
readImage returns an Image object, containing an array of double values ranging from 0 (black) to 1 (white). Image formats have a limited dynamic range (e.g. JPEG: 8 bit, TIFF: 16 bit) and writeImage may cause some loss of accuracy.
readImage返回一个Image对象,包含一个从0(黑色)1(白)双值数组。图片格式有有限的动态范围(如JPEG:8位TIFF:16位)和writeImage可能会造成一些损失精度。
值----------Value----------
readImage returns a new Image object. writeImage returns invisible(files).
readImage返回一个新的Image对象。 writeImage返回invisible(files)。
作者(S)----------Author(s)----------
Oleg Sklyar, <a href="mailto sklyar@ebi.ac.uk">osklyar@ebi.ac.uk</a>, 2005-2006
参考文献----------References----------
举例----------Examples----------
## Reads and display images[#读取和显示图像]
f = system.file("images", "lena-color.png", package="EBImage")
x = readImage(f)
if (interactive()) display(x)
x = readImage(system.file("images", "nuclei.tif", package="EBImage"))
if (interactive()) display(x)
try({
im = readImage("http://www.google.com/intl/en/images/logo.gif")
if (interactive()) display(im)
})
## Converts a TIFF file into JPEG[#转换成JPEG TIFF文件]
f1 = system.file("images", "lena-color.png", package="EBImage")
x1 = readImage(f1)
f2 = paste(tempfile(), "jpeg", sep=".")
writeImage(x1, f2)
cat("Converted '", f1, "' into '", f2, "'.\n", sep='')
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|