python code: histogram equalization