K-means online updates and outputting to image files