Get Unable to Match Count and Rename Matches

This commit is contained in:
2022-09-24 16:39:15 -07:00
parent e64c713926
commit 751a61529c
32 changed files with 983 additions and 668 deletions

View File

@ -9,20 +9,18 @@ public class Location : Properties.ILocation, IEquatable<Location>
public int Bottom { init; get; }
public double Confidence { init; get; }
public int Left { init; get; }
public int? NormalizedPixelPercentage { init; get; }
public int Right { init; get; }
public int Top { init; get; }
[JsonConstructor]
public Location(int bottom, double confidence, int left, int? normalizedPixelPercentage, int right, int top)
public Location(int bottom, double confidence, int left, int right, int top)
{
Confidence = confidence;
Bottom = bottom;
Left = left;
NormalizedPixelPercentage = normalizedPixelPercentage;
Right = right;
Top = top;
Stateless.Methods.Location.Check(bottom, left, normalizedPixelPercentage, right, top, zCount: 1);
Stateless.Methods.Location.Check(bottom, left, right, top, zCount: 1);
}
public Location(double confidence, int height, Location location, int locationDigits, int locationFactor, int width, int zCount) :
@ -30,30 +28,27 @@ public class Location : Properties.ILocation, IEquatable<Location>
location.Bottom,
confidence,
location.Left,
Stateless.Methods.Location.GetNormalizedPixelPercentage(location.Bottom, height, location.Left, locationDigits, locationFactor, location.Right, location.Top, width, zCount),
location.Right,
location.Top) =>
Stateless.Methods.Location.Check(Bottom, Left, NormalizedPixelPercentage, Right, Top, zCount);
Stateless.Methods.Location.Check(Bottom, height, Left, Right, Top, width, zCount);
public Location(int bottom, double confidence, int height, int left, int locationDigits, int locationFactor, int right, int top, int width, int zCount) :
this(
bottom,
confidence,
left,
Stateless.Methods.Location.GetNormalizedPixelPercentage(bottom, height, left, locationDigits, locationFactor, right, top, width, zCount),
right,
top) =>
Stateless.Methods.Location.Check(Bottom, height, Left, NormalizedPixelPercentage, Right, Top, width, zCount);
Stateless.Methods.Location.Check(Bottom, height, Left, Right, Top, width, zCount);
public Location(int height, Location location, int locationDigits, int locationFactor, int width, int zCount) :
this(
location.Bottom,
location.Confidence,
location.Left,
Stateless.Methods.Location.GetNormalizedPixelPercentage(location.Bottom, height, location.Left, locationDigits, locationFactor, location.Right, location.Top, width, zCount),
location.Right,
location.Top) =>
Stateless.Methods.Location.Check(Bottom, Left, NormalizedPixelPercentage, Right, Top, zCount);
Stateless.Methods.Location.Check(Bottom, height, Left, Right, Top, width, zCount);
public Location(double confidence, int factor, int height, Location location, int locationDigits, int locationFactor, int width, int zCount)
{
@ -63,14 +58,10 @@ public class Location : Properties.ILocation, IEquatable<Location>
int left = Math.Max(location.Left - x, 0);
int right = Math.Min(location.Right + x, width);
int top = Math.Max(location.Top - y, 0);
int normalizedPixelPercentage = Stateless.Methods.Location.GetNormalizedPixelPercentage(location.Bottom, height, location.Left, locationDigits, locationFactor, location.Right, location.Top, width, zCount);
if (location.NormalizedPixelPercentage is null || normalizedPixelPercentage != location.NormalizedPixelPercentage.Value)
throw new Exception();
Stateless.Methods.Location.Check(bottom, left, NormalizedPixelPercentage, right, top, zCount);
Stateless.Methods.Location.Check(Bottom, height, Left, Right, Top, width, zCount);
Confidence = confidence;
Bottom = bottom;
Left = left;
NormalizedPixelPercentage = normalizedPixelPercentage;
Right = right;
Top = top;
}