[argyllcms] Re: Capture One Profiles

  • From: Nikolay Pokhilchenko <nikolay_po@xxxxxxx>
  • To: argyllcms@xxxxxxxxxxxxx
  • Date: Wed, 10 Jul 2013 01:54:04 +0400

 9 July 2013, 14:46 -04:00 Iliah Borg wrote:
>> 1. Balancing the channel multipliers for better interpolation, i.e. "white 
>> balancing" the raw data.
>> 2. Spacial computations, including interpolation.
>> 3. Backward application of channel multipliers from the first stage to 
>> recover illumination-depended channel values of interpolated image.
>> 4. Applying the camera profile to interpolated image. At this stage image is 
>> "absolute colorimetric".
>> 5. Correcting the white balance using chromatic adaptation based on 
>> mulitpliers from first point or based on human visual evaluation.
>> 
>> As a result we may get an image with both best interpolation and correct 
>> chromatic adaptation. I suppose this approach is performed in modern DSLRs 
>> and commercial RAW-converters.
>
>No it is not.
>One can't determine chromatic adaptation other then von Kries transform, and 
>steps 3 and 5 cancel each other. 

IMO the steps 3 and 5 can't cancel each other because they are not equal by 
influence on the colors. That's why I proposing the #3 step.
-=- 
One can do von Kries (or Bradford or CMCCAT2000 etc) transform only by 
converting raw data into known color space (XYZ, LMS). This is possible only 
after applying profile to interpolated image. And for accurate chromatic 
adaptation transform (white balancing) the same as for target raw channel 
ratios should be preserved. The channel multipliers relations of scene image  
before chromatic transform should be the same as for profile target image. It's 
not is the case when we change multipliers at first stage in the list cited 
above. So before the WP adaptation transform we need to recover the same 
channel ratios as we've choose for profiling target image. 

An example:

1.  Let's assume that we've choose certain channel multipliers for target image 
to obtain R=G=B for neutral patches (at least for better interpolation and 
highlight recovery reasons).
2. Next we've shoot a real scene under slightly different illuminant. So we 
need to change channel multipliers for better interpolation.
3. Now we have image with different raw channel multipliers ratios. The 
conversion from such raw data into known color space will be inaccurate because 
the alteration of raw multipliers is not equal to chromatic adaptation 
transform. We obtain the image with neutral white but not accurate colors even 
after applying the profile.
4. To perform correct chromatic adaptation transform we need the same RGB gain 
ratios as for target image. But we've used different multipliers for better 
interpolation of scene image under another illuminant. So we need return RGB 
ratios of interpolated image to the target ones before conversion into known 
color space.
For examle let's assume raw channel multipliers for target image was:

Tr1, Tg1, Tg2 and Tb.

Real scene multipliers for another illuminant was:

Ir, Ig1, Ig2 and Ib.

RGB gains for interpolated target image will be:

Tgr=Tr;
Tgg=(Tg1+Tg2)/2;
Tgb=Tb.

RGB gains for scene interpolated image will be:

Igr=Ir;
Igg=(Ig1+Ig2)/2;
Igb=Ib.

5. To obtain the same RGB ratios of scene image in device space as the target 
image have we need multiply scene interpolated RGB by correction coefficients 
(excuse me I didn't remember how to write the matrices):

Kr=Tgr/Igr*(Igr+Igg+Igb)/(Tgr+Tgg+Tgb);
Kg=Tgg/Igg*(Igr+Igg+Igb)/(Tgr+Tgg+Tgb);
Kb=Tgb/Igb*(Igr+Igg+Igb)/(Tgr+Tgg+Tgb).

After multiplication of interpolated image values Ri, Gi and Bi by the 
coefficients above we'll got RGB device data completely without white point 
adaptation regarding the profile illuminant and with preserved average exposure:

R'=Ri*Kr;
G'=Gi*Kg;
B'=Bi*Kb.

6. Now we can convert scene image into known colorspace by camera profile then 
perform true, accurate white balance correction.

Other related posts: