I know I'm late, but I would suggest using gamma correction .
Now what is gamma correction ?
I will explain in terms of layman:
- An input voltage is required to display the image on the screen.
- This voltage is output as light intensity.
- In an ideal world, the input voltage will be linear with respect to the output intensity.
- But the real conclusion to the screen is close to an exponential curve, gamma .
Because the computer screen applies the gamma value to the image on the screen, the process of applying inverse gamma to counteract this effect is called gamma correction .

Here is the code for the same using OpenCV 3.0.0 and python:
import cv2 import numpy as np def adjust_gamma(image, gamma=1.0): invGamma = 1.0 / gamma table = np.array([((i / 255.0) ** invGamma) * 255 for i in np.arange(0, 256)]).astype("uint8") return cv2.LUT(image, table) x = 'C:/Users/524316/Desktop/stack/test.jpg'
Here is the original image:

Applying a gamma with a value of 0.5 will give:

Applying a gamma with a value of 1.5 will give:

Applying a gamma with a value of 2.5 will give:

Applying a gamma value of 1.0 will result in the same image.
The code was borrowed from this link.
source share