feat: Add Face Matcher functionality and related settings
- Implemented FilePathToBitmapConverter for image loading. - Enhanced DataModel with commands and properties for Face Matcher. - Created FaceMatcherResultItem model to store results. - Updated SettingsDto to include Face Matcher paths and tolerance. - Introduced PickerPreferenceService for managing folder paths. - Expanded AiSettingsViewModel to manage Face Matcher settings and results.
This commit is contained in:
parent
f57dc1edba
commit
c261557a29
10 changed files with 2041 additions and 192 deletions
31
imagecatalog/Converters/FilePathToBitmapConverter.cs
Normal file
31
imagecatalog/Converters/FilePathToBitmapConverter.cs
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
using System;
|
||||
using System.Globalization;
|
||||
using Avalonia.Data.Converters;
|
||||
using Avalonia.Media.Imaging;
|
||||
|
||||
namespace ImageCatalog_2.Converters;
|
||||
|
||||
public sealed class FilePathToBitmapConverter : IValueConverter
|
||||
{
|
||||
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||
{
|
||||
if (value is not string path || string.IsNullOrWhiteSpace(path))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
return new Bitmap(path);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue