Change to support 7680 x 4320 and

Configuration additions
This commit is contained in:
2022-09-16 21:05:34 -07:00
parent deff6f484c
commit c86ad38455
40 changed files with 1153 additions and 454 deletions

View File

@ -76,20 +76,6 @@ public class FaceRecognition : DisposableObject
return results.ToArray();
}
private static Location TrimBound(double detectionConfidence, DlibDotNet.Rectangle rectangle, int width, int height, int facesCount) =>
new(
Math.Min(rectangle.Bottom, height),
detectionConfidence,
height,
Math.Max(rectangle.Left, 0),
ILocation.Digits,
ILocation.Factor,
Math.Min(rectangle.Right, width),
Math.Max(rectangle.Top, 0),
width,
facesCount
);
private List<(FacePart, FacePoint[])> GetFaceParts(FullObjectDetection fullObjectDetection)
{
List<(FacePart, FacePoint[])> results = new();
@ -155,11 +141,13 @@ public class FaceRecognition : DisposableObject
image.ThrowIfDisposed();
ThrowIfDisposed();
List<Location> results = new();
IEnumerable<MModRect> faces = GetMModRects(image);
foreach (MModRect? face in faces)
System.Drawing.Rectangle rectangle;
IEnumerable<MModRect> mModRects = GetMModRects(image);
foreach (MModRect? mModRect in mModRects)
{
Location location = TrimBound(face.DetectionConfidence, face.Rect, image.Width, image.Height, faces.Count());
face.Dispose();
rectangle = new(mModRect.Rect.Left, mModRect.Rect.Top, (int)mModRect.Rect.Width, (int)mModRect.Rect.Height);
Location location = Shared.Models.Stateless.Methods.ILocation.TrimBound(mModRect.DetectionConfidence, rectangle, image.Width, image.Height, mModRects.Count());
mModRect.Dispose();
results.Add(location);
}
if (sortByNormalizedPixelPercentage)
@ -206,9 +194,11 @@ public class FaceRecognition : DisposableObject
if (mModRects.Any())
{
Location location;
System.Drawing.Rectangle rectangle;
foreach (MModRect? mModRect in mModRects)
{
location = TrimBound(mModRect.DetectionConfidence, mModRect.Rect, image.Width, image.Height, mModRects.Length);
rectangle = new(mModRect.Rect.Left, mModRect.Rect.Top, (int)mModRect.Rect.Width, (int)mModRect.Rect.Height);
location = Shared.Models.Stateless.Methods.ILocation.TrimBound(mModRect.DetectionConfidence, rectangle, image.Width, image.Height, mModRects.Length);
mModRect.Dispose();
results.Add(location);
}