From: <ma...@li...> - 2001-06-09 14:43:56
|
Ciao Bernardo, > What can I do to obtain in the OutputBuffer the Lab value? Just use lcmslabi.icm (present on distribution packages) as output = profile. For converting from/to floating point, you have the routines in = lcmsapi.txt, here I reproduce... ---------------------------------- // Convert L to double double L2float(WORD v) { Fixed32 fix32; fix32 =3D (Fixed32) v; return (double) fix32 / 652.800; } // the a/b part double ab2float(WORD v) { Fixed32 fix32; fix32 =3D (Fixed32) v; return ((double) fix32/256.0)-128.0; } --------------------------------------- Then, your code will be something like... (please note I'm using 16 bits = Lab, TYPE_Lab_16) | WORD Output[3] | hOutputProfile =3D cmsOpenProfileFormFile("lcmslabi.icm", "r"); | cmsHTRANSFORM hTransform =3D cmsCreateTrasform (hInputProfile, = TYPE_RGB_8, | = hOutputProfile, TYPE_Lab_16, | = INTENT_PERCEPTUAL, 0) = | ... =20 Translating 1 pixel=20 | cmsDoTransform(hTransform, InputBuffer, OutputBuffer, 1) | L =3D L2Float(Output[0]); | a =3D ab2Float(Output[1]); | b =3D ab2Float(Output[2]); =20 Hope this helps. Mart=ED Maria The little cms project http://www.littlecms.com ma...@li... ----- Original Message -----=20 From: "Bernardo Pucci" <cyb...@ti...> To: <in...@li...> Sent: Saturday, June 09, 2001 3:46 PM Subject: How can I ..... > Hi littlecms stuff, > I'm an Italian student and I use the littlecms engine to obtain color = space > conversion. > No problem happen If I trasform an image (RGB buffer) between 2 icc > profiles (INPUT and DISPLAY), but I don't understand how I can obtain = a Lab > buffer from an RGB buffer with the use of an INPUT profile only. > I must have Lab value for metrics size and I use an INPUT (digital > fotocamera) icc profile with color space RGB and connection space Lab. > The problem occurs (segmentation fault) when trasform is create: >=20 > cmsHTRANSFORM hTransform =3D cmsCreate Trasform (hInputProfile, = TYPE_RGB_8, > NULL, TYPE_Lab_8, >=20 > INTENT_PERCEPTUAL, 0); > What can I do to obtain in the OutputBuffer the Lab value? >=20 > I have define: > unsigned char InputBuffer for RGB value > float OutputBuffer for Lab value. >=20 > In hoping for a reply thanks > Pucci Bernardo >=20 >=20 >=20 |