Implement grayscale histeq