This is a Python implementation of Simplest Color Balance by:
- Nicolas Limare
- Jose-Luis Lisani
- Jean-Michel Morel
- Ana Belén Petro
- Catalina Sbert
To review the work of the authors of your algorithm click on this link online demonstration.
The algorithm applies to images with pixel values in 8-bit integer space (min = 0, max = 255).
$ git clone https://github.com/JCLArriaga5/simplest-color-balance-python.git
Enter the path where the repository was cloned and install the dependencies with the following command:
$ pip install -r requirements.txt
Choose the percentage of pixels saturated to black (s1) and white (s2). For example, if you choose s1=1.5% and s=1.5% then the 1.5% darkest pixels in each channel will be saturated to black, and the brightest 1.5% to white.
img = mpimg.imread('./images/lenna.png')
s1 = 1.5
s2 = 1.5
print('Wait...')
out = scb(img, s1, s2)
plotresult(img, out)
- Limare, N., Lisani, J.L., Morel, J.M., Petro, A., & Sbert, C. (2011). Simplest Color Balance. Image Processing On Line, 1, 297–315.