First excuse my bad english, White balance is a complex thing, and for me write in english is difficult
This method by optimizing the variance of the R and B channels is one of the many methods I have experimented with.
We find it in the university literature.
I was very interested in her, but after reading the essays that I could see, it appeared that she did not solve the problem of images with a bad “green”. Which does not mean that we can not use it. especially in this specific case “Film Negative”
The second problem is that of relevance : because the variance (or standard deviation) is the minimum that the result is always good?
On this basis I did other research in academic documents and found a study without algorithm or code.
The idea seems close to that evoked but goes further.
Instead of RGB channels we use xyY, which is more relevant in terms of colorimetry,
And instead “variance”, we use a comparison of samples on the one hand within the image, on the other hand from defined spectral colors, this comparison is realized dy a “Student” test.
In the case of “autowb” (whose algorithm has not changed since 1 year and I always wait to merge with dev), I compare a sufficient number of samples from more than 150 areas on the image and 200 reference colors
This comparison is relized by changing “Temp” : this variations make a change in xyY values of image, and in xyY values of spectral datas . This algorithm is complex and needs a lot (200) of spectral data in the visible domain
The best result is for Student minimum.
But, because there is a big “But”, these algorithms consider that the green is good or that it is necessary to make a manual adjustment … what is the height for a WB auto
I search a long time and finally create 2 loops that interact with each other, one for the green (Y), and one for Red and Blue (x y).
In more of 95% case, result is very good, but in some cases where Illuminant is not with a good CRI (color renderind index) - some LED, some Halogen…, algorithm fails.
It must be remembered that the problem of the WB is mathematically indeterminate which explains : a) the number of works on this subjects; b) the imperfection of the results
jacques