IgnoreExtensions-nef
Config-LoadPhotoPrismLocations TestMethodIntersect
This commit is contained in:
@ -34,12 +34,14 @@ public class D_Face
|
||||
private readonly Serilog.ILogger? _Log;
|
||||
private readonly bool _OverrideForFaceImages;
|
||||
private readonly Configuration _Configuration;
|
||||
private readonly bool _LoadPhotoPrismLocations;
|
||||
private readonly ImageCodecInfo _ImageCodecInfo;
|
||||
private readonly ModelParameter _ModelParameter;
|
||||
private readonly PredictorModel _PredictorModel;
|
||||
private readonly bool _CheckDFaceAndUpWriteDates;
|
||||
private readonly bool _PropertiesChangedForFaces;
|
||||
private readonly ConstructorInfo _ConstructorInfo;
|
||||
private readonly float _RectangleIntersectMinimum;
|
||||
private readonly int _FaceDistanceHiddenImageFactor;
|
||||
private readonly EncoderParameters _EncoderParameters;
|
||||
private readonly ImageCodecInfo _HiddenImageCodecInfo;
|
||||
@ -59,11 +61,13 @@ public class D_Face
|
||||
string hiddenFileNameExtension,
|
||||
ImageCodecInfo hiddenImageCodecInfo,
|
||||
ImageCodecInfo imageCodecInfo,
|
||||
bool loadPhotoPrismLocations,
|
||||
string modelDirectory,
|
||||
string modelName,
|
||||
bool overrideForFaceImages,
|
||||
string predictorModelName,
|
||||
bool propertiesChangedForFaces)
|
||||
bool propertiesChangedForFaces,
|
||||
float[] rectangleIntersectMinimums)
|
||||
{
|
||||
_ArgZero = argZero;
|
||||
_Configuration = configuration;
|
||||
@ -76,17 +80,17 @@ public class D_Face
|
||||
_OverrideForFaceImages = overrideForFaceImages;
|
||||
_HiddenEncoderParameters = hiddenEncoderParameters;
|
||||
_HiddenFileNameExtension = hiddenFileNameExtension;
|
||||
_LoadPhotoPrismLocations = loadPhotoPrismLocations;
|
||||
_CheckDFaceAndUpWriteDates = checkDFaceAndUpWriteDates;
|
||||
_PropertiesChangedForFaces = propertiesChangedForFaces;
|
||||
_RectangleIntersectMinimum = rectangleIntersectMinimums.Min();
|
||||
_FaceDistanceHiddenImageFactor = faceDistanceHiddenImageFactor;
|
||||
_ForceFaceLastWriteTimeToCreationTime = forceFaceLastWriteTimeToCreationTime;
|
||||
(Model model, PredictorModel predictorModel, ModelParameter modelParameter) = GetModel(modelDirectory, modelName, predictorModelName);
|
||||
_Model = model;
|
||||
_PredictorModel = predictorModel;
|
||||
_ModelParameter = modelParameter;
|
||||
ConstructorInfo? constructorInfo = typeof(PropertyItem).GetConstructor(BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Public, null, Array.Empty<Type>(), null);
|
||||
if (constructorInfo is null)
|
||||
throw new Exception();
|
||||
ConstructorInfo? constructorInfo = typeof(PropertyItem).GetConstructor(BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Public, null, Array.Empty<Type>(), null) ?? throw new Exception();
|
||||
_ConstructorInfo = constructorInfo;
|
||||
_WriteIndentedAndWhenWritingNull = new JsonSerializerOptions { WriteIndented = true, DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull };
|
||||
}
|
||||
@ -294,7 +298,7 @@ public class D_Face
|
||||
|
||||
#pragma warning restore CA1416
|
||||
|
||||
private static List<LocationContainer<MetadataExtractor.Directory>> GetCollection(string outputResolution, List<LocationContainer<MetadataExtractor.Directory>> collection, Dictionary<string, int[]> outputResolutionToResize, List<Shared.Models.Face> faces)
|
||||
private static List<LocationContainer<MetadataExtractor.Directory>> GetLocationContainers(string outputResolution, List<LocationContainer<MetadataExtractor.Directory>> locationContainers, Dictionary<string, int[]> outputResolutionToResize, List<Shared.Models.Face> faces)
|
||||
{
|
||||
List<LocationContainer<MetadataExtractor.Directory>> results = new();
|
||||
string? json;
|
||||
@ -309,7 +313,7 @@ public class D_Face
|
||||
continue;
|
||||
skip.Add(Shared.Models.Stateless.Methods.ILocation.GetWholePercentages(face.Location, ILocation.Digits, face.OutputResolution));
|
||||
}
|
||||
foreach (LocationContainer<MetadataExtractor.Directory> locationContainer in collection)
|
||||
foreach (LocationContainer<MetadataExtractor.Directory> locationContainer in locationContainers)
|
||||
{
|
||||
if (locationContainer.Directories is null)
|
||||
continue;
|
||||
@ -340,7 +344,7 @@ public class D_Face
|
||||
return results;
|
||||
}
|
||||
|
||||
public List<Shared.Models.Face> GetFaces(string outputResolution, string dResultsFullGroupDirectory, List<Tuple<string, DateTime>> subFileTuples, List<string> parseExceptions, Shared.Models.Property property, MappingFromItem mappingFromItem, Dictionary<string, int[]> outputResolutionToResize, List<LocationContainer<MetadataExtractor.Directory>>? collection, List<MappingFromPhotoPrism>? mappingFromPhotoPrismCollection)
|
||||
public List<Shared.Models.Face> GetFaces(string outputResolution, string dResultsFullGroupDirectory, List<Tuple<string, DateTime>> subFileTuples, List<string> parseExceptions, Shared.Models.Property property, MappingFromItem mappingFromItem, Dictionary<string, int[]> outputResolutionToResize, List<LocationContainer<MetadataExtractor.Directory>>? locationContainers, List<MappingFromPhotoPrism>? mappingFromPhotoPrismCollection)
|
||||
{
|
||||
List<Shared.Models.Face>? results;
|
||||
if (string.IsNullOrEmpty(dResultsFullGroupDirectory))
|
||||
@ -383,15 +387,15 @@ public class D_Face
|
||||
parseExceptions.Add(nameof(D_Face));
|
||||
}
|
||||
}
|
||||
List<LocationContainer<MetadataExtractor.Directory>> locationContainers;
|
||||
if (results is null || collection is null)
|
||||
locationContainers = new();
|
||||
List<LocationContainer<MetadataExtractor.Directory>> collection;
|
||||
if (results is null || locationContainers is null)
|
||||
collection = new();
|
||||
else
|
||||
locationContainers = GetCollection(outputResolution, collection, outputResolutionToResize, results);
|
||||
if (mappingFromPhotoPrismCollection is null || results is null)
|
||||
locations = (from l in locationContainers where l is not null select l.Location).ToList();
|
||||
collection = GetLocationContainers(outputResolution, locationContainers, outputResolutionToResize, results);
|
||||
if (!_LoadPhotoPrismLocations || mappingFromPhotoPrismCollection is null || results is null)
|
||||
locations = (from l in collection where l is not null select l.Location).ToList();
|
||||
else
|
||||
locations = Shared.Models.Stateless.Methods.ILocation.GetLocations(mappingFromPhotoPrismCollection, results, locationContainers);
|
||||
locations = Shared.Models.Stateless.Methods.ILocation.GetLocations(collection, results, mappingFromPhotoPrismCollection, _RectangleIntersectMinimum);
|
||||
if (results is null || (locations is not null && locations.Any()))
|
||||
{
|
||||
results = GetFaces(outputResolution, property, mappingFromItem, outputResolutionToResize, locations);
|
||||
|
Reference in New Issue
Block a user