Ejemplo n.º 1
0
 public void ProcessTrackerResult(Rectangle sourceRect, Image<Bgr, byte> subImage)
 {
     if (!Application.Current.Dispatcher.CheckAccess())
     {
         // process asynchronously on UI thread
         Application.Current.Dispatcher.BeginInvoke(new Action<Rectangle, Image<Bgr, Byte>>(ProcessTrackerResult), sourceRect, subImage);
         return;
     }
     CurrentFrame = new TrackedObjectFrame
     {
         RawImage = subImage,
         SourceRectangle = sourceRect
     };
     Frames.Add(CurrentFrame);
 }
Ejemplo n.º 2
0
 public void ProcessIdResult(TrackedObjectFrame frame)
 {
     if (frame.IdResults == null)
     {
         Log.Warn("Missing frame.IdResults");
         return;
     }
     if (IdResults == null)
     {
         IdResults = frame.IdResults.ToDictionary(x => x.Id, x => new IdScore(x.Id, x.Score));
     }
     else
     {
         foreach (var idr in frame.IdResults)
         {
             IdResults[idr.Id].Score += idr.Score;
         }
     }
     Identity = IdResults.OrderByDescending(x => x.Value.Score).Select(x => x.Key).First();
     frame.Identity = frame.IdResults.OrderByDescending(x => x.Score).First().Id;
 }