Force Single Image => Sorting

This commit is contained in:
2022-10-01 21:19:43 -07:00
parent 3899cf6b4c
commit 9b8e3bdf55
10 changed files with 376 additions and 283 deletions

View File

@ -1,8 +1,10 @@
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Imaging;
using System.Reflection;
using System.Text.Json;
using System.Text.Json.Serialization;
using View_by_Distance.Face.Models.Stateless;
using View_by_Distance.FaceRecognitionDotNet;
using View_by_Distance.Metadata.Models;
using View_by_Distance.Property.Models;
@ -34,7 +36,6 @@ public class D_Face
private readonly bool _RetryImagesWithoutAFace;
private readonly Configuration _Configuration;
private readonly int _NumberOfTimesToUpsample;
private readonly int _FaceDistanceAreaPermilleTolerance;
private readonly ImageCodecInfo _ImageCodecInfo;
private readonly ModelParameter _ModelParameter;
private readonly PredictorModel _PredictorModel;
@ -44,6 +45,7 @@ public class D_Face
private readonly int _FaceDistanceHiddenImageFactor;
private readonly EncoderParameters _EncoderParameters;
private readonly ImageCodecInfo _HiddenImageCodecInfo;
private readonly int _FaceDistanceAreaPermilleTolerance;
private readonly bool _ForceFaceLastWriteTimeToCreationTime;
private readonly EncoderParameters _HiddenEncoderParameters;
private readonly JsonSerializerOptions _WriteIndentedAndWhenWritingNull;
@ -190,6 +192,8 @@ public class D_Face
private List<Shared.Models.Face> GetFaces(Shared.Models.Property property, MappingFromItem mappingFromItem, int outputResolutionWidth, int outputResolutionHeight, int outputResolutionOrientation)
{
if (_Log is null)
throw new NullReferenceException(nameof(_Log));
List<Shared.Models.Face> results = new();
FaceRecognitionDotNet.Image? unknownImage;
if (!mappingFromItem.ResizedFileHolder.Exists)
@ -199,7 +203,10 @@ public class D_Face
try
{ unknownImage = FaceRecognition.LoadImageFile(mappingFromItem.ResizedFileHolder.FullName); }
catch (Exception)
{ unknownImage = null; }
{
unknownImage = null;
_Log.Info(string.Concat(new StackFrame().GetMethod()?.Name, " <", mappingFromItem.ResizedFileHolder.FullName, ">"));
}
}
if (unknownImage is null)
results.Add(new(property, outputResolutionWidth, outputResolutionHeight, outputResolutionOrientation, mappingFromItem.RelativePath, location: null));