The basic step in this algori thm is determining the number of clusters (K) then calculating the distance between each cluster center and the elements of images to join each element to the closest cluster depending on threshold distance.