public string ClassifyTurnCode(RawTexture2D rawTexture)
 {
     string turnCodeClass = "";
     int lowestScore = 0;
     int[] turnCode = ChainCodeToTurnCode(rawTexture.GetChainCode());
     foreach (KeyValuePair<string, int[]> data in turnCodeDataSet) {
         int score = 0;
         for(int i = 0; i < Mathf.Min(turnCode.Length, data.Value.Length); i++){
             score += turnCode[i] == data.Value[i] ? 1 : 0;
         }
         if(score > lowestScore){
             lowestScore = score;
             turnCodeClass = data.Key;
         }
     }
     return turnCodeClass;
 }
 public string ClassifyTurnCountCode(RawTexture2D rawTexture)
 {
     string turnCodeClass = "";
     int lowestScore = 99999999;
     int[] count = CountChainCode(rawTexture.GetChainCode ());
     foreach (KeyValuePair<string, int[]> data in turnCodeCountDataSet) {
         int score = 0;
         for(int i = 0; i < 6; i++){
             score += Mathf.Abs(count[i] - data.Value[i]);
         }
         if(score < lowestScore){
             lowestScore = score;
             turnCodeClass = data.Key;
         }
     }
     return turnCodeClass;
 }
 // Use this for initialization
 void Start()
 {
     imageData = System.Array.ConvertAll (Resources.LoadAll ("Images/"+path, typeof(Texture2D)), i => (Texture2D)i);
     foreach (Texture2D image in imageData) {
         RawTexture2D rawTexture2D = new RawTexture2D(image);
         int[] chainCode = rawTexture2D.GetChainCode();
         int[] turnCode = ChainCodeToTurnCode(chainCode);
         foreach(int x in turnCode){;
             Debug.Log (image.name+"-- "+x);
         }
         chainCodeDataSet.Add(image.name, chainCode);
         chainCodeCountDataSet.Add(image.name, CountChainCode(chainCode));
         turnCodeDataSet.Add(image.name, turnCode);
         turnCodeCountDataSet.Add(image.name, CountTurnCode(turnCode));
     }
 }