Hi,

I am trying to build a profile that I can use in photoshop to imitate a 
LUT that I use in Shake. I use the forward sampler to go from RGB to 
LAB, converting each RGB sample by calling a function to apply the lut 
to that value then converting to LAB. The code looks something like this:

int forward(unsigned short *in, unsigned short *out, void *lut) {
 
  transformValue(lut, in);
 
  float rgb[3] = {float(in[0])/65535, float(in[1])/65535, 
float(in[2])/65535};
  float lab[3];
 
  rgb2lab(rgb, lab);

  cmsCIELab cmsLab;
  cmsLab.L = lab[0];
  cmsLab.a = lab[1];
  cmsLab.b = lab[2];
 
  cmsFloat2LabEncoded(out, &cmsLab);

  return 0;

}

The calculation I use to convert from RGB to LAB comes from 
http://www.easyrgb.com/math.php . When I 'burn in' the input profile to 
an image using tifficc most colours get very close to what the Shake LUT 
does but some are still not quite there. I'm wondering if there is a 
correct calculation to use, or a better way of using lcms to get closer.

One other issue is that when I convert from LAB to RGB in the reverse 
sampler, the majority of RGB values are out of gamut. This is 
unsurprising since LAB has a much larger gamut than RGB but it means 
that only a small number of samples are actually contributing which 
further reduces the accuracy. Is there a better way to do this that will 
allow more, or all, samples to contribute?

Any hints or tips appreciated!

Thanks,
Ian

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Lcms-user mailing list
Lcms-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lcms-user

Reply via email to