示例#1
0
 public void RecognizeLeaf()
 {
     Task.Run(() =>
     {
         ImageProcessor imageProcessor = new ImageProcessor(LeafImage);
         imageProcessor.EdgeDetect(Threshold);
         imageProcessor.Thinning();
         imageProcessor.CheckLines(MinLine);
         imageProcessor.MarkPoints(Distance);
         imageProcessor.CalcAngels();
         List <LeafToken> leafTokens = imageProcessor.GetTokens();
         double[] input = new double[NumberOfInputNodes];
         for (int i = 0; i < NumberOfInputNodes; i++)
         {
             input[i] = i < leafTokens.Count - 1 ? leafTokens[i].Sin : 0;
         }
         bpn.Run(ref input, out output);
         for (int i = 0; i < Plants.Count; i++)
         {
             Plants[i].Probability = output[i];
         }
         Results = Plants.OrderByDescending(x => x.Probability).ToList();
         NotifyOfPropertyChange(() => Results);
     });
 }