opensubscriber
   Find in this group all groups
 
Unknown more information…

l : lcms-user@lists.sourceforge.net 30 September 2009 • 8:11PM -0400

[Lcms-user] XYZ to RGB Conversion
by Robert V Canning

REPLY TO AUTHOR
 
REPLY TO GROUP






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

Bookmark with:

Delicious   Digg   reddit   Facebook   StumbleUpon

Related Messages

opensubscriber is not affiliated with the authors of this message nor responsible for its content.