Rename
editorconfig
This commit is contained in:
@ -71,15 +71,13 @@ public class FaceRecognition : DisposableObject
|
||||
|
||||
private static FacePoint[] Join(IEnumerable<FacePoint> facePoints1, IEnumerable<FacePoint> facePoints2)
|
||||
{
|
||||
List<FacePoint> results = new();
|
||||
results.AddRange(facePoints1);
|
||||
results.AddRange(facePoints2);
|
||||
List<FacePoint> results = [.. facePoints1, .. facePoints2];
|
||||
return results.ToArray();
|
||||
}
|
||||
|
||||
private List<(FacePart, FacePoint[])> GetFaceParts(FullObjectDetection fullObjectDetection)
|
||||
{
|
||||
List<(FacePart, FacePoint[])> results = new();
|
||||
List<(FacePart, FacePoint[])> results = [];
|
||||
FacePoint[] facePoints = Enumerable.Range(0, (int)fullObjectDetection.Parts)
|
||||
.Select(index => new FacePoint(index, fullObjectDetection.GetPart((uint)index).X, fullObjectDetection.GetPart((uint)index).Y))
|
||||
.ToArray();
|
||||
@ -141,7 +139,7 @@ public class FaceRecognition : DisposableObject
|
||||
throw new NullReferenceException(nameof(image));
|
||||
image.ThrowIfDisposed();
|
||||
ThrowIfDisposed();
|
||||
List<Location> results = new();
|
||||
List<Location> results = [];
|
||||
System.Drawing.Rectangle rectangle;
|
||||
IEnumerable<MModRect> mModRects = GetMModRects(image);
|
||||
foreach (MModRect? mModRect in mModRects)
|
||||
@ -156,7 +154,7 @@ public class FaceRecognition : DisposableObject
|
||||
|
||||
private List<FullObjectDetection> GetFullObjectDetections(Image image, List<Location> locations)
|
||||
{
|
||||
List<FullObjectDetection> results = new();
|
||||
List<FullObjectDetection> results = [];
|
||||
if (_PredictorModel == PredictorModel.Custom)
|
||||
{
|
||||
if (CustomFaceLandmarkDetector is null)
|
||||
@ -182,9 +180,9 @@ public class FaceRecognition : DisposableObject
|
||||
|
||||
private List<Location> GetLocations(Image image)
|
||||
{
|
||||
List<Location> results = new();
|
||||
List<Location> results = [];
|
||||
MModRect[] mModRects = GetMModRects(image);
|
||||
if (mModRects.Any())
|
||||
if (mModRects.Length != 0)
|
||||
{
|
||||
Location location;
|
||||
System.Drawing.Rectangle rectangle;
|
||||
@ -201,7 +199,7 @@ public class FaceRecognition : DisposableObject
|
||||
|
||||
public List<(Location, FaceEncoding?, Dictionary<FacePart, FacePoint[]>?)> GetCollection(Image image, List<Location>? locations, bool includeFaceEncoding, bool includeFaceParts)
|
||||
{
|
||||
List<(Location, FaceEncoding?, Dictionary<FacePart, FacePoint[]>?)> results = new();
|
||||
List<(Location, FaceEncoding?, Dictionary<FacePart, FacePoint[]>?)> results = [];
|
||||
if (image is null)
|
||||
throw new NullReferenceException(nameof(image));
|
||||
image.ThrowIfDisposed();
|
||||
@ -210,14 +208,14 @@ public class FaceRecognition : DisposableObject
|
||||
throw new NotSupportedException("FaceRecognition.PredictorModel.Custom is not supported.");
|
||||
if (locations is null)
|
||||
locations = GetLocations(image);
|
||||
else if (!locations.Any())
|
||||
else if (locations.Count == 0)
|
||||
locations.AddRange(GetLocations(image));
|
||||
List<FullObjectDetection> fullObjectDetections = GetFullObjectDetections(image, locations);
|
||||
if (fullObjectDetections.Count != locations.Count)
|
||||
throw new Exception();
|
||||
List<(Location Location, List<FaceEncoding?> FaceEncodings, List<List<(FacePart, FacePoint[])>> FaceParts)> collection = new();
|
||||
List<(Location Location, List<FaceEncoding?> FaceEncodings, List<List<(FacePart, FacePoint[])>> FaceParts)> collection = [];
|
||||
foreach (Location location in locations)
|
||||
collection.Add(new(location, new(), new()));
|
||||
collection.Add(new(location, [], []));
|
||||
if (locations.Count != collection.Count)
|
||||
throw new Exception();
|
||||
if (!includeFaceEncoding)
|
||||
@ -239,7 +237,7 @@ public class FaceRecognition : DisposableObject
|
||||
if (!includeFaceParts)
|
||||
{
|
||||
for (int i = 0; i < collection.Count; i++)
|
||||
collection[i].FaceParts.Add(new());
|
||||
collection[i].FaceParts.Add([]);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -258,11 +256,11 @@ public class FaceRecognition : DisposableObject
|
||||
{
|
||||
if (faceEncodings.Count != 1 || faceParts.Count != 1)
|
||||
continue;
|
||||
if (!faceParts[indexZero].Any())
|
||||
if (faceParts[indexZero].Count == 0)
|
||||
results.Add(new(location, faceEncodings[indexZero], null));
|
||||
else
|
||||
{
|
||||
keyValuePairs = new();
|
||||
keyValuePairs = [];
|
||||
foreach ((FacePart facePart, FacePoint[] facePoints) in faceParts[indexZero])
|
||||
keyValuePairs.Add(facePart, facePoints);
|
||||
results.Add(new(location, faceEncodings[indexZero], keyValuePairs));
|
||||
@ -412,7 +410,7 @@ public class FaceRecognition : DisposableObject
|
||||
|
||||
public static List<FaceDistance> FaceDistances(ReadOnlyCollection<FaceDistance> faceDistances, FaceDistance faceDistanceToCompare)
|
||||
{
|
||||
List<FaceDistance> results = new();
|
||||
List<FaceDistance> results = [];
|
||||
if (faceDistances is null)
|
||||
throw new NullReferenceException(nameof(faceDistances));
|
||||
if (faceDistances.Count != 0)
|
||||
|
Reference in New Issue
Block a user