New online k-means algorithm based on sufficient statistic and Gaussians mixture model(GMM) for real-time segmentation of background subtraction was proposed.This algorithm,with software assignment of k-means instead of hardware assignment in EM algorithm,can advance the computational speed and the convergence rate.Experiments show that the online k-means algorithm could effectively detect moving objects,improves the computation and convergence rate,and requires less space.