Hello!I found very useful information about RGB to XYZ and further XYZ1 to XYZ2 transformations on mr. Lindbloom's site.
http://www.brucelindbloom.com/
Proper transform is probably RGB(input) to XYZ(input) Bradford transform to diferent color temperature XYZ(output) and transform to RGB(output).
All the necessary equations and theory is on that site.But be careful Color temperature is normaly in Kelvin scale, white point is most often as chromatic coordinates (small) xyz (x+y+z=1) but white point of illuminant can be also in CIE standardized values as (capitall) XYZ, that are in range from 0 to more than 100.
Regards Andrej Javorsek On 2006.1.19, at 5:44, Alex Lau wrote:
Thanks you so much for the reply Marti wrote:Hi, Alex, I don't fully undestand all the math you are using here. I think it would be better to separate things in order to make it clear. Assuming you want to change the image white point the steps would be:Yeah .. I don't really understand 100% either, but yes I'm basiclly alter the white point. (Colortemp?) So the white reference of different white point can be calculated by using colortemp to XY and XY to XYZ (assume Y=1). Is that ok?
a) Convert image to XYZ space. This can be done in several ways. If the image is in sRGB then you could use the gamma/matrix method, but not all images are in sRGB space.Right coverting image to xyz for me is also a difficult choice there are so many difficult matrix I can use but I pick the Bradford...( I forget why already :) I remember something something related to 2 and 10 degree observation point So let say I get a digitial capture jpg output what should I do to convert that RGB to XYZ?b) If white points are close enough, a simple scale would suffice. Somethink like: XYZout = XYZin * (WPout/WPin)I think this is what I'm trying to do in step 4if white points are not so close, then you would need something more complex, like an appearance model.is there any link I can understand more about that?c) Convert back the XYZ to the desired output space, which can be sRGB or any other.right here I get to use the Reverse Bradford ... since I come in XYZ with Bradford, with my logical guess I just assume what I use to come, after transform I go back out RGB the same way :)Bradford matrix is supposed to handle chromatic adaptation, which is how our brain gets rid of white point. This is used on perceptual & rel.colorimetric intents. I think you should use abs.colorimetric instead.hum ...any example of abs colorimetric? I can try it on my calculation and see it provide better result :) I see F-Spot using lcms doing the exact same thing but the result isa little different ( not big just a little ) and wonder how you did it.ThanksRegards Marti Maria The littleCMS project http://www.littlecms.com ----- Original Message ----- From: "Alex Lau" <[EMAIL PROTECTED]> To: <lcms-user@lists.sourceforge.net> Sent: Tuesday, January 17, 2006 9:26 AM Subject: [Lcms-user] Color TempDear all I'm new to the list. I have wrote some color temp transform function. And realized lcms able to do the same, I'm just trying clear my misunderstanding and make sure my implementation is correct. ( even though it look very close to photoshop raw plugin already ) What I do is this 1) first I get colortemp from and to and make a xy ( assume no lower then 2000k ) if( colortemp >= 2000 && colortemp <= 7000 ){ xyy->x =-4.607 * pow(10, 9)/ pow(colortemp, 3) + 2.967800 * pow(10,6) / pow(colortemp, 2) + 99.11 / colortemp + 0.244063; } else { xyy->x = -2.0064 * pow(10,9)/ pow(colortemp, 3) + 1.9018 * pow(10,6) / pow(colortemp, 2) + 247.48 / colortemp + 0.237040; } xyy->y = -3 * pow( xyy->x, 2 ) + 2.87 * xyy->x - 0.275; 2) Then XY to XYZ by assuming y = 1 new_xyz->X = orig_xyy->x / orig_xyy->y; new_xyz->Y = 1; new_xyz->Z = (1-orig_xyy->x - orig_xyy->y)/ orig_xyy->y; 3) Then using BradFord matrix to get the white reference rgb R = new_xyz->X * BradFord[0][0] + new_xyz->Y * BradFord[1][0] + new_xyz->Z * BradFord[2][0]; G = new_xyz->X * BradFord[0][1] + new_xyz->Y * BradFord[1][1] + new_xyz->Z * BradFord[2][1]; B = new_xyz->X * BradFord[0][2] + new_xyz->Y * BradFord[1][2] + new_xyz->Z * BradFord[2][2];4) New we get Source Color RGB white reference and Dest Color RGB WhiteReference for making the transformation matrix matrix[0][0] = BradFord[0][0]*destRGB->R/srcRGB->R; matrix[0][1] = BradFord[0][1]*destRGB->G/srcRGB->G; matrix[0][2] = BradFord[0][2]*destRGB->B/srcRGB->B; matrix[1][0] = BradFord[1][0]*destRGB->R/srcRGB->R; matrix[1][1] = BradFord[1][1]*destRGB->G/srcRGB->G; matrix[1][2] = BradFord[1][2]*destRGB->B/srcRGB->B; matrix[2][0] = BradFord[2][0]*destRGB->R/srcRGB->R; matrix[2][1] = BradFord[2][1]*destRGB->G/srcRGB->G; matrix[2][2] = BradFord[2][2]*destRGB->B/srcRGB->B; 5) transformation matrix = matrix * Reverse_BradFord Now we can start working on RGB 6) RGB->sRGB (by gamma apply) if( RGB <= 0.04045 ) RGB / 12.92 else pow ( ( (0.055 + RGB)/ 1.055), 2.4 ) ; 7) sRGB->XYZ (by multiple D65 transform matrix) X = R * D65[0][0] + G * D65[1][0] + B * D65[2][0]; Y = R * D65[0][1] + G * D65[1][1] + B * D65[2][1]; Z = R * D65[0][2] + G * D65[1][2] + B * D65[2][2]; Here is the question.. I see you are using D50 transform matrixwhich is for printing color space? I'm not sure how to choose, any idea?8) XYZ * transformation matrix 9) XYZ back to sRGB 10) sRGB back to RGB So basically is RGB->sRGB->XYZ->Transform->XYZ->sRGB->RGBI'm not sure what I'm talking about ... could someone tell me I'm rightor wrong :) Thanks Alex -------------------------------------------------------This SF.net email is sponsored by: Splunk Inc. Do you grep through logfiles for problems? Stop! Download the new AJAX search engine that makessearching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://sel.as-us.falkag.net/sel? cmd=lnk&kid=103432&bid=230486&dat=121642_______________________________________________ Lcms-user mailing list Lcms-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lcms-user-------------------------------------------------------This SF.net email is sponsored by: Splunk Inc. Do you grep through log filesfor problems? Stop! Download the new AJAX search engine that makessearching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://sel.as-us.falkag.net/sel? cmd=lnk&kid=103432&bid=230486&dat=121642_______________________________________________ Lcms-user mailing list Lcms-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lcms-user
smime.p7s
Description: S/MIME cryptographic signature