Energy-driven path search for Termite Retinex