Change to the Normalized Pixel Percentage Formula

This commit is contained in:
2022-09-22 23:39:58 -07:00
parent 192d2ad776
commit fb1c68e1f5
27 changed files with 426 additions and 451 deletions

View File

@ -73,91 +73,6 @@ public class UnitTestResize
Assert.IsFalse(_PropertyConfiguration is null);
}
[TestMethod]
public void TestGetLocation()
{
double confidence = 0.1D;
int left, top, right, bottom, width, height;
left = 20;
top = 40;
right = 60;
bottom = 80;
width = 100;
height = 100;
Location location = new(bottom, confidence, left, null, right, top);
_ = new Location(confidence, height, location, Shared.Models.Stateless.ILocation.Digits, Shared.Models.Stateless.ILocation.Factor, width, 1);
_ = new Location(bottom, confidence, height, left, Shared.Models.Stateless.ILocation.Digits, Shared.Models.Stateless.ILocation.Factor, right, top, width, 1);
}
[TestMethod]
public void TestGetPixelPercentage()
{
int normalizedPixelPercentage;
int left, top, right, bottom, width, height;
left = 1;
top = 1;
right = 10;
bottom = 10;
width = 100;
height = 100;
normalizedPixelPercentage = Shared.Models.Stateless.Methods.ILocation.GetNormalizedPixelPercentage(bottom, height, left, Shared.Models.Stateless.ILocation.Digits, Shared.Models.Stateless.ILocation.Factor, right, top, width, 1);
Assert.IsTrue(normalizedPixelPercentage == 40500);
left = 50;
top = 50;
right = 60;
bottom = 60;
width = 100;
height = 100;
normalizedPixelPercentage = Shared.Models.Stateless.Methods.ILocation.GetNormalizedPixelPercentage(bottom, height, left, Shared.Models.Stateless.ILocation.Digits, Shared.Models.Stateless.ILocation.Factor, right, top, width, 1);
Assert.IsTrue(normalizedPixelPercentage == 545500);
}
[TestMethod]
public void TestGetPixelPercentageB()
{
int normalizedPixelPercentage;
int left, top, right, bottom, width, height;
left = 240;
top = 240;
right = 260;
bottom = 260;
width = 500;
height = 500;
normalizedPixelPercentage = Shared.Models.Stateless.Methods.ILocation.GetNormalizedPixelPercentage(bottom, height, left, Shared.Models.Stateless.ILocation.Digits, Shared.Models.Stateless.ILocation.Factor, right, top, width, 1);
Assert.IsTrue(normalizedPixelPercentage == 499000);
left = 490;
top = 490;
right = 510;
bottom = 510;
width = 1000;
height = 1000;
normalizedPixelPercentage = Shared.Models.Stateless.Methods.ILocation.GetNormalizedPixelPercentage(bottom, height, left, Shared.Models.Stateless.ILocation.Digits, Shared.Models.Stateless.ILocation.Factor, right, top, width, 1);
Assert.IsTrue(normalizedPixelPercentage == 499500);
}
[TestMethod]
public void TestGetPixelPercentageC()
{
int normalizedPixelPercentage;
int left, top, right, bottom, width, height;
left = 20;
top = 40;
right = 60;
bottom = 80;
width = 100;
height = 100;
normalizedPixelPercentage = Shared.Models.Stateless.Methods.ILocation.GetNormalizedPixelPercentage(bottom, height, left, Shared.Models.Stateless.ILocation.Digits, Shared.Models.Stateless.ILocation.Factor, right, top, width, 1);
Assert.IsTrue(normalizedPixelPercentage == 594000);
left = 20;
top = 40;
right = 60;
bottom = 80;
width = 100;
height = 100;
normalizedPixelPercentage = Shared.Models.Stateless.Methods.ILocation.GetNormalizedPixelPercentage(bottom, height, left, Shared.Models.Stateless.ILocation.Digits, Shared.Models.Stateless.ILocation.Factor, right, top, width, 10);
Assert.IsTrue(normalizedPixelPercentage == 594000);
}
private Property.Models.A_Property GetPropertyLogic(bool reverse, Model? model, PredictorModel? predictorModel)
{
Property.Models.A_Property result;