Android Open Source - Color-Detector Cluster To String






From Project

Back to project page Color-Detector.

License

The source code is released under:

Apache License

If you think the Android project Color-Detector listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package org.ia.practiques;
//from   w  w  w.  j  ava 2s  .  c o m
import java.util.ArrayList;
import java.util.Collections;

/**
 * This class provides methods to calculate the colors from a RGB clusters of a bitmap
 * 
 * @author Victor Martinez
 */
public class ClusterToString {


  private Utils mUtils = new Utils();
  private double red = 0;
  private double orange = 0;
  private double brown= 0;
  private double yellow= 0;
  private double green = 0;
  private double blue = 0 ;
  private double purple = 0;
  private double pink = 0;
  private double white= 0;
  private double grey = 0;
  private double black= 0;
  
  /* 
   * This Matrix contains the values RGB and the percentage of each colour
   */
  private double[][] mDouble = {  {163,74,86,6.7,0,3,0,0,0,0.2,0.1,0,0,0} ,
                  {202,80,91,9.25,0.05,0.35,0,0,0,0.05,0.3,0,0,0} ,
                  {217,83,112,2.75,0,0,0,0,0,0.25,7,0,0,0} ,
                  {226,119,134,2.55,0,0,0,0,0,0,7.45,0,0,0} ,
                  {230,173,170,1.1,0.25,0.65,0,0,0,0,8,0,0,0} ,
                  {234,201,197,0.5,0.15,1.3,0,0,0,0,8.05,0,0,0} ,
                  {231,227,222,0,0,3.2,0.3,0.1,0,0,0,0.9,5.5,0} ,
                  {164,80,72,2.85,0.1,7.05,0,0,0,0,0,0,0,0} ,
                  {203,80,78,8.6,0,1.4,0,0,0,0,0,0,0,0} , 
                  {220,105,91,7.1,2.35,0.2,0,0,0,0,0.35,0,0,0} , 
                  {221,123,125,4.1,0.3,0,0,0,0,0,5.6,0,0,0} , 
                  {231,172,164,0.75,0.65,0.5,0,0,0,0,8.1,0,0,0} , 
                  {234,201,193,0,0.1,1.45,0,0,0,0,8.35,0,0.1,0} , 
                  {231,227,221,0,0.15,2.55,0.2,0.25,0,0,0,0.7,6.15,0} , 
                  {163,81,67,2.05,0,7.95,0,0,0,0,0,0,0,0} , 
                  {203,85,70,7.55,0.85,1.6,0,0,0,0,0,0,0,0} ,
                  {219,90,74,8.4,1.35,0.25,0,0,0,0,0,0,0,0} , 
                  {227,128,93,1.65,7.7,0.25,0,0,0,0,0.4,0,0,0} , 
                  {230,168,151,0.65,2.35,1.1,0,0,0,0,5.9, 0,0,0} , 
                  {239,199,185,0,0.6,1.05,0,0,0,0,8.35,0,0,0} , 
                  {238,228,221,0,0,4.7,0.4,0,0,0,0,1.15,3.75,0} , 
                  {163,69,67,4.6,0.1,5.3,0,0,0,0,0,0,0,0} , 
                  {194,81,68,6.3,0.05,3.65,0,0,0,0,0,0,0,0} , 
                  {217,115,61,0.1,9.25,0.65,0,0,0,0,0,0,0,0} , 
                  {225,127,93,1.9,7.35,0.7,0,0,0,0,0.05,0,0,0} , 
                  {226,136,75,0,9.5,0.5,0,0,0,0,0,0,0,0} , 
                  {233,183,142,0,7.55,1.25,0.35,0,0,0,0.85,0,0,0} , 
                  {234,194,174,0,1.75,1.2,0,0,0,0,7.05,0,0,0 } ,
                  {233,222,214,0,0.1,4.6,0.5,0,0,0,0,0.6,4.2,0 } ,
                  {142,81,62,0.25,0,9.75,0,0,0,0,0,0,0,0 } ,
                  {185,95,66,0.95,1.55,7.5,0,0,0,0,0,0,0,0 } ,
                  {214,127,52,0.1,9.5,0.4,0,0,0,0,0,0,0,0 } ,
                  {227,151,66,0,9.7,0.3,0,0,0,0,0,0,0,0 } ,
                  {232,184,133,0,8.05,1.3,0.1,0,0,0,0.55,0,0,0 } ,
                  {236,196,170,0,3,1.7,0.1,0,0,0,5,0.2,0,0 } ,
                  {233,221,211,0,0,5.4,0.9,0,0,0,0,0.7,3,0 } ,
                  {131,87,65,0,0,10,0,0,0,0,0,0,0,0 } ,
                  {166,101,64,0.25,0.1,9.65,0,0,0,0,0,0,0,0 } ,
                  {205,128,71,0,7.5,2.5,0,0,0,0,0,0,0,0 } ,
                  {224,151,84,0,9.5,0.5,0,0,0,0,0,0,0,0 } ,
                  {229,165,93,0,9.1,0.9,0,0,0,0,0,0,0,0 } ,
                  {236,198,168,0,5.3,1.3,0.25,0,0,0,3.15,0,0,0 } ,
                  {234,223,211,0,0,5.4,1.5,0,0,0,0,0.75,2.35,0 } ,
                  {128,90,64,0,0,10,0,0,0,0,0,0,0,0 } ,
                  {162,104,61,0,0.05,9.95,0,0,0,0,0,0,0,0 } ,
                  {202,136,67,0,5.65,4.35,0,0,0,0,0,0,0,0 } ,
                  {221,159,75,0,9,1,0,0,0,0,0,0,0,0 } ,
                  {229,174,95,0,9.05,0.85,0.1,0,0,0,0,0,0,0 } ,
                  {237,195,146,0,7.65,1.45,0.65,0,0,0,0.25,0,0,0 } ,
                  {232,221,206,0,0,5.1,1.9,0,0,0,0,0.9,2.1,0 } ,
                  {116,92,69,0,0,10,0,0,0,0,0,0,0,0 } ,
                  {156,115,69,0,0,9.9,0.1,0,0,0,0,0,0,0 } ,
                  {190,137,66,0,3.7,6.1,0.2,0,0,0,0,0,0,0 } ,
                  {215,164,75,0,8.25,1.5,0.25,0,0,0,0,0,0,0 } ,
                  {231,180,81,0,7.1,0.75,2.1,0.05,0,0,0,0,0,0 } ,
                  {233,193,117,0,5.75,1.2,3.05,0,0,0,0,0,0,0 } ,
                  {233,223,207,0,0.1,5.4,1.85,0,0,0,0,0.65,2,0 } ,
                  {237,220,193,0,1.65,3.75,3.55,0,0,0,0.25,0.4,0.4,0 } ,
                  {121,104,77,0,0,8.7,0.25,1.05,0,0,0,0,0,0 } ,
                  {159,126,73,0,0,9.7,0.1,0.2,0,0,0,0,0,0 } ,
                  {187,145,69,0,1.35,8,0.4,0.25,0,0,0,0,0,0 } ,
                  {209,166,70,0,5.05,3.1,1.6,0.25,0,0,0,0,0,0 } ,
                  {225,184,90,0,3.2,1.15,5.55,0.1,0,0,0,0,0,0 } ,
                  {234,195,87,0,2,0.75,7.2,0.05,0,0,0,0,0,0 } ,
                  {236,221,190,0,0.15,3.55,5.25,0,0,0,0,0.45,0.6,0 } ,
                  {117,104,75,0,0,8.7,0.35,0.95,0,0,0,0,0,0 } ,
                  {154,128,71,0,0,7.85,0.7,1.45,0,0,0,0,0,0 } ,
                  {179,151,81,0,0.1,7.65,0.6,1.65,0,0,0,0,0,0 } ,
                  {201,170,78,0,1.95,4.85,2.85,0.35,0,0,0,0,0,0 } ,
                  {222,190,79,0,0.8,1.45,7.1,0.65,0,0,0,0,0,0 } ,
                  {232,203,75,0,0.2,0.3,9.3,0.2,0,0,0,0,0,0 } ,
                  {237,219,149,0,0.1,0.7,9.2,0,0,0,0,0,0,0 } ,
                  {114,108,76,0,0,5.25,0.55,4.2,0,0,0,0,0,0 } ,
                  {147,132,68,0,0,4.6,0.5,4.9,0,0,0,0,0,0 } ,
                  {173,152,77,0,0.15,4.1,0.85,4.9,0,0,0,0,0,0 } ,
                  {197,174,73,0,0.5,2.95,3.85,2.7,0,0,0,0,0,0 } ,
                  {216,191,71,0,0.6,1,7,1.4,0,0,0,0,0,0 } ,
                  {230,210,100,0,0,0.3,9.4,0.3,0,0,0,0,0,0 } ,
                  {236,217,103,0,0.05,0.2,9.7,0.05,0,0,0,0,0,0 } ,
                  {110,108,74,0,0,1.75,0.35,7.9,0,0,0,0,0,0 } ,
                  {142,134,68,0,0,0.75,0.45,8.8,0,0,0,0,0,0 } ,
                  {163,151,75,0,0,2.55,1,6.45,0,0,0,0,0,0 } ,
                  {186,171,67,0,0.25,2.15,2.35,5.25,0,0,0,0,0,0 } ,
                  {211,193,71,0,0,0.9,6.95,2.15,0,0,0,0,0,0 } ,
                  {227,207,98,0,0,0.7,8.75,0.55,0,0,0,0,0,0 } ,
                  {239,220,105,0,0,0.15,9.8,0.05,0,0,0,0,0,0 } ,
                  {98,102,74,0,0,0.1,0.3,9.5,0,0,0,0,0,0.1 } ,
                  {126,130,68,0,0,0.1,0.45,9.45,0,0,0,0,0,0 } ,
                  {151,151,74,0,0,0.1,0.55,9.35,0,0,0,0,0,0 } ,
                  {174,174,69,0,0,0.1,1.15,8.75,0,0,0,0,0,0 } ,
                  {196,194,70,0,0,0,3.15,6.85,0,0,0,0,0,0 } ,
                  {220,211,105,0,0,0.15,5.7,4.15,0,0,0,0,0,0 } ,
                  {231,225,170,0,0,0.25,7.35,2.3,0,0,0,0.1,0,0 } ,
                  {230,220,108,0,0,0.15,8.8,1.05,0,0,0,0,0,0 } ,
                  {89,101,77,0,0,0.25,0.2,9.55,0,0,0,0,0,0 } ,
                  {93,103,75,0,0,0.2,0.25,9.55,0,0,0,0,0,0 } ,
                  {135,152,66,0,0,0,0.55,9.45,0,0,0,0,0,0 } ,
                  {165,176,75,0,0,0,0.55,9.45,0,0,0,0,0,0 } ,
                  {184,195,80,0,0,0,0.65,9.35,0,0,0,0,0,0 } ,
                  {213,211,171,0,0,0.9,1.1,7.2,0,0,0,0.2,0.6,0 } ,
                  {206,208,93,0,0,0,2.65,7.35,0,0,0,0,0,0 } ,
                  {229,227,204,0,0,0.9,2.7,4.55,0,0,0,0,1.85,0 } ,
                  {213,214,116,0,0,0,2.6,7.4,0,0,0,0,0,0 } ,
                  {76,102,72,0,0,0,0,9.9,0,0,0,0,0.1,0 } ,
                  {82,125,67,0,0,0,0,10,0,0,0,0,0,0 } ,
                  {116,151,77,0,0,0,0.1,9.9,0,0,0,0,0,0 } ,
                  {138,172,75,0,0,0,0.45,9.55,0,0,0,0,0,0 } ,
                  {160,190,87,0,0,0,0.4,9.6,0,0,0,0,0,0 } ,
                  {191,207,133,0,0,0,0.75,9.25,0,0,0,0,0,0 } ,
                  {177,197,103,0,0,0,0.55,9.45,0,0,0,0,0,0 } ,
                  {224,227,208,0,0,0,0.4,7.5,0,0,0,0.2,1.9,0 } ,
                  {200,213,149,0,0,0,0.7,9.3,0,0,0,0,0,0 } ,
                  {63,102,74,0,0,0,0,10,0,0,0,0,0,0 } ,
                  {52,121,73,0,0,0,0,10,0,0,0,0,0,0 } ,
                  {68,144,78,0,0,0,0.15,9.85,0,0,0,0,0,0 } ,
                  {102,165,92,0,0,0,0.05,9.95,0,0,0,0,0,0 } ,
                  {159,190,128,0,0,0,0.2,9.8,0,0,0,0,0,0 } ,
                  {123,174,103,0,0,0,0.05,9.95,0,0,0,0,0,0 } ,
                  {185,209,162,0,0,0,0.5,9.5,0,0,0,0,0,0 } ,
                  {134,180,114,0,0,0,0.05,9.9,0.05,0,0,0,0,0 } ,
                  {223,227,211,0,0,0,0,7.25,0,0,0,0,2.75,0 } ,
                  {193,212,172,0,0,0,0.35,9.6,0,0,0,0.05,0,0 } ,
                  {71,103,83,0,0,0,0,9.9,0,0,0,0,0,0.1 } ,
                  {55,125,93,0,0,0,0,10,0,0,0,0,0,0 } ,
                  {69,147,105,0,0,0,0,10,0,0,0,0,0,0 } ,
                  {86,165,117,0,0,0,0,10,0,0,0,0,0,0 } ,
                  {118,179,136,0,0,0,0.05,9.9,0.05,0,0,0,0,0 } ,
                  {175,205,173,0,0,0,0.1,9.85,0.05,0,0,0,0,0 } ,
                  {144,190,152,0,0,0,0,9.9,0.1,0,0,0,0,0 } ,
                  {221,229,216,0,0,0,0,8.6,0,0,0,0.3,1.1,0 } ,
                  {198,218,194,0,0,0,0.05,9.4,0.1,0,0,0,0.45,0 } ,
                  {70,105,88,0,0,0,0,9.85,0,0,0,0,0,0.15 } ,
                  {46,125,98,0,0,0,0,10,0,0,0,0,0,0 } ,
                  {23,146,113,0,0,0,0,9.95,0.05,0,0,0,0,0 } ,
                  {96,170,139,0,0,0,0,9.95,0.05,0,0,0,0,0 } ,
                  {125,186,158,0,0,0,0.05,9.75,0.2,0,0,0,0,0 } ,
                  {155,196,172,0,0,0,0,9.8,0.2,0,0,0,0,0 } ,
                  {222,230,217,0,0,0,0,7.35,0,0,0,0,2.65,0 } ,
                  {195,219,199,0,0,0,0.05,9.7,0.15,0,0,0,0.1,0 } ,
                  {60,103,89,0,0,0,0,9.8,0,0,0,0,0,0.2 } ,
                  {14,125,101,0,0,0,0,10,0,0,0,0,0,0 } ,
                  {67,150,123,0,0,0,0.5,9.5,0,0,0,0,0,0 } ,
                  {87,167,144,0,0,0,0,9.8,0.2,0,0,0,0,0 } ,
                  {117,182,159,0,0,0,0,9.95,0.05,0,0,0,0,0 } ,
                  {147,193,174,0,0,0,0,9.45,0.55,0,0,0,0,0 } ,
                  {217,226,216,0,0,0,0,7.55,0,0,0,0,2.45,0 } ,
                  {187,212,196,0,0,0,0,9.75,0.2,0,0,0,0.05,0 } ,
                  {71,109,96,0,0,0,0,9.85,0,0,0,0,0,0.15 } ,
                  {68,126,110,0,0,0,0,10,0,0,0,0,0,0 } ,
                  {61,145,125,0,0,0,0,9.9,0.1,0,0,0,0,0 } ,
                  {91,170,154,0,0,0,0,9.65,0.35,0,0,0,0,0 } ,
                  {141,190,173,0,0,0,0,9.7,0.3,0,0,0,0,0 } ,
                  {178,208,192,0,0,0,0,9.15,0.35,0,0,0,0.5,0 } ,
                  {145,192,177,0,0,0,0.05,9.4,0.55,0,0,0,0,0 } ,
                  {218,227,219,0,0,0,0.05,7.8,0,0,0,0,2.15,0 } ,
                  {187,214,201,0,0,0,0,9.05,0.6,0,0,0,0.35,0 } ,
                  {56,102,90,0,0,0,0,9.95,0,0,0,0,0,0.05 } ,
                  {65,127,116,0,0,0,0,9.15,0.85,0,0,0,0,0 } ,
                  {53,147,133,0,0,0,0,9.65,0.35,0,0,0,0,0 } ,
                  {81,171,161,0,0,0,0,8.4,1.6,0,0,0,0,0 } ,
                  {139,192,180,0,0,0,0,8.1,1.85,0,0,0,0.05,0 } ,
                  {177,210,197,0,0,0,0,8.4,1.3,0,0,0,0.3,0 } ,
                  {144,195,183,0,0,0,0.05,8.45,1.05,0,0,0,0.45,0 } ,
                  {221,231,224,0,0,0,0,7.55,0,0,0,0,2.45,0 } ,
                  {189,217,206,0,0,0,0,8.95,0.65,0,0,0,0.4,0 } ,
                  {53,103,93,0,0,0,0,9.8,0,0,0,0,0,0.2 } ,
                  {72,133,128,0,0,0,0,9.05,0.95,0,0,0,0,0 } ,
                  {65,153,148,0,0,0,0,8.85,1.15,0,0,0,0,0 } ,
                  {108,175,168,0,0,0,0,7.45,2.45,0,0,0,0.1,0 } ,
                  {134,191,184,0,0,0,0,6.9,3.05,0,0,0,0.05,0 } ,
                  {189,214,204,0,0,0,0,8.5,1,0,0,0,0.5,0 } ,
                  {143,195,189,0,0,0,0,6.5,3.45,0,0,0,0.05,0 } ,
                  {221,230,224,0,0,0,0,6.1,0.1,0,0,0,3.8,0 } ,
                  {189,216,208,0,0,0,0,7.35,1.75,0,0,0,0.9,0 } ,
                  {55,104,97,0,0,0,0,9.8,0,0,0,0,0,0.2 } ,
                  {65,128,126,0,0,0,0,9.3,0.7,0,0,0,0,0 } ,
                  {42,148,146,0,0,0,0,8.15,1.85,0,0,0,0,0 } ,
                  {96,173,169,0,0,0,0,7.1,2.9,0,0,0,0,0 } ,
                  {125,190,185,0,0,0,0,6.9,3.1,0,0,0,0,0 } ,
                  {192,215,209,0,0,0,0,7.65,1.8,0,0,0,0.55,0 } ,
                  {158,203,197,0,0,0,0,6.55,3.4,0,0,0,0.05,0 } ,
                  {221,231,226,0,0,0,0,6.85,1,0,0,0,2.15,0 } ,
                  {183,218,210,0,0,0,0,7.55,2.45,0,0,0,0,0 } ,
                  {55,101,97,0,0,0,0,9.75,0,0,0,0,0,0.25 } ,
                  {59,128,128,0,0,0,0,9.25,0.75,0,0,0,0,0 } ,
                  {39,149,152,0,0,0,0,7.9,2.1,0,0,0,0,0 } ,
                  {98,174,175,0,0,0,0,5.75,4.25,0,0,0,0,0 } ,
                  {157,198,196,0,0,0,0,5.6,4.2,0,0,0,0.2,0 } ,
                  {128,190,189,0,0,0,0,6,3.95,0,0,0,0.05,0 } ,
                  {193,216,212,0,0,0,0,7.55,1.7,0,0,0,0.75,0 } ,
                  {158,204,202,0,0,0,0,6.15,3.7,0,0,0,0.15,0 } ,
                  {223,231,228,0,0,0,0,3.65,0.35,0,0,0,6,0 } ,
                  {183,218,214,0,0,0,0,5.7,4.05,0,0,0,0.25,0 } ,
                  {55,103,101,0,0,0,0,9.45,0.35,0,0,0,0,0.2 } ,
                  {63,130,135,0,0,0,0,9.15,0.85,0,0,0,0,0 } ,
                  {24,148,157,0,0,0,0,6,4,0,0,0,0,0 } ,
                  {92,173,177,0,0,0,0,4.35,5.65,0,0,0,0,0 } ,
                  {133,192,195,0,0,0,0,4.1,5.9,0,0,0,0,0 } ,
                  {161,206,206,0,0,0,0,4.4,5.5,0,0,0,0.1,0 } ,
                  {224,231,229,0,0,0,0,5.8,0.5,0,0,0.2,3.5,0 } ,
                  {187,219,218,0,0,0,0,4.75,4.75,0,0,0,0.5,0 } ,
                  {60,102,104,0,0,0,0,9.45,0.35,0,0,0,0,0.2 } ,
                  {242,255,127,143,0,0,0,0,4.75,5.25,0,0,0,0,0 } ,
                  {50,151,163,0,0,0,0,3.6,6.4,0,0,0,0,0 } ,
                  {61,170,187,0,0,0,0,1.3,8.7,0,0,0,0,0 } ,
                  {133,194,203,0,0,0,0,3,7,0,0,0,0,0 } ,
                  {160,206,213,0,0,0,0,2.55,7.45,0,0,0,0,0 } ,
                  {225,232,231,0,0,0,0,3.65,0.35,0,0,0,6,0 } ,
                  {204,226,228,0,0,0,0,3.3,6.05,0,0,0,0.65,0 } ,
                  {63,103,106,0,0,0,0,8.8,0.85,0,0,0,0,0.35 } ,
                  {7,127,144,0,0,0,0,2.45,7.55,0,0,0,0,0 } ,
                  {165,144,168,0,0,0,0,1.2,8.8,0,0,0,0,0 } ,
                  {76,170,188,0,0,0,0,0.7,9.3,0,0,0,0,0 } ,
                  {109,186,205,0,0,0,0,1,9,0,0,0,0,0 } ,
                  {159,203,214,0,0,0,0,1.05,8.9,0,0,0,0.05,0 } ,
                  {224,228,227,0,0,0,0,1.85,0.9,0,0,0.3,6.95,0 } ,
                  {204,225,227,0,0,0,0,4.65,4.2,0,0,0.2,0.95,0 } ,
                  {69,100,106,0,0,0,0,7.5,0.6,0,0,0,0.4,1.5 } ,
                  {53,123,143,0,0,0,0,1.4,8.5,0.1,0,0,0,0 } ,
                  {28,147,173,0,0,0,0,0.9,9.1,0,0,0,0,0 } ,
                  {54,166,194,0,0,0,0,0.45,9.55,0,0,0,0,0 } ,
                  {123,187,209,0,0,0,0,0.3,9.7,0,0,0,0,0 } ,
                  {199,213,217,0,0,0,0,2.65,2.9,0,0,0,4.45,0 } ,
                  {182,211,217,0,0,0,0,1.85,7.75,0,0,0,0.4,0 } ,
                  {223,227,225,0,0,0,0,2.6,0.5,0,0,0,6.9,0 } ,
                  {206,223,227,0,0,0,0,3,4.8,0,0,0.2,2,0 } ,
                  {60,98,109,0,0,0,0,5.85,2.6,0,0,0,0.05,1.5 } ,
                  {24,123,155,0,0,0,0,0.1,9.9,0,0,0,0,0 } ,
                  {224,144,181,0,0,0,0,0.1,9.9,0,0,0,0,0 } ,
                  {44,162,203,0,0,0,0,0,10,0,0,0,0,0 } ,
                  {138,190,215,0,0,0,0,0,10,0,0,0,0,0 } ,
                  {188,211,221,0,0,0,0,1.15,7.55,0,0,0.2,1.1,0 } ,
                  {222,228,226,0,0,0,0,2.4,0.2,0,0,0.3,7.1,0 } ,
                  {57,97,117,0,0,0,0,0.05,9.25,0,0,0,0,0.7 } ,
                  {29,120,164,0,0,0,0,0.05,9.95,0,0,0,0,0 } ,
                  {23,143,191,0,0,0,0,0,10,0,0,0,0,0 } ,
                  {58,162,212,0,0,0,0,0,10,0,0,0,0,0 } ,
                  {156,193,223,0,0,0,0,0,10,0,0,0,0,0 } ,
                  {198,215,230,0,0,0,0,0.1,8.25,0,0,0,1.65,0 } ,
                  {228,233,232,0,0,0,0,3.2,0,0,0,0.3,6.5,0 } ,
                  {89,89,134,0,0,0,0,0,3.85,6.15,0,0,0,0 } ,
                  {90,75,134,0,0,0,0,0,0.7,9.3,0,0,0,0 } ,
                  {98,118,167,0,0,0,0,0,7.05,2.95,0,0,0,0 } ,
                  {92,91,154,0,0,0,0,0,3.35,6.65,0,0,0,0 } ,
                  {131,146,187,0,0,0,0,0,7.5,2.5,0,0,0,0 } ,
                  {109,139,193,0,0,0,0,0,8.95,1.05,0,0,0,0 } ,
                  {166,176,203,0,0,0,0,0,4.8,3,0,0,2.2,0 } ,
                  {147,168,212,0,0,0,0,0,7.95,2.05,0,0,0,0 } ,
                  {194,200,218,0,0,0,0,0,1.3,0.95,0,0,7.75,0 } ,
                  {185,196,227,0,0,0,0,0,7.25,2.55,0,0,0.2,0 } ,
                  {215,216,226,0,0,0,0,0,0,0,0,0,10,0 } ,
                  {211,215,232,0,0,0,0,0,0.2,1.25,0,0,8.55,0 } ,
                  {236,235,236,0,0,0.1,0,0.1,0,0,0,0.7,9.1,0 } ,
                  {112,93,135,0,0,0,0,0,0,10,0,0,0,0 } ,
                  {109,78,135,0,0,0,0,0,0,9.9,0.1,0,0,0 } ,
                  {126,93,155,0,0,0,0,0,0,9.8,0.2,0,0,0 } ,
                  {145,127,182,0,0,0,0,0,0.25,9.7,0.05,0,0,0 } ,
                  {170,162,207,0,0,0,0,0,0,10,0,0,0,0 } ,
                  {202,199,224,0,0,0,0,0,0.45,8.85,0,0,0.7,0 } ,
                  {201,196,226,0,0,0,0,0,0,9.9,0,0,0.1,0 } ,
                  {220,217,228,0,0,0,0,0,0,0.05,0,0,9.95,0 } ,
                  {218,216,234,0,0,0,0,0,0,2.4,0,0,7.6,0 } ,
                  {236,234,235,0,0,0.5,0,0.15,0,0,0,0.8,8.55,0 } ,
                  {111,93,134,0,0,0,0,0,0.25,9.15,0.6,0,0,0 } ,
                  {121,75,132,0,0,0,0,0,0,9.3,0.7,0,0,0 } ,
                  {149,90,153,0,0,0,0,0,0,9.1,0.9,0,0,0 } ,
                  {168,113,172,0,0,0,0,0,0,9.55,0.45,0,0,0 } ,
                  {182,155,202,0,0,0,0,0,0,9.55,0.45,0,0,0 } ,
                  {210,200,218,0,0,0,0,0,0,8.55,0,0,1.45,0 } ,
                  {210,191,224,0,0,0,0,0,0,9.75,0.25,0,0,0 } ,
                  {221,210,233,0,0,0,0,0,0,8.8,0.3,0.2,0.7,0 } ,
                  {234,231,232,0,0,0.05,0,0,0,0,0,0.2,9.75,0 } ,
                  {236,231,240,0,0,0,0,0,0,0,0,0.1,9.9,0 } ,
                  {139,82,132,0,0,0,0,0,0,9.2,0.8,0,0,0 } ,
                  {131,70,127,0,0,0,0,0,0,9.2,0.8,0,0,0 } ,
                  {160,85,147,0,0,0,0,0,0,8.6,1.4,0,0,0 } ,
                  {178,111,169,0,0,0,0,0,0,8.3,1.7,0,0,0 } ,
                  {192,141,189,0,0,0,0,0,0,8.1,1.9,0,0,0 } ,
                  {212,195,211,0,0,0,0,0,0,8.25,0.45,0,1.3,0 } ,
                  {214,181,216,0,0,0,0,0,0,9.45,0.55,0,0,0 } ,
                  {226,208,229,0,0,0,0,0,0,9.5,0.5,0,0,0 } ,
                  {236,232,231,0,0,0.5,0,0,0,0,0,0.55,8.95,0 } ,
                  {236,228,237,0,0,0,0,0,0,1.15,1.45,0.3,7.1,0 } ,
                  {136,71,121,0,0,0,0,0,0,9.2,0.8,0,0,0 } ,
                  {170,85,146,0,0,0,0,0,0,7.95,2.05,0,0,0 } ,
                  {191,103,163,0,0,0,0,0,0,3.75,6.25,0,0,0 } ,
                  {205,125,179,0,0,0,0,0,0,4.65,5.35,0,0,0 } ,
                  {224,168,206,0,0,0,0,0,0,3.95,6.05,0,0,0 } ,
                  {233,201,224,0,0,0,0,0,0,5.2,4.8,0,0,0 } ,
                  {237,231,232,0,0,1.7,0,0,0,0,0,0.6,7.7,0 } ,
                  {240,229,236,0,0,0.55,0,0,0,0.3,3.35,0.75,5.05,0 } ,
                  {147,72,120,0,0,0,0,0,0,9.2,0.8,0,0,0 } ,
                  {182,87,140,0,0,0,0,0,0,6.1,3.9,0,0,0 } ,
                  {179,76,140,0.15,0,0,0,0,0,7.05,2.8,0,0,0 } ,
                  {202,116,162,0,0,0,0,0,0,3.55,6.45,0,0,0 } ,
                  {201,102,160,0,0,0,0,0,0,4.4,5.6,0,0,0 } ,
                  {213,156,186,0,0,0,0,0,0,1.7,8.3,0,0,0 } ,
                  {213,114,170,0.1,0,0,0,0,0,0.2,9.7,0,0,0 } ,
                  {224,188,206,0,0,0,0,0,0,3.1,6.9,0,0,0 } ,
                  {230,165,201,0,0,0,0,0,0,0.55,9.45,0,0,0 } ,
                  {234,208,222,0,0,0,0,0,0,3.35,6.65,0,0,0 } ,
                  {235,199,220,0,0,0,0,0,0,1.75,8.25,0,0,0 } ,
                  {239,233,232,0,0.05,2.1,0.15,0,0,0,0,0.85,6.85,0 } ,
                  {241,228,234,0,0,1.15,0,0,0,0.05,4,0.55,4.25,0 } ,
                  {147,76,109,0.5,0,0.45,0,0,0,8,1.05,0,0,0 } ,
                  {183,81,134,0.35,0,0,0,0,0,6.05,3.6,0,0,0 } ,
                  {211,111,156,0,0,0,0,0,0,1.55,8.45,0,0,0 } ,
                  {209,92,153,0,0,0,0,0,0,1.9,8.1,0,0,0 } ,
                  {219,155,180,0.1,0,0,0,0,0,0.15,9.75,0,0,0 } ,
                  {224,112,164,0,0,0,0,0,0,0,10,0,0,0 } ,
                  {230,165,195,0,0,0,0,0,0,0.25,9.75,0,0,0 } ,
                  {235,202,217,0,0,0,0,0,0,0.15,9.8,0,0.05,0 } ,
                  {238,230,230,0,0,2.35,0.15,0.1,0,0,0,0.9,6.5,0 } ,
                  {238,226,231,0,0,1,0,0,0,0.75,4.75,0.35,3.15,0 } ,
                  {152,77,103,3.05,0,1.2,0,0,0,4.95,0.8,0,0,0 } ,
                  {191,73,125,0.55,0,0,0,0,0,1.8,7.65,0,0,0 } ,
                  {219,91,142,0.65,0,0,0,0,0,0.25,9.1,0,0,0 } ,
                  {222,102,150,0.2,0,0,0,0,0.05,0.15,9.6,0,0,0 } ,
                  {233,176,191,0,0,0,0,0,0,0.3,9.7,0,0,0 } ,
                  {230,166,187,0,0,0,0,0,0,0.05,9.95,0,0,0 } ,
                  {234,205,210,0.5,0,0.6,0,0,0,0,8.7,0,0.2,0 } ,
                  {233,230,227,0,0,1.4,0.35,0.1,0,0,0,0.95,7.2,0 } ,
                  {153,73,95,5.1,0,1.75,0,0,0.1,2.5,0.55,0,0,0 } ,
                  {199,69,118,0.55,0,0,0,0,0,0.9,8.55,0,0,0 } ,
                  {221,85,133,0.6,0,0,0,0,0,0.1,9.3,0,0,0 } ,
                  {230,137,160,0,0,0,0,0,0,0,10,0,0,0 } ,
                  {223,110,146,0.2,0,0,0,0,0,0.15,9.65,0,0,0 } ,
                  {231,178,188,1.6,0,0,0,0,0,0.05,8.35,0,0,0 } ,
                  {235,206,209,0,0,1.2,0,0,0,0.1,8.7,0,0,0 } ,
                  {235,232,228,0,0,2.15,0.15,0.25,0,0,0,1.05,6.4,0 } ,
                  {166,73,94,5.25,0,1.2,0,0,0,2.45,1.1,0,0,0 } ,
                  {199,65,106,1.85,0,0,0,0,0,1.2,6.95,0,0,0 } ,
                  {218,81,120,1.05,0,0,0,0,0,0.05,8.9,0,0,0 } ,
                  {228,138,151,0.75,0.05,0,0,0,0,0,9.2,0,0,0 } ,
                  {221,114,139,1.15,0,0,0,0,0,0.1,8.75,0,0,0 } ,
                  {230,175,178,1.35,0,0.25,0,0,0,0,8.4,0,0,0 } ,
                  {232,202,201,0,0.1,1.05,0,0,0,0,8.75,0,0.1,0 } ,
                  {232,228,224,0,0,2.9,0.1,0,0,0,0,0.95,6.05,0 } ,
                  {255,247,245,0,0,0,0,0,0,0,0,9.45,0.55,0 } ,
                  {245,240,246,0,0,0,0,0,0,0,0,5.5,4.3,0.2 } ,
                  {234,234,245,0,0,0,0,0,0,0,0,1.7,8.3,0 } ,
                  {232,232,243,0,0,0,0,0,0,0,0,0.55,9.45,0 } ,
                  {227,227,237,0,0,0,0,0,0,0,0,0.4,9.6,0 } ,
                  {221,222,233,0,0,0,0,0,0,0,0,0,10,0 } ,
                  {215,216,228,0,0,0,0,0,0,0.05,0,0,9.95,0 } ,
                  {211,212,223,0,0,0,0,0,0,0,0,0,10,0 } ,
                  {208,209,220,0,0,0,0,0,0,0,0,0,10,0 } ,
                  {204,205,216,0,0,0,0,0,0,0,0,0,10,0 } ,
                  {200,201,210,0,0,0,0,0,0,0,0,0,10,0 } ,
                  {195,196,205,0,0,0,0,0,0,0,0,0,10,0 } ,
                  {190,191,200,0,0,0,0,0,0,0,0,0,10,0 } ,
                  {187,189,198,0,0,0,0,0,0,0,0,0,10,0 } ,
                  {183,183,193,0,0,0,0,0,0,0,0,0,10,0 } ,
                  {175,179,188,0,0,0,0,0,0,0,0,0,10,0 } ,
                  {171,173,182,0,0,0,0,0,0,0,0,0,10,0 } ,
                  {165,168,177,0,0,0,0,0,0,0,0,0,10,0 } ,
                  {158,164,174,0,0,0,0,0,0,0,0,0,10,0 } ,
                  {152,160,170,0,0,0,0,0,0,0,0,0,10,0 } ,
                  {148,154,164,0,0,0,0,0,0,0,0,0,10,0 } ,
                  {143,151,162,0,0,0,0,0,0.05,0,0,0,9.95,0 } ,
                  {138,144,154,0,0,0,0,0,0.05,0,0,0,9.95,0 } ,
                  {133,140,149,0,0,0,0,0,0,0,0,0,10,0 } ,
                  {128,136,145,0,0,0,0,0,0.05,0,0,0,9.95,0 } ,
                  {121,129,140,0,0,0,0,0,0,0,0,0,9.85,0.15 } ,
                  {115,124,135,0,0,0,0,0,0,0,0,0,9.5,0.5 } ,
                  {111,120,129,0,0,0,0,0,0.75,0.05,0,0,9.2,0 } ,
                  {105,115,125,0,0,0,0,0,0.25,0.05,0,0,8.7,1 } ,
                  {98,107,116,0,0,0,0,0,0.25,0,0,0,8.4,1.35 } ,
                  {90,99,106,0,0,0,0,0,0,0,0,0,5.55,4.45 } ,
                  {81,89,95,0,0,0,0,0,0,0,0,0,2.15,7.85 } ,
                  {75,83,88,0,0,0,0,0.15,0,0,0,0,0.85,9 } ,
                  {72,78,82,0,0,0,0,0.05,0,0,0,0,1.95,8 } ,
                  {67,72,76,0,0,0,0,0.05,0,0,0,0,0,9.95 } ,
                  {65,68,72,0,0,0,0,0,0,0,0,0,0.1,9.9 } ,
                  {212,70,65,10,0,0,0,0,0,0,0,0,0,0 } ,
                  {213,70,66,10,0,0,0,0,0,0,0,0,0,0 } ,
                  {222,120,76,0.8,8.2,1,0,0,0,0,0,0,0,0 } ,
                  {214,73,78,9.85,0,0.15,0,0,0,0,0,0,0,0 } ,
                  {215,72,80,9.95,0,0.05,0,0,0,0,0,0,0,0 } ,
                  {207,71,77,10,0,0,0,0,0,0,0,0,0,0 } ,
                  {221,102,102,8.4,0.1,0.2,0.05,0,0,0,1.25,0,0,0 } ,
                  {213,76,61,9.55,0.35,0.1,0,0,0,0,0,0,0,0 } ,
                  {213,77,63,9.7,0.3,0,0,0,0,0,0,0,0,0 } ,
                  {209,64,56,10,0,0,0,0,0,0,0,0,0,0 } ,
                  {209,64,55,9.9,0,0.1,0,0,0,0,0,0,0,0 } ,
                  {202,64,59,10,0,0,0,0,0,0,0,0,0,0 } ,
                  {218,93,63,5.7,3.95,0.35,0,0,0,0,0,0,0,0 } };
  
  
  /**
   * The constructor fills the values of each color (red, green, ...)  
   * 
   * @param clusters : the vector of clusters RGB which contains the image
   * @param cnt : auxiliar counter to ponderate each cluster
   */
  public ClusterToString (Rgb[] clusters, int[] cnt) {
    
    int auxDistance = mUtils.getDistance(clusters[0] ,new Rgb((int) mDouble[0][0] , (int) mDouble[0][1], (int) mDouble[0][2]) );
    int iter = 0;
    for (int i=0; i<clusters.length;i++) 
    {
      for(int j=0; j<mDouble.length;j++) 
      {
        Rgb auxRgb = new Rgb((int) (mDouble[j][0]) , (int) (mDouble[j][1]) , (int) (mDouble[j][2]));
        if( mUtils.getDistance(clusters[i],auxRgb) < auxDistance) 
        {
          auxDistance = mUtils.getDistance(clusters[i],auxRgb);
          iter = j;
        }
                
      }
      
      red += mDouble[iter][3] ;  
      orange += mDouble[iter][4] ;
      brown += mDouble[iter][5] ;
      yellow += mDouble[iter][6];
      green += mDouble[iter][7] ;
      blue += mDouble[iter][8]  ;
      purple += mDouble[iter][9] ;
      pink += mDouble[iter][10] ;
      white += mDouble[iter][11] ;
      grey += mDouble[iter][12] ;
      black += mDouble[iter][13] ;
      
      
    }
    
    
    
        
  }
    
