code: def template_segmentation_image_amount_colors(source, amount):
      data = read_image(source)
  
      centers = kmeans_plusplus_initializer(
          data,
          amount,
          kmeans_plusplus_initializer.FARTHEST_CENTER_CANDIDATE,
      ).initialize()
      kmeans_instance = kmeans(data, centers)
      kmeans_instance.process()
  
      clusters = kmeans_instance.get_clusters()
      draw_image_mask_segments(source, clusters)
  
file_path: pyclustering/pyclustering/cluster/examples/kmeans_segmentation.py
imports: from pyclustering.utils import draw_image_mask_segments, read_image
  from pyclustering.samples.definitions import IMAGE_SIMPLE_SAMPLES, IMAGE_MAP_SAMPLES
  from pyclustering.cluster.kmeans import kmeans
  from pyclustering.cluster.center_initializer import kmeans_plusplus_initializer
label_desc: Use image node_id 2 for calling a global function with example usage: template_segmentation_image_amount_colors(source, amount) without return types