Rename-isWrongYear
EyeThreshold
This commit is contained in:
@ -9,14 +9,18 @@ public class MappingFromLocation : Properties.IMappingFromLocation
|
||||
public int AreaPermyriad { init; get; }
|
||||
public int ConfidencePercent { init; get; }
|
||||
public string DeterministicHashCodeKey { init; get; }
|
||||
public int? Eyeα { init; get; }
|
||||
public bool? EyeReview { init; get; }
|
||||
public int WholePercentages { init; get; }
|
||||
|
||||
[JsonConstructor]
|
||||
public MappingFromLocation(int areaPermyriad, int confidencePercent, string deterministicHashCodeKey, int wholePercentages)
|
||||
public MappingFromLocation(int areaPermyriad, int confidencePercent, string deterministicHashCodeKey, int? eyeα, bool? eyeReview, int wholePercentages)
|
||||
{
|
||||
AreaPermyriad = areaPermyriad;
|
||||
ConfidencePercent = confidencePercent;
|
||||
DeterministicHashCodeKey = deterministicHashCodeKey;
|
||||
Eyeα = eyeα;
|
||||
EyeReview = eyeReview;
|
||||
WholePercentages = wholePercentages;
|
||||
}
|
||||
|
||||
|
@ -6,6 +6,8 @@ public interface IMappingFromLocation
|
||||
public int AreaPermyriad { init; get; }
|
||||
public int ConfidencePercent { init; get; }
|
||||
public string DeterministicHashCodeKey { init; get; }
|
||||
public int? Eyeα { init; get; }
|
||||
public bool? EyeReview { init; get; }
|
||||
public int WholePercentages { init; get; }
|
||||
|
||||
}
|
||||
|
@ -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