This commit is contained in:
tanglong 2026-02-28 09:17:18 +08:00
parent c6c50f3d6a
commit cd61e4a36a

View File

@ -215,11 +215,12 @@ namespace Wpf_AiSportsMicrospace.Common
LoadGifToCache(relativePath);
return _cache.GetValueOrDefault(relativePath);
}
public static List<StudentInfoDto> FacialRecognition(byte[] buffer, double[] xNorms)
{
try
{
if (xNorms == null || xNorms.Length == 0)
throw new ArgumentException("xNorms 不能为空");
return null; // 不再抛异常,直接返回 null
using var image = SharpImage.Image.Load<Rgba32>(buffer);
@ -271,7 +272,6 @@ namespace Wpf_AiSportsMicrospace.Common
Console.WriteLine($"[{i + 1}] 范围: {xStart:0.00}-{xEnd:0.00}, 宽: {w}");
// === 同步调用人脸识别接口 ===
var result = FaceRecognitionAsync(base64);
if (result != null)
@ -280,7 +280,12 @@ namespace Wpf_AiSportsMicrospace.Common
return studentInfos;
}
catch (Exception ex)
{
Console.WriteLine($"FacialRecognition 异常: {ex.Message}");
return null;
}
}
/// <summary>
/// 调用人脸识别接口,返回学生信息