Robust tracking of appearance by sparse template adaptation