> I'm writing an algorithm for manual chromatic adaptation of
> photographs which were taken with bad white balance. I'm using
> bradford matrix as described in
> Everything works fine except one thing. Pixels that have one or more
> components saturated get wrong color - they are "overcorrected" I'd
> say. What's worse, pixels around them are also affected although they
> don't have any saturated component.
> I've tried various tricks like to compute a saturation and less
> process such pixels, but none of the tricks really helped.
> If you have any ideas how to handle this problem or if you've already
> solved it, I'd appreciate your help.
IMO, you are tackling the problem at the wrong end.
Lets have a look at the importance of the Bradford correction:
a) Lab values are converted to sRGB, using D50/D65 and Bradford.
b) Lab values are converted to sRGB, using D65/D65.
Reading back the sRGB values as Lab values in Photoshop shows:
a) Lab values are correct.
b) Lab values differ maximal 3 deltaE.
Obviously, the Bradford correction is not very important.
Now the photo:
The original scene light is unknown. Its never D50 or D65.
Real light can have a correlated color temperature, but if the
scene is illuminated by flash and tungsten as well, then "color
temperature" doesnt make any sense.
A formal color correction is simply impossible if one doesnt
know the spectrum of the scene light. Who knows the spectrum ?
It boils down to interactive corrections as usual, tweaking.
Now lets assume, the scene was about D50 and the camera was
corrected for D65. A compensation is theoretically possible.
For RGB values which are larger than 255 after the multipli-
cation by the Bradford matrix we can choose:
a) Strict clipping.
b) Proportional clipping.
If M>255 Then
In my tests I found that proportional clipping doesnt improve
the appearance. The reason is the loss of luminance by p.c.,
Luminance loss is more perceivable than a slightly wrong hue.
Either method shouldnt affect NEIGHBOUR pixels. Probably a
Clipping is applied in practically all image processing: some
interpolations, color and contrast corrections, sharpening.
A color correction has primarily nothing to do with the adaption
correction (Bradford, v.Kries). The latter is a subtle additional
feature, which takes human perception into account.
The color correction itself means physical colors (the image is
observed by an instrument).
The quoted doc doesnt tell us Bradford matrices. These have to
be calculated for the actual case and here we can choose ONLY
correlated color temperatures as references.
If all this should sound a little strict: comments and other
opinions are welcome.
Best regards --Gernot Hoffmann