A discriminative approach for appearance based loop closing