探测器设置界面增加图像灰度直方图,用于显示实时采集图像的灰度信息,优化图像灰度直方图的显示方式(无图像提示)和优化资源释放。

This commit is contained in:
QI Mingxuan
2026-05-18 14:41:05 +08:00
parent a9d56ebfbd
commit ed0fe92cbe
9 changed files with 131 additions and 6 deletions
@@ -219,10 +219,24 @@ namespace XP.Common.Controls.ImageHistogram
// 取消帧率限流器中的待处理任务 | Cancel pending tasks in throttler
_frameThrottler.Cancel();
// 清空图表 | Clear chart
if (_chartRenderer != null)
// 清空图表(捕获局部引用避免异步执行时为 null| Clear chart (capture local ref to avoid null during async)
var renderer = _chartRenderer;
if (renderer != null)
{
Dispatcher.InvokeAsync(() => _chartRenderer.Clear());
Dispatcher.InvokeAsync(() =>
{
try
{
renderer.Clear();
// 显示无数据提示 | Show no-data placeholder
NoDataPlaceholder.Visibility = Visibility.Visible;
}
catch
{
// 控件已卸载时忽略 | Ignore if control already unloaded
}
});
}
}
catch (Exception ex)
@@ -259,6 +273,9 @@ namespace XP.Common.Controls.ImageHistogram
{
isLog = IsLogarithmic;
_chartRenderer?.UpdateData(histogram, isLog);
// 隐藏无数据提示 | Hide no-data placeholder
NoDataPlaceholder.Visibility = Visibility.Collapsed;
}
catch (Exception ex)
{