Hi, list:

I am building profiles with very customized features, not related to any 
media.

One of those, for instance, would allow me to map values of an sRGB 
image to specific cmyk combinations.
To implement that, I started with the "makecmy.c" sample, available in 
lcms 1.18, and
- modified the colospace of the profile (now, CMYK)
           cmsSetColorSpace(hProfile, icSigCmykData);
- made LUT sizes smaller (I am quantizing the space, after all, no need 
for accuracy)
  and changed 3 dimensions to 4 in linearization curves
             LPGAMMATABLE PreLinear[3];
             cmsAlloc3DGrid(AToB0, 9, 4, 3);
             cmsAlloc3DGrid(BToA0, 17, 3, 4);
- modified  the cargo, getting rid of the perceptual RGB
            Cargo ->hRGB = cmsCreate_sRGBProfile();
- finally, the most important, I rewrote the Forward function, so that 
when it gets called by cmsSample3DGrid(), it fills my LUT in the 
appropriate manner, that is, for an entry lab in the LUT, calculate its 
original rgb value, and then derive the new cmyk I want to obtain 
(assigned to Out[]):
   static int Forward(register WORD In[], register WORD Out[], register 
LPVOID Cargo)
   {   
      LPCARGO C = (LPCARGO) Cargo;   
      WORD RGB[3];
      DWORD total;
      int    imin, imax;

       cmsDoTransform(C ->Lab2RGB, In, &RGB, 1);
       total = RGB[0] + RGB[1] + RGB[2];
       // map values where R+G+B>512 to white (C0,M0,Y0,K0)
       if(total > 0xFFFF*2){
           Out[0] = Out[1] = Out[2] = Out[3] = 0;
           return TRUE;
       }
       // map values where R+G+B<128 to rich black (C100,M100,Y100,K100)
       if(total < 0x8000){
           Out[0] = Out[1] = Out[2] = Out[3] = 0xFFFF;
            return TRUE;
       }
       // other tricks here, to values where total is between 128 and 512
      ...
     return TRUE;
}

The trick seems to work, the profile gets built, and when viewed with 
Huan's profile inspector, the CLUT seems to work.

My problem is that even though the pre and post linearization curves are 
identities (have not touched the code here), the values obtained when 
applying the profile are.not the spected ones, which should match the 
values inserted in the LUT, shouldn't they? In other words, the 
linearization curves seem to modify the results of the CLUT, even though 
they are identities...

Any idea, hint, suggestion?

Thanks,
     Ignacio


-- 
______________________________________________________________
Ignacio Ruiz de Conejo
Senior Imaging Researcher
Tel.  : +61 28875 9682
e-mail: ignacio.ruizdecon...@silverbrookresearch.com
______________________________________________________________


------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
Lcms-user mailing list
Lcms-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lcms-user

Reply via email to