Face Distance Area Permille Tolerance
This commit is contained in:
@ -35,13 +35,15 @@ public class MappingFromItem : Properties.IMappingFromItem
|
||||
public class MappingFromLocation : Properties.IMappingFromLocation
|
||||
{
|
||||
|
||||
public double AreaPermille { init; get; }
|
||||
public double Confidence { init; get; }
|
||||
public string DeterministicHashCodeKey { init; get; }
|
||||
public int NormalizedPixelPercentage { init; get; }
|
||||
|
||||
[JsonConstructor]
|
||||
public MappingFromLocation(double confidence, string deterministicHashCodeKey, int normalizedPixelPercentage)
|
||||
public MappingFromLocation(int areaPermille, double confidence, string deterministicHashCodeKey, int normalizedPixelPercentage)
|
||||
{
|
||||
AreaPermille = areaPermille;
|
||||
Confidence = confidence;
|
||||
DeterministicHashCodeKey = deterministicHashCodeKey;
|
||||
NormalizedPixelPercentage = normalizedPixelPercentage;
|
||||
|
@ -15,6 +15,7 @@ public interface IMappingFromItem
|
||||
public interface IMappingFromLocation
|
||||
{
|
||||
|
||||
public double AreaPermille { init; get; }
|
||||
public double Confidence { init; get; }
|
||||
public string DeterministicHashCodeKey { init; get; }
|
||||
public int NormalizedPixelPercentage { init; get; }
|
||||
|
@ -8,6 +8,21 @@ public interface IMapping
|
||||
static (string?, string?, string?, bool?) GetSegments(string facesFileNameExtension, string fileName)
|
||||
=> Mapping.GetSegments(facesFileNameExtension, fileName);
|
||||
|
||||
int TestStatic_GetAreaPermille(int height, Models.Location location, int width)
|
||||
=> GetAreaPermille(height, location, width);
|
||||
static int GetAreaPermille(int height, Models.Location location, int width)
|
||||
=> Mapping.GetAreaPermille(location.Bottom, height, location.Left, location.Right, location.Top, width);
|
||||
|
||||
int TestStatic_GetAreaPermille(int bottom, int height, int left, int right, int top, int width)
|
||||
=> GetAreaPermille(bottom, height, left, right, top, width);
|
||||
static int GetAreaPermille(int bottom, int height, int left, int right, int top, int width)
|
||||
=> Mapping.GetAreaPermille(bottom, height, left, right, top, width);
|
||||
|
||||
int TestStatic_GetAreaPermille(Models.Location location, OutputResolution outputResolution)
|
||||
=> GetAreaPermille(location, outputResolution);
|
||||
static int GetAreaPermille(Models.Location location, OutputResolution outputResolution)
|
||||
=> Mapping.GetAreaPermille(location.Bottom, outputResolution.Height, location.Left, location.Right, location.Top, outputResolution.Width);
|
||||
|
||||
string TestStatic_GetDeterministicHashCodeKey(int id, Models.Location location, int locationDigits, int locationFactor, OutputResolution outputResolution)
|
||||
=> GetDeterministicHashCodeKey(id, location, locationDigits, locationFactor, outputResolution);
|
||||
static string GetDeterministicHashCodeKey(int id, Models.Location location, int locationDigits, int locationFactor, OutputResolution outputResolution)
|
||||
|
@ -78,4 +78,13 @@ internal abstract class Mapping
|
||||
return new(id, normalizedPixelPercentage, faces);
|
||||
}
|
||||
|
||||
internal static int GetAreaPermille(int bottom, int height, int left, int right, int top, int width)
|
||||
{
|
||||
int result;
|
||||
double area = width * height;
|
||||
double locationArea = (right - left) * (bottom - top);
|
||||
result = (int)Math.Round(locationArea / area * 1000, 0);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user