40 lines
2.7 KiB
C#
40 lines
2.7 KiB
C#
namespace View_by_Distance.Shared.Models.Stateless.Methods;
|
|
|
|
public interface ILocation
|
|
{ // ...
|
|
|
|
Models.Location? TestStatic_GetLocation(Models.Location? location, int locationDigits, int locationFactor, int height, int width, int zCount) =>
|
|
GetLocation(location, locationDigits, locationFactor, height, width, zCount);
|
|
static Models.Location? GetLocation(Models.Location? location, int locationDigits, int locationFactor, int height, int width, int zCount) =>
|
|
location is null ? null : new(location.Confidence, height, location, locationDigits, locationFactor, width, zCount);
|
|
|
|
Models.Location? TestStatic_GetLocation(int factor, Models.Location? location, int locationDigits, int locationFactor, int height, int width, int zCount) =>
|
|
GetLocation(location, locationDigits, locationFactor, height, width, zCount);
|
|
static Models.Location? GetLocation(int factor, Models.Location? location, int locationDigits, int locationFactor, int height, int width, int zCount) =>
|
|
location is null ? null : new(location.Confidence, factor, height, location, locationDigits, locationFactor, width, zCount);
|
|
|
|
int?[] TestStatic_GetInts(List<Models.Location> locations) =>
|
|
GetInts(locations);
|
|
static int?[] GetInts(List<Models.Location> locations) =>
|
|
(from l in locations where l.NormalizedPixelPercentage is not null select l.NormalizedPixelPercentage).ToArray();
|
|
|
|
int TestStatic_GetNormalizedPixelPercentage(int bottom, int height, int left, int locationDigits, int locationFactor, int right, int top, int width, int zCount) =>
|
|
GetNormalizedPixelPercentage(bottom, height, left, locationDigits, locationFactor, right, top, width, zCount);
|
|
static int GetNormalizedPixelPercentage(int bottom, int height, int left, int locationDigits, int locationFactor, int right, int top, int width, int zCount) =>
|
|
Location.GetNormalizedPixelPercentage(bottom, height, left, locationDigits, locationFactor, right, top, width, zCount);
|
|
|
|
Models.Location TestStatic_GetTrimBound(double detectionConfidence, System.Drawing.Rectangle rectangle, int width, int height, int facesCount) =>
|
|
TrimBound(detectionConfidence, rectangle, width, height, facesCount);
|
|
static Models.Location TrimBound(double detectionConfidence, System.Drawing.Rectangle rectangle, int width, int height, int facesCount) =>
|
|
new(Math.Min(rectangle.Bottom, height),
|
|
detectionConfidence,
|
|
height,
|
|
Math.Max(rectangle.Left, 0),
|
|
Stateless.ILocation.Digits,
|
|
Stateless.ILocation.Factor,
|
|
Math.Min(rectangle.Right, width),
|
|
Math.Max(rectangle.Top, 0),
|
|
width,
|
|
facesCount);
|
|
|
|
} |