RGB to CIE-XYZ

Hi all!

I have a question about converting RGB to CIE-XYZ with xyz_rgb.cal.

For transforming XYZ into RGB I can use this lines:

rcalc -f xyz_rgb.cal -e 'ix=$1;iy=$2;iY=$3' -f xyz_rgb.cal \
-e 'iX=ix/iy*iY;iZ=(1-ix-iy)/iy*iY' \
-e '$1=R(iX,iY,iZ) ; $2=G(iX,iY,iZ) ; $3=B(iX,iY,iZ)'

But there is also a part for calculating CIE-XYZ from RGB values, isn�t it?

Unfortenatly, I don�t know what lines I have to write.

Thanks,

Nina

Hi Nina,

These are the formulas you need to convert from Yxy to radiance-rgb:

X=x*Y/y;
Z=(1-x-y)*Y/y;
r= 2.565*X -1.167*Y -0.398*Z;
g= -1.022*X +1.978*Y +0.044*Z;
b= 0.075*X -0.252*Y +1.177*Z;

Raphael

···

At 28.06.2005 17:25, you wrote:

Hi all!

I have a question about converting RGB to CIE-XYZ with xyz_rgb.cal.

For transforming XYZ into RGB I can use this lines:

rcalc -f xyz_rgb.cal -e 'ix=$1;iy=$2;iY=$3' -f xyz_rgb.cal \
-e 'iX=ix/iy*iY;iZ=(1-ix-iy)/iy*iY' \
-e '$1=R(iX,iY,iZ) ; $2=G(iX,iY,iZ) ; $3=B(iX,iY,iZ)'

But there is also a part for calculating CIE-XYZ from RGB values, isn´t it?

Unfortenatly, I don´t know what lines I have to write.

Thanks,

Nina

_______________________________________________
Radiance-general mailing list
[email protected]
http://www.radiance-online.org/mailman/listinfo/radiance-general

Sorry my previous answer was just irrelevant to your question...
In fact you need the inverse transformation. Here it is:

X=0.5142*r + 0.3240*g + 0.1618*b;
Y=0.2652*r + 0.6702*g + 0.0646*b;
Z=0.0240*r + 0.1229*g + 0.8531*b;

x=X/(X+Y+Z);
y=Y/(X+Y+Z);
z=Z/(X+Y+Z);

Hope this will help you.

Raphaël

···

At 28.06.2005 17:25, you wrote:

Hi all!

I have a question about converting RGB to CIE-XYZ with xyz_rgb.cal.

For transforming XYZ into RGB I can use this lines:

rcalc -f xyz_rgb.cal -e 'ix=$1;iy=$2;iY=$3' -f xyz_rgb.cal \
-e 'iX=ix/iy*iY;iZ=(1-ix-iy)/iy*iY' \
-e '$1=R(iX,iY,iZ) ; $2=G(iX,iY,iZ) ; $3=B(iX,iY,iZ)'

But there is also a part for calculating CIE-XYZ from RGB values, isn´t it?

Unfortenatly, I don´t know what lines I have to write.

Thanks,

Nina

_______________________________________________
Radiance-general mailing list
[email protected]
http://www.radiance-online.org/mailman/listinfo/radiance-general

Thank you Raphael, but this is not the thing I wanted to know.

I would like to calculate XYZ from RGB with xyz_rgb.cal.

What I need are the commands that xyz_rgb.cal will calculate it.

rcalc ....

I hope anybody can help me.

Thanks, Nina

Raphael Compagnon schrieb:

···

Sorry my previous answer was just irrelevant to your question...
In fact you need the inverse transformation. Here it is:

X=0.5142*r + 0.3240*g + 0.1618*b;
Y=0.2652*r + 0.6702*g + 0.0646*b;
Z=0.0240*r + 0.1229*g + 0.8531*b;

x=X/(X+Y+Z);
y=Y/(X+Y+Z);
z=Z/(X+Y+Z);

Hope this will help you.

Rapha�l

At 28.06.2005 17:25, you wrote:

Hi all!

I have a question about converting RGB to CIE-XYZ with xyz_rgb.cal.

For transforming XYZ into RGB I can use this lines:

rcalc -f xyz_rgb.cal -e 'ix=$1;iy=$2;iY=$3' -f xyz_rgb.cal \
-e 'iX=ix/iy*iY;iZ=(1-ix-iy)/iy*iY' \
-e '$1=R(iX,iY,iZ) ; $2=G(iX,iY,iZ) ; $3=B(iX,iY,iZ)'

But there is also a part for calculating CIE-XYZ from RGB values, isn�t it?

Unfortenatly, I don�t know what lines I have to write.

Thanks,

Nina

_______________________________________________
Radiance-general mailing list
[email protected]
http://www.radiance-online.org/mailman/listinfo/radiance-general

Hi Nina,

Raphael gave the equivalent formula as you get from xyz_rgb.cal unless you change the primaries or white point in there. To use the formulas from xyz_rgb.cal, try:

rcalc -f xyz_rgb.cal -e 'iR=$1;iG=$2;iB=$3' -e '$1=X(iR,iG,iB);$2=Y(iR,iG,iB);$3=Z(iR,iG,iB)'

As you give R G B on input, you'll get X Y Z on output.

-Greg

···

From: Nina Wittmann <[email protected]>
Date: June 29, 2005 3:02:56 PM GMT+02:00

Thank you Raphael, but this is not the thing I wanted to know.

I would like to calculate XYZ from RGB with xyz_rgb.cal.

What I need are the commands that xyz_rgb.cal will calculate it.

rcalc ....

I hope anybody can help me.

Thanks, Nina