Rename-isWrongYear
EyeThreshold
This commit is contained in:
@ -94,9 +94,11 @@ internal abstract class Face
|
||||
return result;
|
||||
}
|
||||
|
||||
internal static double? Getα(Dictionary<FacePart, Models.FacePoint[]> faceParts)
|
||||
internal static (bool?, double?) GetEyeα(Dictionary<FacePart, Models.FacePoint[]> faceParts)
|
||||
{
|
||||
bool? review;
|
||||
double? result;
|
||||
int? lipY = null;
|
||||
int? leftEyeX = null;
|
||||
int? leftEyeY = null;
|
||||
int? rightEyeX = null;
|
||||
@ -115,12 +117,32 @@ internal abstract class Face
|
||||
rightEyeX = (int)(from l in facePoints select l.X).Average();
|
||||
rightEyeY = (int)(from l in facePoints select l.Y).Average();
|
||||
}
|
||||
if (facePart is FacePart.BottomLip or FacePart.TopLip)
|
||||
lipY ??= (int)(from l in facePoints select l.X).Average();
|
||||
}
|
||||
if (rightEyeX is null || leftEyeX is null || rightEyeY is null || leftEyeY is null)
|
||||
result = null;
|
||||
(result, review) = (null, null);
|
||||
else
|
||||
{
|
||||
review = lipY < rightEyeY || lipY < leftEyeY;
|
||||
result = Getα(rightEyeX.Value, leftEyeX.Value, rightEyeY.Value, leftEyeY.Value);
|
||||
return result;
|
||||
}
|
||||
return (review, result);
|
||||
}
|
||||
|
||||
internal static (bool, int[]) GetEyeCollection(int threshold, List<Shared.Models.Face> faces)
|
||||
{
|
||||
bool result = false;
|
||||
List<int> results = new();
|
||||
foreach (Shared.Models.Face face in faces)
|
||||
{
|
||||
if (face.Mapping?.MappingFromLocation?.Eyeα is null || face.Mapping.MappingFromLocation.EyeReview is null)
|
||||
continue;
|
||||
results.Add(face.Mapping.MappingFromLocation.Eyeα.Value);
|
||||
if (!result && face.Mapping.MappingFromLocation.EyeReview.Value || face.Mapping.MappingFromLocation.Eyeα.Value > threshold)
|
||||
result = true;
|
||||
}
|
||||
return (result, results.ToArray());
|
||||
}
|
||||
|
||||
}
|
@ -23,9 +23,14 @@ public interface IFace
|
||||
static Models.Face[] GetFaces(string jsonFileFullName) =>
|
||||
Face.GetFaces(jsonFileFullName);
|
||||
|
||||
double? TestStatic_Getα(Dictionary<FacePart, Models.FacePoint[]> faceParts) =>
|
||||
Getα(faceParts);
|
||||
static double? Getα(Dictionary<FacePart, Models.FacePoint[]> faceParts) =>
|
||||
Face.Getα(faceParts);
|
||||
(bool?, double?) TestStatic_Getα(Dictionary<FacePart, Models.FacePoint[]> faceParts) =>
|
||||
GetEyeα(faceParts);
|
||||
static (bool?, double?) GetEyeα(Dictionary<FacePart, Models.FacePoint[]> faceParts) =>
|
||||
Face.GetEyeα(faceParts);
|
||||
|
||||
(bool, int[]) TestStatic_GetEyeCollection(int threshold, List<Shared.Models.Face> faces) =>
|
||||
GetEyeCollection(threshold, faces);
|
||||
static (bool, int[]) GetEyeCollection(int threshold, List<Shared.Models.Face> faces) =>
|
||||
Face.GetEyeCollection(threshold, faces);
|
||||
|
||||
}
|
Reference in New Issue
Block a user