Re: [Lcms-user] Handling channel extraction
An ICC-based CMM for color management
Brought to you by:
mm2
From: <mar...@li...> - 2023-08-11 18:37:54
|
Hi, > One further question about your suggestion, if the images are higher bit > depth than 8-bit should I use more than 256 points to create my tone curve, > or will lcms2 smooth the shape of the curve well enough that 256 points is still > adequate? The CMM uses nodes by interpolation, so there is no need to use 256 points. You could any number. Since this takes few memory you could use up to 4096. Including more than 4096 points gives no further accuracy gain. Please note the profiles always use precision higher than 8 bits, unless you use a very old flavor of v2 profiles. Regards Marti Maria The LittleCMS Project https://www.littlecms.com > -----Original Message----- > From: Adrian Knagg-Baugh <aje...@gm...> > Sent: Thursday, August 10, 2023 7:23 PM > To: mar...@li... > Subject: Re: [Lcms-user] Handling channel extraction > > Yes. The images in question are most often either 16-bit unsigned int or 32-bit > float format (they're astronomical data). I'm content with the loss of channel > interaction, and in many cases the RGB images start out being composited > from mono images taken through filters anyway. There are a couple of reasons > we do this in the program: one is to read partial areas of images which is used > in parallelising stacking images together to improve SNR. In this case I don't > think we care about the color profile, because it will invariably be linear > anyway at that stage of acquisition, and the parts are immediately going to be > averaged (sort of) and reassembled into an image with the same color profile. > But also there is a function to split a 3-color image into separate single > channel R, G and B images, perhaps the user only wants one channel or > perhaps they want to process each one separately and then recombine them. > So in that case I think I do need to assign a reasonable color profile to each > split-out channel. > > One further question about your suggestion, if the images are higher bit > depth than 8-bit should I use more than 256 points to create my tone curve, > or will lcms2 smooth the shape of the curve well enough that 256 points is still > adequate? > > Thanks, > > Adrian. > > On Thu, Aug 10, 2023 at 5:42 PM <mar...@li...> wrote: > > > > Hi, > > > > If I understand correctly, you want to split an image, say for example > > a RGB TIFF file, in 3 TIFF gray files, one per channel. And then you > > want to embed in each one of those TIFFs a gray profile derivate from > > the RGB profile you found embedded in the original file. Is that? > > > > First, I should warn you that doing that you will lose information, as > > all the inter-actions between channels are lost, so you will get how > > the channel contributes to the image if converted to gray, but nothing > > else. Having said so, you should not use the TRC tags, that is only an > > implementation detail and you may find profiles that are not using > > matrix-shaper. All profiles using AtoB tags are not going to work in this way. > > > > I would rather use this approach which seems more general to me: > > > > - Get the embedded profile from original image. > > - Create a transform from this profile to the XYZ built-in. Use > > perceptual or relative colorimetric intent + BPC. > > - Feed this transform from channel values from 0 to 255 set other > > channels to 0. Get the Y from resulting XYZ. You will end with an > > array of 256 Y values that corresponds to the obtained Y when using > > that value on that channel. > > - With those 256 Y values, crate a tone curve and with the tone curve, > > create a gray profile. Use D50 as white point. That would be the r > > channel profile. > > - Repeat for g and b. All those profiles would explain the > > contribution of the channel to Y, which is the maximum you can do on gray > images. > > > > Hope that helps > > Regards > > > > Marti Maria > > The LittleCMS Project > > https://www.littlecms.com > > > > > > > > > > > -----Original Message----- > > > From: Adrian Knagg-Baugh <aje...@gm...> > > > Sent: Thursday, August 10, 2023 5:52 PM > > > To: lcm...@li... > > > Subject: [Lcms-user] Handling channel extraction > > > > > > Hi, > > > I'm trying to understand how to handle assignment of a color profile > > > to a single channel extracted from a colour image that may have an > > > arbitrary > > RGB > > > color profile (e.g. extracting the R channel). > > > > > > Would something like this work, assuming rgb_profile is the > > > cmsHPROFILE associated with the full RGB image? > > > > > > cmsHPROFILE extracted_profile == NULL; if (cmsIsTag(rgb_profile, > > > cmsSigRedTRCTag) && cmsIsTag(rgb_profile, > > > cmsSigMediaWhitePoint)) { > > > cmsToneCurve tonecurve = cmsReadTag(rgb_profile, cmsSigRedTRCTag); > > > cmsCIExyY whitepoint = cmsReadTag(rgb_profle, > cmsSigMediaWhitePoint); > > > extracted_profile = cmsCreateGrayProfile(whitepoint, tonecurve); } > > > > > > Thanks, > > > > > > Adrian. > > > > > > > > > _______________________________________________ > > > Lcms-user mailing list > > > Lcm...@li... > > > https://lists.sourceforge.net/lists/listinfo/lcms-user > > |