Re: [Lcms-user] XYZ to Lab conversion issue
An ICC-based CMM for color management
Brought to you by:
mm2
From: <mar...@li...> - 2025-04-28 12:50:22
|
Hello Steve, The easiest wat to deal with encodings is to let the engine to do the work for you. If you use TYPE_Lab_DBL and TYPE_XYZ_DBL, you can provide arrays of doubles. Example: #include "lcms2.h" int main() { cmsHPROFILE hLab = cmsCreateLab4Profile(NULL); cmsHPROFILE hXYZ = cmsCreateXYZProfile(); cmsHTRANSFORM xyz2lab = cmsCreateTransform(hXYZ, TYPE_XYZ_DBL, hLab, TYPE_Lab_DBL, INTENT_RELATIVE_COLORIMETRIC, 0); cmsHTRANSFORM lab2xyz = cmsCreateTransform(hLab, TYPE_Lab_DBL, hXYZ, TYPE_XYZ_DBL, INTENT_RELATIVE_COLORIMETRIC, 0); double XYZ[3] = { 0.06113, 0.0634, 0.05231 }; double Lab[3]; cmsDoTransform(xyz2lab, XYZ, Lab, 1); cmsDoTransform(lab2xyz, Lab, XYZ, 1); cmsCloseProfile(hLab); cmsCloseProfile(hXYZ); cmsDeleteTransform(xyz2lab); cmsDeleteTransform(lab2xyz); } If you want to deal with the encoding directly, it is the encoding described in ICC spec 4.4 in "6.3.4 Colour space encodings for the PCS". Hope that helps Best regards Marti Maria The LittleCMS Project https://www.littlecms.com > -----Original Message----- > From: Steve Upton via Lcms-user <lcm...@li...> > Sent: Sunday, April 27, 2025 12:14 AM > To: lcm...@li... > Subject: [Lcms-user] XYZ to Lab conversion issue > > > when I call cmsXYZ2Lab with the white point set to NULL and XYZ = 0.06113, > 0.0634, 0.05231 I get the expected L* value of around 30.255 - no problem > > But when I set up a transform from the 'stock, D50' XYZ profile to the stock > Lab profile, I get the L* value around 40 > > I messed around with a ton of different methods of encoding the XYZ values > and decoding the Lab values as well a different profile versions and get the > same wrong number (ish) > > Somewhere along the way I realized the L* = 40 number, converted to XYZ > basically doubles the original XYZ values. Sure enough, when I divide the > original XYZ values by 2, they convert to the value I'm expecting - though I > think this is just a dawdle... > > Anyway, what might I be doing wrong? > > Also, can anyone point me in the direction of how encodings like type_XYZ_16 > are performed? I've having trouble tracking it down. > > > > > _______________________________________________ > Lcms-user mailing list > Lcm...@li... > https://lists.sourceforge.net/lists/listinfo/lcms-user |