Illumination invariants based on Markov random fields