To improve the precision and real-time quality of on-line learning obje ct tracking,combined with the compress sensing theory,an algorithm using distance metric learning is proposed. First,target samples and background samples around the selected target are sampled.The Harr-lik e feature vectors are compressed using the random projection theory.Then,the distance metric is trained using the compresse d feature vectors.Finally,the Mahalanobis distance between the sampl es in the new coming frame and the known target is calculated.The location of the sample closest to the known target is the location wanted .Experiments on variant videos show that the caculating load of the compressed features is 3/4less than that using the u ncompressed ones.Calculating the location of target using the trained distance metric makes the tracking precisio n higher.