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

R语言:make.rgb()函数中文帮助文档(中英文对照)

[复制链接]
发表于 2012-2-16 21:40:59 | 显示全部楼层 |阅读模式
make.rgb(grDevices)
make.rgb()所属R语言包:grDevices

                                        Create colour spaces
                                         创建色彩空间

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

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

These functions specify colour spaces for use in convertColor.
这些功能在convertColor使用指定的色彩空间。


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


make.rgb(red, green, blue, name = NULL, white = "D65",
         gamma = 2.2)

colorConverter(toXYZ, fromXYZ, name, white=NULL)



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

参数:red,green,blue
Chromaticity (xy or xyY) of RGB primaries
色度(XY或XYY)的RGB原色


参数:name
Name for the colour space
色彩空间名称


参数:white
Character string specifying the reference white (see "Details".)
字符串指定的参考白“(见”详细资料“。)


参数:gamma
Display gamma (nonlinearity). A positive number or the string "sRGB"  
显示器的伽马(非线性)。一个正数或字符串"sRGB"


参数:fromXYZ
Function to convert from XYZ tristimulus coordinates to this space
从XYZ三刺激函数来转换这个空间坐标


参数:toXYZ
Function to convert from this space to XYZ tristimulus coordinates.
从这个空间到XYZ三刺激函数来转换坐标。


Details

详情----------Details----------

An RGB colour space is defined by the chromaticities of the  red, green and blue primaries.  These are given as vectors of length 2 or 3 in xyY coordinates (the Y component is not used and may be omitted). The chromaticities are defined relative to a reference white, which must be one of the CIE standard illuminants: "A", "B", "C", "D50", "D55", "D60", "E" (usually "D65").
RGB色彩空间定义的红,绿,蓝原色的色度。这些都为向量,长度为2的或XYY坐标(Y分量不使用,可以省略)3。相对参考白色的色度定义,它必须是CIE标准光源之一,“A”“B”“C”,“D50的”,“D55”,“D60”,的“E”(通常是“D65,”)。

The display gamma is most commonly 2.2, though 1.8 is used for Apple RGB. The sRGB standard specifies a more complicated function that is close to a gamma of 2.2; gamma="sRGB" uses this function.
显示器的伽马是最常见的2.2,虽然1.8是苹果RGB。 sRGB标准指定了一个更复杂的功能,即接近2.2的伽玛; gamma="sRGB"使用此功能。

Colour spaces other than RGB can be specified directly by giving conversions to and from XYZ tristimulus coordinates. The functions  should take two arguments. The first is a vector giving the coordinates for one colour. The second argument is the reference white. If a specific reference white is included in the definition of the colour space (as for the RGB spaces) this second argument should be ignored and may be ....
比RGB颜色空间,可以直接指定给XYZ三刺激坐标转换。的职能应采取两个参数。首先是一个向量,给人一种颜色的坐标。第二个参数是白色的参考。如果在色彩空间的定义中包含了一个特定的参考白(RGB空间)这第二个参数应该被忽略,可能是...。


值----------Value----------

An object of class colorConverter
一个对象的类colorConverter


参考文献----------References----------

<h3>See Also</h3>  <code>convertColor</code>

举例----------Examples----------


(pal <- make.rgb(red=  c(0.6400,0.3300),
                 green=c(0.2900,0.6000),
                 blue= c(0.1500,0.0600),
                 name = "PAL/SECAM RGB"))

## converter for sRGB in #rrggbb format[##RRGGBB格式的sRGB转换器]
hexcolor <- colorConverter(toXYZ = function(hex,...) {
                            rgb <- t(col2rgb(hex))/255
                            colorspaces$sRGB$toXYZ(rgb,...) },
                           fromXYZ = function(xyz,...) {
                              rgb <- colorspaces$sRGB$fromXYZ(xyz,..)
                              rgb <- round(rgb,5)
                              if (min(rgb) < 0 || max(rgb) > 1)
                                   as.character(NA)
                              else
                                   rgb(rgb[1],rgb[2],rgb[3])},
                           white = "D65", name = "#rrggbb")[RRGGBB“)]

(cols <- t(col2rgb(palette())))
(luv <- convertColor(cols,from="sRGB", to="Luv", scale.in=255))
(hex <- convertColor(luv, from="Luv",  to=hexcolor, scale.out=NULL))

## must make hex a matrix before using it[#必须在使用它之前的16进制矩阵]
(cc <- round(convertColor(as.matrix(hex), from= hexcolor, to= "sRGB",
                          scale.in=NULL, scale.out=255)))
stopifnot(cc == cols)

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


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

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-5-8 03:21 , Processed in 0.029788 second(s), 16 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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