A modified Retinex for image contrast enhancement and dynamics control