This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" White balance (color balance) | |
Adjust colors to flatten color histogram peaks and broaden color spectrum for better color contrast. | |
This is also sometimes called white balancing or probability distribution whitening. | |
References: | |
- Color balance algorithm in [OpenCV](http://www.morethantechnical.com/2015/01/14/simplest-color-balance-with-opencv-wcode/) | |
- Ported to python by [DavidYKay](https://github.com/DavidYKay) | |
- Optimized (`O(N^2)` -> `O(N)`) by @alxrsngartn funded in part by NSF grant number 1722399 to [Aira](http://github.com/aira) (@jmeyers-aira) | |
- Incorporated into [nlpia](github.com/aira/nlpia) by @hobson |