White balance
Please, add some way to balance the white in a pic (in example, by specifying what should be considered white, then act accordingly)
Thanks for any help
I was looking into this, and it doesn't seem to be this simple. For camera users, what you generally need is a way to adjust the color temperature.
For example, I took a photo where the camera treats 3500k as the white point, so it should be adjusted to something like 6500k.
Color temperature adjustment algorithms aren't that simple, but there is an example here. https://tannerhelland.com/2012/09/18/convert-temperature-rgb-algorithm-code.html
The "pick a color" white point algorithm I see everywhere online is generally making the assumption that the picked color should be gray, so you adjust all of the other colors to where the chosen color's R = G = B.
That implementation looks something like this.
const neutral = (whiteColorYouPicked.r + whiteColorYouPicked.b + whiteColorYouPicked.g) / 3.0;
outputColor.r *= neutral / whiteColorYouPicked.r;
outputColor.g *= neutral / whiteColorYouPicked.g;
outputColor.b *= neutral / whiteColorYouPicked.b;
In practice, this can look OK if the original photo hasn't been adjusted in post-processing in any way. I have found many examples where it just doesn't work, though. Possibly due to heavy edits to the colors in the photo or very poor color rendering quality out of the camera.
Also (whiteColorYouPicked.r + whiteColorYouPicked.b + whiteColorYouPicked.g) / 3.0 can be swapped out for a better approximation of gray.