Aiming at the problem of false detection and missed detection of foreground points in vehi-cle detection tasks by the three-frame differential method,an improved three-frame differential vehicle detection algorithm incorporating K-means clustering is proposed.Firstly,the difference results between the current image and the two frames selected by improved algorithm are combined to initially determine the category of pixel points and define the points to be classified.Secondly,the K-means clustering of the points to be classified by combining their grayscale features within three frames and correct the clustering results based on the coordinate information of the points,and the category of the points to be classified is obtained.Finally,the vehicle shape correction method is designed to fill the holes and correct the target boundary,and the detection is completed.The ex-perimental results show that the detection effect of improved algorithm on video of two different sce-narios reaches an average precision of 81.72%,an average recall rate of 93.85%,and an average F1 value of 87.34%.Compared with the three-frame differential algorithm,the improved algorithm shows an average improvement of 11.86%in each metric.This proves that the improved algorithm well solves the problem of false and missed detection of foreground points in the detection.