title: How to set the initial centroids of KMColourSegmenter in OpenIMAJ library?
body: <p>I want to measure the time that KMColourSegmenter, in OpenIMAJ library, takes to perform the clustering.</p>
  
  <p>If I didn't make the initial centroids fixed, rather than random, I can't make the measure the performance; because it will change every time, give different number of iterations , and vary in time to execute the clustering.</p>
  
  <p>So how to make the initial centroids fixed i.e. setting them manually?</p>
  
  <p><strong>Update:</strong></p>
  
  <p>@Jon Thanks for the answer, I am trying to implement what you said. Could you check it, especially the "clusters" array I think this array doesn't make sense to initialize. Please, correct me if I am wrong.</p>
  
  <pre><code>public class MyFloatKMeansInit extends FloatKMeansInit{
  
      @Override
      public void initKMeans(DataSource&lt;float[]&gt; bds, float[][] clusters) throws IOException {
          // TODO Auto-generated method stub
          for (int i = 0; i &lt; bds.size(); i++) {
              for (int j = 0; j &lt; bds.getData(i).length; j++) {
                  clusters[i][j]=bds.getData(i)[j];
              }
          }   
      }
  }
  
  public class MyKMColourSegmenter extends KMColourSegmenter{
  
      public MyKMColourSegmenter(FloatArrayBackedDataSource bds, ColourSpace colourSpace, int K) throws IOException {
          super(colourSpace, K);
          MyFloatKMeansInit myFloatKMeansInit = new MyFloatKMeansInit();
          float[][] clusters = new float[K][];//#######I think there is something wrong here
          myFloatKMeansInit.initKMeans(bds, clusters);
          this.kmeans.setInit(myFloatKMeansInit);
          // TODO Auto-generated constructor stub
      }
  
  }
  </code></pre>