24 lines
654 B
C#
24 lines
654 B
C#
using System.Globalization;
|
|
using Avalonia.Data.Converters;
|
|
using OpenCvSharp;
|
|
using VisionBuilder.UI.Avalonia.Uno.Services;
|
|
|
|
namespace VisionBuilder.UI.Avalonia.Uno.Converters;
|
|
|
|
public class MatToBitmapConverter : IValueConverter
|
|
{
|
|
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
|
{
|
|
if (value is Mat mat && !mat.Empty())
|
|
{
|
|
return ImageConverter.MatToAvaloniaBitmap(mat);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
}
|