Exemple #1
0
 public NN_Processor(MsgService msgService, Constants.SignType signType)
     : base(msgService, VisionMessage.msgType)
 {
     this.signType = signType;
     if (signs == null)
     {
         signs = new Bitmap[Constants.NUM_OF_SIGN_TYPES + 1];
         ResizeBicubic resizer = new ResizeBicubic(32, 32);
         for (int i = 1; i <= Constants.NUM_OF_SIGN_TYPES; i++)
         {
             String file_name = "signs\\sign_" + (i < 10 ? ("0" + i) : ("" + i)) + ".bmp";
             signs[i] = resizer.Apply((Bitmap)Bitmap.FromFile(Constants.base_folder + file_name, false));
         }
     }
     if (networks == null)
     {
         networks = NNTrain.loadNetworks();
     }
 }
Exemple #2
0
 public NN_SURFProcessor(MsgService msgService, Constants.SignType signType)
     : base(msgService, VisionMessage.msgType)
 {
     this.signType = signType;
     if (signs == null)
     {
         signs = new Bitmap[Constants.NUM_OF_SIGN_TYPES + 1];
         ResizeBicubic resizer = new ResizeBicubic(32, 32);
         for (int i = 1; i <= Constants.NUM_OF_SIGN_TYPES; i++)
         {
             String file_name = "signs\\sign_" + (i < 10 ? ("0" + i) : ("" + i)) + ".bmp";
             signs[i] = resizer.Apply((Bitmap)Bitmap.FromFile(Constants.base_folder + file_name, false));
         }
     }
     if (network == null)
     {
         network = Network.Load(Constants.base_folder + Constants.NN_SVM_SURF + "_" + (signType == Constants.SignType.circular ? "circle" : "triangle") + ".dat");
     }
 }
Exemple #3
0
 public SVM_SURFProcessor(MsgService msgService, Constants.SignType signType)
     : base(msgService, VisionMessage.msgType)
 {
     this.signType = signType;
     if (signs == null)
     {
         signs = new Bitmap[Constants.NUM_OF_SIGN_TYPES + 1];
         ResizeBicubic resizer = new ResizeBicubic(32, 32);
         for (int i = 1; i <= Constants.NUM_OF_SIGN_TYPES; i++)
         {
             String file_name = "signs\\sign_" + (i < 10 ? ("0" + i) : ("" + i)) + ".bmp";
             signs[i] = resizer.Apply((Bitmap)Bitmap.FromFile(Constants.base_folder + file_name, false));
         }
     }
     if (model == null)
     {
         BinaryFormatter formatter = new BinaryFormatter();
         FileStream stream = new FileStream(Constants.base_folder + Constants.NN_SVM_SURF + "_" + (signType == Constants.SignType.circular ? "circle" : "triangle") + ".dat", FileMode.Open, FileAccess.Read, FileShare.None);
         model = (Model)formatter.Deserialize(stream);
         stream.Close();
     }
 }