Thread: Re: [Lcms-user] XYZ to RGB Conversion
An ICC-based CMM for color management
Brought to you by:
mm2
From: Robert V C. <Rob...@us...> - 2009-09-30 14:39:45
|
I apparently am not setting the illuminant and observer. I thought I was but, in the larger code I have routines that convert Lab to RGB and I thought I was changing the observer and illuminant for this as well (different profile). The cmsCreateLabProfile allows me to set the white point,, the cmsCreateXYZProfile doen't have an argument for the white point. Excuse my lack of experience here, but how do I set the illuminant and observer. -Bob "Case, Isaac" <Isa...@xe...> 09/30/2009 10:30 AM To Robert V Canning/AE/DuPont@DuPont cc Subject RE: [Lcms-user] XYZ to RGB Conversion Where/how are you setting the illuminant and observer? -Isaac From: Robert V Canning [mailto:Rob...@us...] Sent: Wednesday, September 30, 2009 10:23 AM To: Case, Isaac Subject: RE: [Lcms-user] XYZ to RGB Conversion Thanks Isaac, that was the problem, I forgot the divide by 100. The conversion seems to be in D50, I set the white point to D65 at 10 degrees but the results always seem to be in D50 space 2 degree. I am comparing it to Lindblooms calculator and I get the D50 answer not D65. Any clue? Thanks again, Bob "Case, Isaac" <Isa...@xe...> 09/30/2009 09:50 AM To Robert V Canning/AE/DuPont@DuPont, <lcm...@li...> cc Subject RE: [Lcms-user] XYZ to RGB Conversion What range of values are you passing in as XYZ. I just tried and got X:0.5 Y:0.5 Z:0.5 -> R:190 G:185 B:207 However, if you are expecting a range of X from 0 to 95.047 Y from 0 to 100.000 Z from 0 to 108.883 You’ll need to divide by 100 for everything. -Isaac Case From: Robert V Canning [mailto:Rob...@us...] Sent: Wednesday, September 30, 2009 8:11 AM To: lcm...@li... Subject: [Lcms-user] XYZ to RGB Conversion Hi, I want to be able to convert an XYZ value to RGB. I took the following steps: - created a XYZ profile used as input. - created a sRGB profile used as output - intent is set to perceptual - created a transform - loaded the XYZ values - did the transform The problem is no matter what the XYZ value I always get 255 for the RGB values. What am I doing wrong? Thanks for any help. void XYZtoRGB(double X, double Y, double Z, unsigned char &red, unsigned char &green, unsigned char &blue) cmsCIEXYZ XYZ; BYTE output[3]; XYZ.X = X; XYZ.Y = Y; XYZ.Z = Z; cmsHTRANSFORM hXYZtoRGBTransform; cmsHPROFILE hXYZProfile; cmsHPROFILE hsRGBProfile; hXYZProfile = cmsCreateXYZProfile(); hsRGBProfile = cmsCreate_sRGBProfile(); // Rendering intent is perceptual hXYZtoRGBTransform = cmsCreateTransform(hXYZProfile, TYPE_XYZ_DBL, hsRGBProfile, TYPE_RGB_8, 0, cmsFLAGS_NOTPRECALC); cmsDoTransform(hXYZtoRGBTransform, &XYZ, output, 1); red = output[0]; green = output[1]; blue = output[2]; cmsDeleteTransform(hXYZtoRGBTransform); cmsCloseProfile(hXYZProfile); cmsCloseProfile(hsRGBProfile); } This communication is for use by the intended recipient and contains information that may be Privileged, confidential or copyrighted under applicable law. If you are not the intended recipient, you are hereby formally notified that any use, copying or distribution of this e-mail, in whole or in part, is strictly prohibited. Please notify the sender by return e-mail and delete this e-mail from your system. Unless explicitly and conspicuously designated as "E-Contract Intended", this e-mail does not constitute a contract offer, a contract amendment, or an acceptance of a contract offer. This e-mail does not constitute a consent to the use of sender's contact information for direct marketing purposes or for transfers of data to third parties. Francais Deutsch Italiano Espanol Portugues Japanese Chinese Korean http://www.DuPont.com/corp/email_disclaimer.html This communication is for use by the intended recipient and contains information that may be Privileged, confidential or copyrighted under applicable law. If you are not the intended recipient, you are hereby formally notified that any use, copying or distribution of this e-mail, in whole or in part, is strictly prohibited. Please notify the sender by return e-mail and delete this e-mail from your system. Unless explicitly and conspicuously designated as "E-Contract Intended", this e-mail does not constitute a contract offer, a contract amendment, or an acceptance of a contract offer. This e-mail does not constitute a consent to the use of sender's contact information for direct marketing purposes or for transfers of data to third parties. Francais Deutsch Italiano Espanol Portugues Japanese Chinese Korean http://www.DuPont.com/corp/email_disclaimer.html This communication is for use by the intended recipient and contains information that may be Privileged, confidential or copyrighted under applicable law. If you are not the intended recipient, you are hereby formally notified that any use, copying or distribution of this e-mail, in whole or in part, is strictly prohibited. Please notify the sender by return e-mail and delete this e-mail from your system. Unless explicitly and conspicuously designated as "E-Contract Intended", this e-mail does not constitute a contract offer, a contract amendment, or an acceptance of a contract offer. This e-mail does not constitute a consent to the use of sender's contact information for direct marketing purposes or for transfers of data to third parties. Francais Deutsch Italiano Espanol Portugues Japanese Chinese Korean http://www.DuPont.com/corp/email_disclaimer.html |
From: LittleCMS S. <in...@li...> - 2009-10-01 10:00:48
|
Hi, XYZ is an absolute space, it doesn't take the adaptation of the observer into account. Hence, the lcms function does not have any parameter. If you want a modified XYZ taking chromatic adaptation into account, you may use Lab, or better, an appearance model like CAM02 Regards Marti. On 30/09/2009 16:39:28, rob...@us... wrote: > I apparently am not setting the illuminant and observer. I thought I was > but, in the larger code I have routines that convert Lab to RGB and I > thought I was changing the observer and illuminant for this as well > (different profile). The cmsCreateLabProfile allows me to set the white > point,, the cmsCreateXYZProfile doen't have an argument for the white point. Excuse my lack of experience here, but how do I set the illuminant and observer. > > -Bob > > > > "Case, Isaac" > 09/30/2009 10:30 AM To > Robert V Can |
From: Case, I. <Isaac.Case@XEROX.COM> - 2009-09-30 16:07:37
|
I don’t think that it can be done directly in lcms since the main use case of lcms is working with ICC profiles where everything is done as D50. If you want, here is a list of transforms that may help you if you want to go from D65 to D50 and then compute the RGB. http://www.brucelindbloom.com/index.html?Eqn_ChromAdapt.html -Isaac From: Robert V Canning [mailto:Rob...@us...] Sent: Wednesday, September 30, 2009 10:39 AM To: Case, Isaac Cc: lcm...@li... Subject: RE: [Lcms-user] XYZ to RGB Conversion I apparently am not setting the illuminant and observer. I thought I was but, in the larger code I have routines that convert Lab to RGB and I thought I was changing the observer and illuminant for this as well (different profile). The cmsCreateLabProfile allows me to set the white point,, the cmsCreateXYZProfile doen't have an argument for the white point. Excuse my lack of experience here, but how do I set the illuminant and observer. -Bob "Case, Isaac" <Isa...@xe...> 09/30/2009 10:30 AM To Robert V Canning/AE/DuPont@DuPont cc Subject RE: [Lcms-user] XYZ to RGB Conversion Where/how are you setting the illuminant and observer? -Isaac From: Robert V Canning [mailto:Rob...@us...] Sent: Wednesday, September 30, 2009 10:23 AM To: Case, Isaac Subject: RE: [Lcms-user] XYZ to RGB Conversion Thanks Isaac, that was the problem, I forgot the divide by 100. The conversion seems to be in D50, I set the white point to D65 at 10 degrees but the results always seem to be in D50 space 2 degree. I am comparing it to Lindblooms calculator and I get the D50 answer not D65. Any clue? Thanks again, Bob "Case, Isaac" <Isa...@xe...> 09/30/2009 09:50 AM To Robert V Canning/AE/DuPont@DuPont, <lcm...@li...> cc Subject RE: [Lcms-user] XYZ to RGB Conversion What range of values are you passing in as XYZ. I just tried and got X:0.5 Y:0.5 Z:0.5 -> R:190 G:185 B:207 However, if you are expecting a range of X from 0 to 95.047 Y from 0 to 100.000 Z from 0 to 108.883 You’ll need to divide by 100 for everything. -Isaac Case From: Robert V Canning [mailto:Rob...@us...] Sent: Wednesday, September 30, 2009 8:11 AM To: lcm...@li... Subject: [Lcms-user] XYZ to RGB Conversion Hi, I want to be able to convert an XYZ value to RGB. I took the following steps: - created a XYZ profile used as input. - created a sRGB profile used as output - intent is set to perceptual - created a transform - loaded the XYZ values - did the transform The problem is no matter what the XYZ value I always get 255 for the RGB values. What am I doing wrong? Thanks for any help. void XYZtoRGB(double X, double Y, double Z, unsigned char &red, unsigned char &green, unsigned char &blue) cmsCIEXYZ XYZ; BYTE output[3]; XYZ.X = X; XYZ.Y = Y; XYZ.Z = Z; cmsHTRANSFORM hXYZtoRGBTransform; cmsHPROFILE hXYZProfile; cmsHPROFILE hsRGBProfile; hXYZProfile = cmsCreateXYZProfile(); hsRGBProfile = cmsCreate_sRGBProfile(); // Rendering intent is perceptual hXYZtoRGBTransform = cmsCreateTransform(hXYZProfile, TYPE_XYZ_DBL, hsRGBProfile, TYPE_RGB_8, 0, cmsFLAGS_NOTPRECALC); cmsDoTransform(hXYZtoRGBTransform, &XYZ, output, 1); red = output[0]; green = output[1]; blue = output[2]; cmsDeleteTransform(hXYZtoRGBTransform); cmsCloseProfile(hXYZProfile); cmsCloseProfile(hsRGBProfile); } This communication is for use by the intended recipient and contains information that may be Privileged, confidential or copyrighted under applicable law. If you are not the intended recipient, you are hereby formally notified that any use, copying or distribution of this e-mail, in whole or in part, is strictly prohibited. Please notify the sender by return e-mail and delete this e-mail from your system. Unless explicitly and conspicuously designated as "E-Contract Intended", this e-mail does not constitute a contract offer, a contract amendment, or an acceptance of a contract offer. This e-mail does not constitute a consent to the use of sender's contact information for direct marketing purposes or for transfers of data to third parties. Francais Deutsch Italiano Espanol Portugues Japanese Chinese Korean http://www.DuPont.com/corp/email_disclaimer.html This communication is for use by the intended recipient and contains information that may be Privileged, confidential or copyrighted under applicable law. If you are not the intended recipient, you are hereby formally notified that any use, copying or distribution of this e-mail, in whole or in part, is strictly prohibited. Please notify the sender by return e-mail and delete this e-mail from your system. Unless explicitly and conspicuously designated as "E-Contract Intended", this e-mail does not constitute a contract offer, a contract amendment, or an acceptance of a contract offer. This e-mail does not constitute a consent to the use of sender's contact information for direct marketing purposes or for transfers of data to third parties. Francais Deutsch Italiano Espanol Portugues Japanese Chinese Korean http://www.DuPont.com/corp/email_disclaimer.html This communication is for use by the intended recipient and contains information that may be Privileged, confidential or copyrighted under applicable law. If you are not the intended recipient, you are hereby formally notified that any use, copying or distribution of this e-mail, in whole or in part, is strictly prohibited. Please notify the sender by return e-mail and delete this e-mail from your system. Unless explicitly and conspicuously designated as "E-Contract Intended", this e-mail does not constitute a contract offer, a contract amendment, or an acceptance of a contract offer. This e-mail does not constitute a consent to the use of sender's contact information for direct marketing purposes or for transfers of data to third parties. Francais Deutsch Italiano Espanol Portugues Japanese Chinese Korean http://www.DuPont.com/corp/email_disclaimer.html |
From: Robert V C. <Rob...@us...> - 2009-09-30 17:15:32
|
I tried the cmsAdaptToIlluminant where I set the input to D50 2 degrees and output as D65 10 degrees. (also tried 2 degrees). When I compare the RGBs produced after taking the adapted XYZs to RGB they seem to be consistent with Lindblooms results, at least on the few sets I tried. Am I interpretting this correctly? Thank you for your help, Bob "Case, Isaac" <Isaac.Case@XEROX.COM> 09/30/2009 12:07 PM To Robert V Canning/AE/DuPont@DuPont cc <lcm...@li...> Subject RE: [Lcms-user] XYZ to RGB Conversion I don’t think that it can be done directly in lcms since the main use case of lcms is working with ICC profiles where everything is done as D50. If you want, here is a list of transforms that may help you if you want to go from D65 to D50 and then compute the RGB. http://www.brucelindbloom.com/index.html?Eqn_ChromAdapt.html -Isaac From: Robert V Canning [mailto:Rob...@us...] Sent: Wednesday, September 30, 2009 10:39 AM To: Case, Isaac Cc: lcm...@li... Subject: RE: [Lcms-user] XYZ to RGB Conversion I apparently am not setting the illuminant and observer. I thought I was but, in the larger code I have routines that convert Lab to RGB and I thought I was changing the observer and illuminant for this as well (different profile). The cmsCreateLabProfile allows me to set the white point,, the cmsCreateXYZProfile doen't have an argument for the white point. Excuse my lack of experience here, but how do I set the illuminant and observer. -Bob "Case, Isaac" <Isa...@xe...> 09/30/2009 10:30 AM To Robert V Canning/AE/DuPont@DuPont cc Subject RE: [Lcms-user] XYZ to RGB Conversion Where/how are you setting the illuminant and observer? -Isaac From: Robert V Canning [mailto:Rob...@us...] Sent: Wednesday, September 30, 2009 10:23 AM To: Case, Isaac Subject: RE: [Lcms-user] XYZ to RGB Conversion Thanks Isaac, that was the problem, I forgot the divide by 100. The conversion seems to be in D50, I set the white point to D65 at 10 degrees but the results always seem to be in D50 space 2 degree. I am comparing it to Lindblooms calculator and I get the D50 answer not D65. Any clue? Thanks again, Bob "Case, Isaac" <Isa...@xe...> 09/30/2009 09:50 AM To Robert V Canning/AE/DuPont@DuPont, <lcm...@li...> cc Subject RE: [Lcms-user] XYZ to RGB Conversion What range of values are you passing in as XYZ. I just tried and got X:0.5 Y:0.5 Z:0.5 -> R:190 G:185 B:207 However, if you are expecting a range of X from 0 to 95.047 Y from 0 to 100.000 Z from 0 to 108.883 You’ll need to divide by 100 for everything. -Isaac Case From: Robert V Canning [mailto:Rob...@us...] Sent: Wednesday, September 30, 2009 8:11 AM To: lcm...@li... Subject: [Lcms-user] XYZ to RGB Conversion Hi, I want to be able to convert an XYZ value to RGB. I took the following steps: - created a XYZ profile used as input. - created a sRGB profile used as output - intent is set to perceptual - created a transform - loaded the XYZ values - did the transform The problem is no matter what the XYZ value I always get 255 for the RGB values. What am I doing wrong? Thanks for any help. void XYZtoRGB(double X, double Y, double Z, unsigned char &red, unsigned char &green, unsigned char &blue) cmsCIEXYZ XYZ; BYTE output[3]; XYZ.X = X; XYZ.Y = Y; XYZ.Z = Z; cmsHTRANSFORM hXYZtoRGBTransform; cmsHPROFILE hXYZProfile; cmsHPROFILE hsRGBProfile; hXYZProfile = cmsCreateXYZProfile(); hsRGBProfile = cmsCreate_sRGBProfile(); // Rendering intent is perceptual hXYZtoRGBTransform = cmsCreateTransform(hXYZProfile, TYPE_XYZ_DBL, hsRGBProfile, TYPE_RGB_8, 0, cmsFLAGS_NOTPRECALC); cmsDoTransform(hXYZtoRGBTransform, &XYZ, output, 1); red = output[0]; green = output[1]; blue = output[2]; cmsDeleteTransform(hXYZtoRGBTransform); cmsCloseProfile(hXYZProfile); cmsCloseProfile(hsRGBProfile); } This communication is for use by the intended recipient and contains information that may be Privileged, confidential or copyrighted under applicable law. If you are not the intended recipient, you are hereby formally notified that any use, copying or distribution of this e-mail, in whole or in part, is strictly prohibited. Please notify the sender by return e-mail and delete this e-mail from your system. Unless explicitly and conspicuously designated as "E-Contract Intended", this e-mail does not constitute a contract offer, a contract amendment, or an acceptance of a contract offer. This e-mail does not constitute a consent to the use of sender's contact information for direct marketing purposes or for transfers of data to third parties. Francais Deutsch Italiano Espanol Portugues Japanese Chinese Korean http://www.DuPont.com/corp/email_disclaimer.html This communication is for use by the intended recipient and contains information that may be Privileged, confidential or copyrighted under applicable law. If you are not the intended recipient, you are hereby formally notified that any use, copying or distribution of this e-mail, in whole or in part, is strictly prohibited. Please notify the sender by return e-mail and delete this e-mail from your system. Unless explicitly and conspicuously designated as "E-Contract Intended", this e-mail does not constitute a contract offer, a contract amendment, or an acceptance of a contract offer. This e-mail does not constitute a consent to the use of sender's contact information for direct marketing purposes or for transfers of data to third parties. Francais Deutsch Italiano Espanol Portugues Japanese Chinese Korean http://www.DuPont.com/corp/email_disclaimer.html This communication is for use by the intended recipient and contains information that may be Privileged, confidential or copyrighted under applicable law. If you are not the intended recipient, you are hereby formally notified that any use, copying or distribution of this e-mail, in whole or in part, is strictly prohibited. Please notify the sender by return e-mail and delete this e-mail from your system. Unless explicitly and conspicuously designated as "E-Contract Intended", this e-mail does not constitute a contract offer, a contract amendment, or an acceptance of a contract offer. This e-mail does not constitute a consent to the use of sender's contact information for direct marketing purposes or for transfers of data to third parties. Francais Deutsch Italiano Espanol Portugues Japanese Chinese Korean http://www.DuPont.com/corp/email_disclaimer.html This communication is for use by the intended recipient and contains information that may be Privileged, confidential or copyrighted under applicable law. If you are not the intended recipient, you are hereby formally notified that any use, copying or distribution of this e-mail, in whole or in part, is strictly prohibited. Please notify the sender by return e-mail and delete this e-mail from your system. Unless explicitly and conspicuously designated as "E-Contract Intended", this e-mail does not constitute a contract offer, a contract amendment, or an acceptance of a contract offer. This e-mail does not constitute a consent to the use of sender's contact information for direct marketing purposes or for transfers of data to third parties. Francais Deutsch Italiano Espanol Portugues Japanese Chinese Korean http://www.DuPont.com/corp/email_disclaimer.html |