FocusModel
This commit is contained in:
@ -232,20 +232,20 @@ public partial class UnitTestCalculations
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestAreaPermille()
|
||||
public void TestAreaPermyriad()
|
||||
{
|
||||
int faceAreaPermille = 1000;
|
||||
int faceAreaPermyriad = 10000;
|
||||
Location location;
|
||||
double confidence = 0.1D;
|
||||
int areaPermille, left, top, right, bottom, width, height;
|
||||
int areaPermyriad, left, top, right, bottom, width, height;
|
||||
left = 0;
|
||||
right = 100;
|
||||
top = 0;
|
||||
bottom = 100;
|
||||
width = 100;
|
||||
height = 100;
|
||||
areaPermille = IMapping.GetAreaPermille(faceAreaPermille, bottom, height, left, right, top, width);
|
||||
Assert.IsTrue(areaPermille == 1000);
|
||||
areaPermyriad = IMapping.GetAreaPermyriad(faceAreaPermyriad, bottom, height, left, right, top, width);
|
||||
Assert.IsTrue(areaPermyriad == 1000);
|
||||
left = 0;
|
||||
right = 50;
|
||||
top = 0;
|
||||
@ -253,8 +253,8 @@ public partial class UnitTestCalculations
|
||||
width = 100;
|
||||
height = 100;
|
||||
location = new(bottom, confidence, height, left, Shared.Models.Stateless.ILocation.Digits, Shared.Models.Stateless.ILocation.Factor, right, top, width, 1);
|
||||
areaPermille = IMapping.GetAreaPermille(faceAreaPermille, height, location, width);
|
||||
Assert.IsTrue(areaPermille == 250);
|
||||
areaPermyriad = IMapping.GetAreaPermyriad(faceAreaPermyriad, height, location, width);
|
||||
Assert.IsTrue(areaPermyriad == 250);
|
||||
left = 0;
|
||||
right = 25;
|
||||
top = 0;
|
||||
@ -263,8 +263,8 @@ public partial class UnitTestCalculations
|
||||
height = 100;
|
||||
location = new(bottom, confidence, height, left, Shared.Models.Stateless.ILocation.Digits, Shared.Models.Stateless.ILocation.Factor, right, top, width, 1);
|
||||
OutputResolution outputResolution = new(height, 0, width);
|
||||
areaPermille = IMapping.GetAreaPermille(faceAreaPermille, location, outputResolution);
|
||||
Assert.IsTrue(areaPermille == 62);
|
||||
areaPermyriad = IMapping.GetAreaPermyriad(faceAreaPermyriad, location, outputResolution);
|
||||
Assert.IsTrue(areaPermyriad == 62);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
@ -371,24 +371,24 @@ public partial class UnitTestCalculations
|
||||
public void TestGetConfidencePercent()
|
||||
{
|
||||
int faceConfidencePercent = 100;
|
||||
double minimum, target, maximum, value, check;
|
||||
float minimum, target, maximum, value, check;
|
||||
minimum = 0.8f;
|
||||
target = 0.8f;
|
||||
maximum = int.MaxValue;
|
||||
value = 0f;
|
||||
check = ILocation.GetConfidencePercent(faceConfidencePercent, new double[] { minimum, target, maximum }, value);
|
||||
check = ILocation.GetConfidencePercent(faceConfidencePercent, new float[] { minimum, target, maximum }, value);
|
||||
Assert.IsTrue(check == 0);
|
||||
target = 0.8f;
|
||||
value = 0.4f;
|
||||
check = ILocation.GetConfidencePercent(faceConfidencePercent, new double[] { minimum, target, maximum }, value);
|
||||
check = ILocation.GetConfidencePercent(faceConfidencePercent, new float[] { minimum, target, maximum }, value);
|
||||
Assert.IsTrue(check == 50);
|
||||
target = 0.8f;
|
||||
value = 0.8f;
|
||||
check = ILocation.GetConfidencePercent(faceConfidencePercent, new double[] { minimum, target, maximum }, value);
|
||||
check = ILocation.GetConfidencePercent(faceConfidencePercent, new float[] { minimum, target, maximum }, value);
|
||||
Assert.IsTrue(check == 100);
|
||||
target = 0.8f;
|
||||
value = 1.6f;
|
||||
check = ILocation.GetConfidencePercent(faceConfidencePercent, new double[] { minimum, target, maximum }, value);
|
||||
check = ILocation.GetConfidencePercent(faceConfidencePercent, new float[] { minimum, target, maximum }, value);
|
||||
Assert.IsTrue(check == 200);
|
||||
}
|
||||
|
||||
|
@ -137,7 +137,6 @@ public class UnitTestResize
|
||||
bool reverse = false;
|
||||
FileHolder resizedFileHolder;
|
||||
List<string> parseExceptions = new();
|
||||
const bool isIgnoreRelativePath = false;
|
||||
Shared.Models.Property? property = null;
|
||||
const bool isValidImageFormatExtension = true;
|
||||
Dictionary<string, int[]> outputResolutionToResize;
|
||||
@ -176,7 +175,7 @@ public class UnitTestResize
|
||||
throw new NullReferenceException(nameof(property));
|
||||
resizedFileHolder = resize.GetResizedFileHolder(item);
|
||||
item.SetResizedFileHolder(resize.FileNameExtension, resizedFileHolder);
|
||||
MappingFromItem mappingFromItem = IMappingFromItem.GetMappingFromItem(item, isIgnoreRelativePath);
|
||||
MappingFromItem mappingFromItem = IMappingFromItem.GetMappingFromItem(item);
|
||||
(int _, metadataCollection) = metadata.GetMetadataCollection(subFileTuples, parseExceptions, mappingFromItem);
|
||||
outputResolutionToResize = resize.GetResizeKeyValuePairs(_Configuration.PropertyConfiguration, cResultsFullGroupDirectory, subFileTuples, parseExceptions, metadataCollection, item.Property, mappingFromItem);
|
||||
Assert.IsNotNull(mappingFromItem.ResizedFileHolder);
|
||||
|
Reference in New Issue
Block a user