Drag Drop sorting by distance attempt
This commit is contained in:
@ -43,6 +43,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\FaceRecognitionDotNet\FaceRecognitionDotNet.csproj" />
|
||||
<ProjectReference Include="..\Metadata\Metadata.csproj" />
|
||||
<ProjectReference Include="..\Property\Property.csproj" />
|
||||
<ProjectReference Include="..\Shared\View-by-Distance.Shared.csproj" />
|
||||
<ProjectReference Include="..\Map\Map.csproj" />
|
||||
|
@ -85,58 +85,6 @@ public partial class E_Distance
|
||||
_Moved.Add(mappedFaceFile);
|
||||
}
|
||||
|
||||
public static string? GetFaceEncoding(string file)
|
||||
{
|
||||
string? result;
|
||||
List<string> results = new();
|
||||
const string comment = "Comment: ";
|
||||
if (File.Exists(file))
|
||||
{
|
||||
IReadOnlyList<MetadataExtractor.Directory> directories = MetadataExtractor.ImageMetadataReader.ReadMetadata(file);
|
||||
foreach (MetadataExtractor.Directory directory in directories)
|
||||
{
|
||||
if (directory.Name != "PNG-tEXt")
|
||||
continue;
|
||||
foreach (MetadataExtractor.Tag tag in directory.Tags)
|
||||
{
|
||||
if (tag.Name != "Textual Data" || string.IsNullOrEmpty(tag.Description))
|
||||
continue;
|
||||
if (!tag.Description.StartsWith(comment))
|
||||
continue;
|
||||
results.Add(tag.Description);
|
||||
}
|
||||
}
|
||||
}
|
||||
result = results.Any() ? results[0][comment.Length..] : null;
|
||||
return result;
|
||||
}
|
||||
|
||||
public static string? GetFaceLocation(string file)
|
||||
{
|
||||
string? result;
|
||||
List<string> results = new();
|
||||
const string artist = "Artist: ";
|
||||
if (File.Exists(file))
|
||||
{
|
||||
IReadOnlyList<MetadataExtractor.Directory> directories = MetadataExtractor.ImageMetadataReader.ReadMetadata(file);
|
||||
foreach (MetadataExtractor.Directory directory in directories)
|
||||
{
|
||||
if (directory.Name != "PNG-tEXt")
|
||||
continue;
|
||||
foreach (MetadataExtractor.Tag tag in directory.Tags)
|
||||
{
|
||||
if (tag.Name != "Textual Data" || string.IsNullOrEmpty(tag.Description))
|
||||
continue;
|
||||
if (!tag.Description.StartsWith(artist))
|
||||
continue;
|
||||
results.Add(tag.Description);
|
||||
}
|
||||
}
|
||||
}
|
||||
result = results.Any() ? results[0][artist.Length..] : null;
|
||||
return result;
|
||||
}
|
||||
|
||||
private FaceDistanceContainer[] GetFaceDistanceContainers(MappingFromItem mappingFromItem, Face[] filteredFaces)
|
||||
{
|
||||
FaceDistanceContainer[] results;
|
||||
@ -221,7 +169,7 @@ public partial class E_Distance
|
||||
return results;
|
||||
}
|
||||
|
||||
static (int?, int?) GetXY(int normalizedPixelPercentage, OutputResolution? outputResolution)
|
||||
private static (int?, int?) GetXY(int normalizedPixelPercentage, OutputResolution? outputResolution)
|
||||
{
|
||||
int? x;
|
||||
int? y;
|
||||
@ -382,7 +330,7 @@ public partial class E_Distance
|
||||
if (_DuplicateMappedFaceFiles.Contains(mappedFaceFileName))
|
||||
continue;
|
||||
checkFaces.Clear();
|
||||
json = GetFaceEncoding(mappedFaceFile);
|
||||
json = Metadata.Models.Stateless.IMetadata.GetFaceEncoding(mappedFaceFile);
|
||||
if (json is null)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(eDistanceContentDirectory) && _DistanceMoveUnableToMatch)
|
||||
@ -402,7 +350,7 @@ public partial class E_Distance
|
||||
if (checkFaces.Count != 1 && _DistancePixelDistanceTolerance > 0)
|
||||
{
|
||||
checkFaces.Clear();
|
||||
json = GetFaceLocation(mappedFaceFile);
|
||||
json = Metadata.Models.Stateless.IMetadata.GetFaceLocation(mappedFaceFile);
|
||||
if (json is not null)
|
||||
checkFaces.AddRange(GetClosestFaceByPixel(filteredFaces, json));
|
||||
else
|
||||
|
Reference in New Issue
Block a user