first working version of histogram-equalization enhancement