Hi,
> Is this the correct way to calculate DeltaE ?
Actually, is a lot simpler. sRGB does use D65 (6504K), indeed
cmsHPROFILE hsRGB = cmsCreate_sRGBProfile();
cmsHPROFILE hLab = cmsCreateLabProfile(NULL);
cmsHTRANSFORM xform = cmsCreateTransform(hsRGB, TYPE_RGB_8, hLab,
TYPE_Lab_DBL, INTENT_PERCEPTUAL, 0)
BYTE RGB[3];
cmsCIELab Lab;
for (... each RGB value..) {
cmsDoTransform(xform, RGB, &Lab, 1);
double dE = cmsCIE94DeltaE(&Lab, &LabReference);
}
.. free all stuff ..
So, you can create a transform going directly from sRGB to Lab.
If you want the white point being maintained, use
INTENT_ABSOLUTE_COLORIMETRIC, but chances are you
really don't want that.
In the case you really want the white point translation, you could create
a Lab profile operating in different white point.
cmsWhitePointFromTemp(5600, &WhitePoint);
hLab = cmsCreateLabProfile(&WhitePoint);
And then use absolute colorimetric intent, but again, you probably don't
want that, as it would add a huge yellow/blue cast to your image.
Regards,
Marti Maria
The little cms project
http://www.littlecms.com
----- Original Message -----
From: "Stefan Schadt" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Wednesday, February 09, 2005 11:32 AM
Subject: [Lcms-user] Generic question on CMS
> Hi,
>
> I've a generic questions regarding CMS and hope that somebody can help me.
>
> My task is to convert RGB values to Lab and calculate DeltaE (CIE94) from a
> reference value.
> The RGB values are in sRGB and so I do the following.
> I'm not really sure how to use cmsAdaptToIlluminant and I don't know if the
> way I calculate Lab is correct.
> Thank you very much for your help.
>
> Stefan Schadt
>
>
>
> cmsHPROFILE hInProfile; // This is sRGB as ICC profile
> cmsHPROFILE hXYZProfile; // XYZ built-in profile
> cmsHPROFILE hLabProfile; // Lab built-in
> cmsHTRANSFORM hTransformRGB2XYZ;
> cmsHTRANSFORM hTransformXYZ2Lab;
> cmsCIELab Lab; // Calculated Lab
>
> // Open ICC profile
> hInProfile = cmsOpenProfileFromFile("sRGB.icc", "r");
>
> // sRGB values come from a digital camera and are recorded at 5600 calvin.
> cmsCIExyY WhitePointT;
> cmsCIEXYZ WhiteCamera;
> cmsWhitePointFromTemp(5600, &WhitePointT);
> cmsxyY2XYZ(&WhiteCamera, &WhitePointT);
>
> // Whitepoint of ICC profile is D50 as per definition
> cmsCIEXYZ WhiteICC;
> cmsCIExyY WhiteICCT;
> cmsWhitePointFromTemp(5000, &WhiteICCT);
> cmsxyY2XYZ(&WhiteICC, &WhiteICCT);
>
> // Create built-in profiles and transformations
> hXYZProfile = cmsCreateXYZProfile();
> hLabProfile = cmsCreateLabProfile(NULL);
> hTransformRGB2XYZ = cmsCreateTransform(hInProfile, TYPE_RGB_8, hXYZProfile,
> TYPE_XYZ_16, INTENT_PERCEPTUAL, 0);
> hTransformXYZ2Lab = cmsCreateTransform(hXYZProfile, TYPE_XYZ_16,
> hLabProfile, TYPE_Lab_DBL, INTENT_PERCEPTUAL, 0);
>
> // This is my input
> BYTE RGB[3] = {200, 200, 200}; // example
>
> // And I calculate Lab as follows:
> cmsCIEXYZ XYZ, XYZt;
> cmsDoTransform(hTransformRGB2XYZ, RGB, (LPVOID)&XYZ, 1);
> // This is to adapt 5600 to 5000 calvin of ICC profile
> cmsAdaptToIlluminant(&XYZt, &WhiteCamera, &WhiteICC, &XYZ);
> cmsDoTransform(hTransformXYZ2Lab, (LPVOID)&XYZ, (LPVOID)&Lab, 1);
>
> // So I have my calculated Lab in 'Lab'.
> // My reference Lab:
> cmsCIELab LabReference;
> LabReference.L = something;
> LabReference.a = something;
> LabReference.b = something;
>
> // And DeltaE:
> double DeltaE = cmsCIE94DeltaE(&Lab, &LabReference);
>
>
> That's all.
> Is this the correct way to calculate DeltaE ?
>
>
>
>
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from real users.
> Discover which products truly live up to the hype. Start reading now.
> http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
> _______________________________________________
> Lcms-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/lcms-user
>
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Lcms-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/lcms-user