equalize histogram for grayscale images