Mathematical insights into the original Retinex algorithm for image enhancement