Java Retinex algorithm