Example #1
0
 public static Emotion FindFaceClosestToRegion(IEnumerable <Emotion> emotion, FaceRectangle region)
 {
     return(emotion?.Where(e => CoreUtil.AreFacesPotentiallyTheSame(e.FaceRectangle, region))
            .OrderBy(e => Math.Abs(region.Left - e.FaceRectangle.Left) + Math.Abs(region.Top - e.FaceRectangle.Top)).FirstOrDefault());
 }
Example #2
0
 internal static Face FindFaceClosestToRegion(IEnumerable <Face> faces, BitmapBounds region)
 {
     return(faces?.Where(f => CoreUtil.AreFacesPotentiallyTheSame(region, f.FaceRectangle))
            .OrderBy(f => Math.Abs(region.X - f.FaceRectangle.Left) + Math.Abs(region.Y - f.FaceRectangle.Top)).FirstOrDefault());
 }