  /**
   * @return String containing the values of each color 
   */
  public String getColours() {
    
    //String string = "";
    
    ArrayList<Double> doublelist = new ArrayList<Double>();
    doublelist.add(red);
    doublelist.add(orange);
    doublelist.add(brown);
    doublelist.add(yellow);
    doublelist.add(green);
    doublelist.add(blue);
    doublelist.add(purple);
    doublelist.add(pink);
    doublelist.add(white);
    doublelist.add(grey);
    doublelist.add(black);
      Collections.sort(doublelist);
      
      
   /* for(int i=0; i<4; i++)
    {
      if(doublelist.get(i) == red) string+="red";
      if(doublelist.get(i) == orange) string+="orange ,";
      if(doublelist.get(i) == brown) string+="brown ,";
      if(doublelist.get(i) == yellow) string+="yellow ,";
      if(doublelist.get(i) == green) string+="green ,";
      if(doublelist.get(i) == blue) string+="orange ,";
      if(doublelist.get(i) == purple) string+="purple ,";
      if(doublelist.get(i) == pink) string+="pink ,";
      if(doublelist.get(i) == white) string+="white ,";
      if(doublelist.get(i) == grey) string+="grey ,";
      if(doublelist.get(i) == black) string+="black ,";
      
    }*/
    
    
    
    
   return "red :" + red + ", orange:" + orange +  ", brown:" + brown + ", yellow:" + yellow + ", " +
       "green:" + green + ", blue:" + blue + ", purple:" + purple + ", pink:" + pink + ", white:" + white + ", grey:" + grey + ", black:" + black ;
   
    //return string;
    
  }
  
}




Java Source Code List

org.ia.practiques.ClusterToString.java
org.ia.practiques.Cmyk.java
org.ia.practiques.DownloadFragment.java
org.ia.practiques.ImageDialog.java
org.ia.practiques.Kmeans.java
org.ia.practiques.Launcher.java
org.ia.practiques.MyTabListener.java
org.ia.practiques.PhotoFragment.java
org.ia.practiques.Rgb.java
org.ia.practiques.Utils.java