Convert XYZ or Linear RGB to Signal RGB, multiple RGB spaces are available
RGBfromXYZ( XYZ, space='sRGB', which='scene', TF=NULL, maxSignal=1 ) SignalRGBfromLinearRGB( RGB, space='sRGB', which='scene', TF=NULL, maxSignal=1 )
a data.frame
with N rows and these columns
signal RGB.
If TF
is not the identity, all input linear RGB values are clamped to the appropriate domain box,
which implies that the signal RGBs are inside the cube [0,maxSignal]
^\(3\).
Values are not rounded.
logical vector, TRUE means the input linear RGB was outside the domain box before clamping it.
In case of error, the functions return NULL.
a numeric Nx3 matrix with CIE XYZ coordinates in the rows, or a vector that can be converted to such a matrix, by row.
The XYZ are assumed to be viewed under the white-point of the given RGB space
.
a numeric Nx3 matrix with linear RGB coordinates in the rows, or a vector that can be converted to such a matrix, by row. The RGB may be outside the corresponding domain box (either scene or display), see Details.
the name of an installed RGB space. The name matching is partial and case-insensitive.
either 'scene'
or 'display'
.
For RGBfromXYZ()
which
describes the input XYZ.
For SignalRGBfromLinearRGB()
which
describes the input RGB.
if not NULL
, TF
is a TransferFunction
that overrides the appropriate transfer function of space
.
TF
can also be a positive number.
If TF=1
, then TF
is set to identity.TF
,
so the returned RGB values are actually linear, and they are not clamped to the appropriate domain box
(see Value).
If TF!=1
it is used to create either
power.EOTF()
or power.OETF()
as approriate.
If TF
is not NULL
in SignalRGBfromLinearRGB()
, then space
is ignored.
maximum value of non-linear RGB
.
Other common values are 100, 255, 1023, 4095, and 65535.
Even when 1, they are still taken to be non-linear Signal values.
In RGBfromXYZ()
, the conversion is done in 2 steps:
XYZ → linear RGB using the appropriate 3x3 matrix for the given space
and which
linear RGB → signal RGB using SignalRGBfromLinearRGB()
and all other the given arguments
Wikipedia. RGB color space. https://en.wikipedia.org/wiki/RGB_color_space
XYZfromRGB()
,
LinearRGBfromSignalRGB()
,
installRGB()
,
identity.TF
RGBfromXYZ( c(80.310897,90.306510,84.613450, 100,100,100)/100, max=255 )
## RGB.R RGB.G RGB.B OutOfGamut
## 1 230.1676 249.4122 225.2472 FALSE
## 2 255.0000 249.1125 244.4704 TRUE
Run the code above in your browser using DataLab