I came across an extremely simple color balancing algorithm here. And I thought I’ll quickly transcode it to OpenCV.
Here’s the gist:
And an example (photo taken, under CC-Attrib license, from here, Copyright Prayitno photography):
A very simple color balancing algorithm in OpenCV C++