Commit c1db4d55 by liulongfei

1. 样式调整

2. 目标丢失指示灯延时1秒生效
parent aaed881f
...@@ -60,5 +60,10 @@ namespace VIZ.H2V.Connection ...@@ -60,5 +60,10 @@ namespace VIZ.H2V.Connection
/// 错误标记 /// 错误标记
/// </summary> /// </summary>
public const string wrong_target = "wrong_target"; public const string wrong_target = "wrong_target";
/// <summary>
/// 取消错误标记
/// </summary>
public const string reset = "reset";
} }
} }
...@@ -6,26 +6,32 @@ using System.Text; ...@@ -6,26 +6,32 @@ using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Data; using System.Windows.Data;
using VIZ.H2V.Domain; using VIZ.H2V.Domain;
using VIZ.H2V.Storage;
namespace VIZ.H2V.Module.Resource namespace VIZ.H2V.Module.Resource
{ {
/// <summary> /// <summary>
/// 算法是否拥有目标框转化器 /// 算法是否拥有目标框转化器
/// values[0] : IsAlgorithmTargetBoxExists /// values[0] : AlgorithmTargetBoxLostFrame
/// values[1] : ViewStatus /// values[1] : ViewStatus
/// </summary> /// </summary>
public class AlgorithmTargetBoxExistsConverter : IMultiValueConverter public class AlgorithmTargetBoxLostFrameConverter : IMultiValueConverter
{ {
/// <summary>
/// 算法目标框连续丢失帧数(如果目标框连续丢失则改变指示灯状态)
/// </summary>
private readonly int ALGORITHM_TARGET_BOX_LOST_FRAME = ApplicationDomainEx.IniStorage.GetValue<AlgorithmConfig, int>(p => p.ALGORITHM_TARGET_BOX_LOST_FRAME);
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{ {
if (values == null || values.Length != 2) if (values == null || values.Length != 2)
return false; return false;
bool isAlgorithmTargetBoxExists = (bool)values[0]; int lost = (int)values[0];
NDIViewStatus viewStatus = (NDIViewStatus)values[1]; NDIViewStatus viewStatus = (NDIViewStatus)values[1];
// 在裁切状态,且拥有目标框时才显示绿灯,否则为红灯 // 在裁切状态,且目标框丢失次数小于 ALGORITHM_TARGET_BOX_LOST_FRAME 时显示绿灯,否则为红灯
return viewStatus == NDIViewStatus.CropRoi && isAlgorithmTargetBoxExists; return viewStatus == NDIViewStatus.CropRoi && lost <= ALGORITHM_TARGET_BOX_LOST_FRAME;
} }
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
......
...@@ -150,7 +150,7 @@ ...@@ -150,7 +150,7 @@
<Compile Include="Converter\AlgorithmStrategyTagStringConverter.cs" /> <Compile Include="Converter\AlgorithmStrategyTagStringConverter.cs" />
<Compile Include="Converter\AlgorithmStrategyType2FootballFieldHeightConverter.cs" /> <Compile Include="Converter\AlgorithmStrategyType2FootballFieldHeightConverter.cs" />
<Compile Include="Converter\AlgorithmStrategyType2FootballFieldOrientationConverter.cs" /> <Compile Include="Converter\AlgorithmStrategyType2FootballFieldOrientationConverter.cs" />
<Compile Include="Converter\AlgorithmTargetBoxExistsConverter.cs" /> <Compile Include="Converter\AlgorithmTargetBoxLostFrameConverter.cs" />
<Compile Include="Converter\ServiceFps2VisibilityConverter.cs" /> <Compile Include="Converter\ServiceFps2VisibilityConverter.cs" />
<Compile Include="Converter\ServiceFps2SolidBrushConverter.cs" /> <Compile Include="Converter\ServiceFps2SolidBrushConverter.cs" />
<Compile Include="Converter\TallyColor2RadialGradientBrushConverter.cs" /> <Compile Include="Converter\TallyColor2RadialGradientBrushConverter.cs" />
...@@ -211,6 +211,14 @@ ...@@ -211,6 +211,14 @@
<Project>{92834c05-703e-4f05-9224-f36220939d8f}</Project> <Project>{92834c05-703e-4f05-9224-f36220939d8f}</Project>
<Name>VIZ.Framework.Common</Name> <Name>VIZ.Framework.Common</Name>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\..\VIZ.Framework\VIZ.Framework.Domain\VIZ.Framework.Domain.csproj">
<Project>{28661e82-c86a-4611-a028-c34f6ac85c97}</Project>
<Name>VIZ.Framework.Domain</Name>
</ProjectReference>
<ProjectReference Include="..\..\VIZ.Framework\VIZ.Framework.Storage\VIZ.Framework.Storage.csproj">
<Project>{06b80c09-343d-4bb2-aeb1-61cfbfbf5cad}</Project>
<Name>VIZ.Framework.Storage</Name>
</ProjectReference>
<ProjectReference Include="..\VIZ.H2V.Domain\VIZ.H2V.Domain.csproj"> <ProjectReference Include="..\VIZ.H2V.Domain\VIZ.H2V.Domain.csproj">
<Project>{3C61290E-D9C3-4F00-83CB-AE5F64C3298C}</Project> <Project>{3C61290E-D9C3-4F00-83CB-AE5F64C3298C}</Project>
<Name>VIZ.H2V.Domain</Name> <Name>VIZ.H2V.Domain</Name>
......
...@@ -101,6 +101,10 @@ namespace VIZ.H2V.Module ...@@ -101,6 +101,10 @@ namespace VIZ.H2V.Module
// 错误标记 // 错误标记
if (this.ExecuteErrorTag(hotkey)) if (this.ExecuteErrorTag(hotkey))
return; return;
// 取消错误标记
if (this.ExecuteCancelErrorTag(hotkey))
return;
} }
/// <summary> /// <summary>
...@@ -281,23 +285,30 @@ namespace VIZ.H2V.Module ...@@ -281,23 +285,30 @@ namespace VIZ.H2V.Module
{ {
INDIViewService service = null; INDIViewService service = null;
if (string.Equals(this.Support.HotkeyConfig.ErrorTagCAM1, hotkey)) if (string.Equals(this.Support.HotkeyConfig.ErrorTagActivedCAM, hotkey))
{
service = ApplicationDomainEx.ServiceManager.GetService<INDIViewService>(NDIViewKeys.CAM_1);
}
if (string.Equals(this.Support.HotkeyConfig.ErrorTagCAM2, hotkey))
{ {
service = ApplicationDomainEx.ServiceManager.GetService<INDIViewService>(NDIViewKeys.CAM_2); service = NDIViewModel.ActiveViewModel;
} }
if (string.Equals(this.Support.HotkeyConfig.ErrorTagCAM3, hotkey))
{ if (service == null)
service = ApplicationDomainEx.ServiceManager.GetService<INDIViewService>(NDIViewKeys.CAM_3); return false;
// 发送错误标记
service.SendErrorTag();
return true;
} }
if (string.Equals(this.Support.HotkeyConfig.ErrorTagCAM4, hotkey))
/// <summary>
/// 处理取消错误标记
/// </summary>
/// <param name="hotkey">热键</param>
/// <returns>是否处理完成</returns>
private bool ExecuteCancelErrorTag(string hotkey)
{ {
service = ApplicationDomainEx.ServiceManager.GetService<INDIViewService>(NDIViewKeys.CAM_4); INDIViewService service = null;
}
if (string.Equals(this.Support.HotkeyConfig.ErrorTagActivedCAM, hotkey)) if (string.Equals(this.Support.HotkeyConfig.CancelErrorTagActivedCAM, hotkey))
{ {
service = NDIViewModel.ActiveViewModel; service = NDIViewModel.ActiveViewModel;
} }
...@@ -305,8 +316,8 @@ namespace VIZ.H2V.Module ...@@ -305,8 +316,8 @@ namespace VIZ.H2V.Module
if (service == null) if (service == null)
return false; return false;
// 发送错误标记 // 发送取消错误标记
service.SendErrorTag(); service.SendCancelErrorTag();
return true; return true;
} }
......
...@@ -77,8 +77,8 @@ namespace VIZ.H2V.Module ...@@ -77,8 +77,8 @@ namespace VIZ.H2V.Module
// 检测3D鼠标值 // 检测3D鼠标值
this.Check3DNavigation(); this.Check3DNavigation();
// 更新算法是否拥有目标框 // 更新算法目标框连续丢失次数
this.UpdateIsAlgorithmTargetBoxExists(); this.UpdateAlgorithmTargetBoxLostFrame();
// 等待 // 等待
Task.Delay(100).Wait(); Task.Delay(100).Wait();
...@@ -138,15 +138,15 @@ namespace VIZ.H2V.Module ...@@ -138,15 +138,15 @@ namespace VIZ.H2V.Module
} }
/// <summary> /// <summary>
/// 更新算法是否拥有目标框 /// 更新算法目标框连续丢失次数
/// </summary> /// </summary>
private void UpdateIsAlgorithmTargetBoxExists() private void UpdateAlgorithmTargetBoxLostFrame()
{ {
List<INDIViewService> services = ApplicationDomainEx.ServiceManager.GetServiceList<INDIViewService>(); List<INDIViewService> services = ApplicationDomainEx.ServiceManager.GetServiceList<INDIViewService>();
if (services == null) if (services == null)
return; return;
services.ForEach(p => p.UpdateIsAlgorithmTargetBoxExists()); services.ForEach(p => p.UpdateAlgorithmTargetBoxLostFrame());
} }
/// <summary> /// <summary>
......
...@@ -64,7 +64,7 @@ ...@@ -64,7 +64,7 @@
</StackPanel> </StackPanel>
</Grid> </Grid>
<!-- 主体 --> <!-- 主体 -->
<Grid Grid.Row="1" Margin="25,10,25,10"> <Grid Grid.Row="1" Margin="40,0,40,10">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="*"></RowDefinition> <RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="*"></RowDefinition> <RowDefinition Height="*"></RowDefinition>
...@@ -73,10 +73,10 @@ ...@@ -73,10 +73,10 @@
<ColumnDefinition Width="*"></ColumnDefinition> <ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition> <ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<local:NDIView x:Name="view_CAM_1" NDIKey="{x:Static Member=domain:NDIViewKeys.CAM_1}" Grid.Row="0" Grid.Column="0" Margin="5,5,20,5"></local:NDIView> <local:NDIView NDIKey="{x:Static Member=domain:NDIViewKeys.CAM_1}" Grid.Row="0" Grid.Column="0" Margin="10,10,15,10"></local:NDIView>
<local:NDIView x:Name="view_CAM_2" NDIKey="{x:Static Member=domain:NDIViewKeys.CAM_3}" Grid.Row="1" Grid.Column="0" Margin="5,5,20,5"></local:NDIView> <local:NDIView NDIKey="{x:Static Member=domain:NDIViewKeys.CAM_2}" Grid.Row="0" Grid.Column="1" Margin="15,10,10,10"></local:NDIView>
<local:NDIView x:Name="view_CAM_3" NDIKey="{x:Static Member=domain:NDIViewKeys.CAM_4}" Grid.Row="1" Grid.Column="1" Margin="20,5,5,5"></local:NDIView> <local:NDIView NDIKey="{x:Static Member=domain:NDIViewKeys.CAM_3}" Grid.Row="1" Grid.Column="0" Margin="10,10,15,10"></local:NDIView>
<local:NDIView x:Name="view_CAM_4" NDIKey="{x:Static Member=domain:NDIViewKeys.CAM_2}" Grid.Row="0" Grid.Column="1" Margin="20,5,5,5"></local:NDIView> <local:NDIView NDIKey="{x:Static Member=domain:NDIViewKeys.CAM_4}" Grid.Row="1" Grid.Column="1" Margin="15,10,10,10"></local:NDIView>
</Grid> </Grid>
<!-- 底部 --> <!-- 底部 -->
<Border Grid.Row="2" Background="#ff12202d"> <Border Grid.Row="2" Background="#ff12202d">
......
...@@ -208,6 +208,12 @@ namespace VIZ.H2V.Module ...@@ -208,6 +208,12 @@ namespace VIZ.H2V.Module
public abstract void ErrorTag(List<int> target_bbox, long timeCode); public abstract void ErrorTag(List<int> target_bbox, long timeCode);
/// <summary> /// <summary>
/// 取消错误标记
/// </summary>
/// <param name="timeCode">时间码</param>
public abstract void CancelErrorTag(long timeCode);
/// <summary>
/// 手动校准 /// 手动校准
/// </summary> /// </summary>
/// <param name="info">手动校准信息</param> /// <param name="info">手动校准信息</param>
......
...@@ -78,6 +78,12 @@ namespace VIZ.H2V.Module ...@@ -78,6 +78,12 @@ namespace VIZ.H2V.Module
void ErrorTag(List<int> target_bbox, long timeCode); void ErrorTag(List<int> target_bbox, long timeCode);
/// <summary> /// <summary>
/// 取消错误标记
/// </summary>
/// <param name="timeCode">时间码</param>
void CancelErrorTag(long timeCode);
/// <summary>
/// 初始化算法 /// 初始化算法
/// </summary> /// </summary>
/// <remarks> /// <remarks>
......
...@@ -135,6 +135,22 @@ namespace VIZ.H2V.Module ...@@ -135,6 +135,22 @@ namespace VIZ.H2V.Module
} }
/// <summary> /// <summary>
/// 取消错误标记
/// </summary>
/// <param name="timeCode">时间码</param>
public override void CancelErrorTag(long timeCode)
{
UdpEndpointManager manager = ConnectionManager.UdpConnection.GetEndpointManager(this.Support.ViewKey);
AlgorithmSenderOption option = new AlgorithmSenderOption();
option.id = this.Support.ID;
option.enable_sendto_crop = this.Support.ViewConfig.IsSendToCrop;
option.timecode = timeCode;
AlgorithmSender.AutoMode(manager, this.BuildPackage(AlgorithmAutoModeCmd.reset, null), option);
}
/// <summary>
/// 手动校准 /// 手动校准
/// </summary> /// </summary>
/// <param name="info">手动校准信息</param> /// <param name="info">手动校准信息</param>
......
...@@ -145,6 +145,22 @@ namespace VIZ.H2V.Module ...@@ -145,6 +145,22 @@ namespace VIZ.H2V.Module
} }
/// <summary> /// <summary>
/// 取消错误标记
/// </summary>
/// <param name="timeCode">时间码</param>
public override void CancelErrorTag(long timeCode)
{
UdpEndpointManager manager = ConnectionManager.UdpConnection.GetEndpointManager(this.Support.ViewKey);
AlgorithmSenderOption option = new AlgorithmSenderOption();
option.id = this.Support.ID;
option.enable_sendto_crop = this.Support.ViewConfig.IsSendToCrop;
option.timecode = timeCode;
AlgorithmSender.AutoMode(manager, this.BuildPackage(AlgorithmAutoModeCmd.reset, null, null), option);
}
/// <summary>
/// 手动校准 /// 手动校准
/// </summary> /// </summary>
/// <param name="info">手动校准信息</param> /// <param name="info">手动校准信息</param>
......
...@@ -182,6 +182,22 @@ namespace VIZ.H2V.Module ...@@ -182,6 +182,22 @@ namespace VIZ.H2V.Module
} }
/// <summary> /// <summary>
/// 取消错误标记
/// </summary>
/// <param name="timeCode">时间码</param>
public override void CancelErrorTag(long timeCode)
{
UdpEndpointManager manager = ConnectionManager.UdpConnection.GetEndpointManager(this.Support.ViewKey);
AlgorithmSenderOption option = new AlgorithmSenderOption();
option.id = this.Support.ID;
option.enable_sendto_crop = this.Support.ViewConfig.IsSendToCrop;
option.timecode = timeCode;
AlgorithmSender.AutoMode(manager, this.BuildPackage(AlgorithmAutoModeCmd.reset, null), option);
}
/// <summary>
/// 手动校准 /// 手动校准
/// </summary> /// </summary>
/// <param name="info">手动校准信息</param> /// <param name="info">手动校准信息</param>
......
...@@ -145,6 +145,22 @@ namespace VIZ.H2V.Module ...@@ -145,6 +145,22 @@ namespace VIZ.H2V.Module
} }
/// <summary> /// <summary>
/// 取消错误标记
/// </summary>
/// <param name="timeCode">时间码</param>
public override void CancelErrorTag(long timeCode)
{
UdpEndpointManager manager = ConnectionManager.UdpConnection.GetEndpointManager(this.Support.ViewKey);
AlgorithmSenderOption option = new AlgorithmSenderOption();
option.id = this.Support.ID;
option.enable_sendto_crop = this.Support.ViewConfig.IsSendToCrop;
option.timecode = timeCode;
AlgorithmSender.AutoMode(manager, this.BuildPackage(AlgorithmAutoModeCmd.reset, null, null), option);
}
/// <summary>
/// 手动校准 /// 手动校准
/// </summary> /// </summary>
/// <param name="info">手动校准信息</param> /// <param name="info">手动校准信息</param>
......
...@@ -106,6 +106,22 @@ namespace VIZ.H2V.Module ...@@ -106,6 +106,22 @@ namespace VIZ.H2V.Module
} }
/// <summary> /// <summary>
/// 取消错误标记
/// </summary>
/// <param name="timeCode">时间码</param>
public override void CancelErrorTag(long timeCode)
{
UdpEndpointManager manager = ConnectionManager.UdpConnection.GetEndpointManager(this.Support.ViewKey);
AlgorithmSenderOption option = new AlgorithmSenderOption();
option.id = this.Support.ID;
option.enable_sendto_crop = this.Support.ViewConfig.IsSendToCrop;
option.timecode = timeCode;
AlgorithmSender.AutoMode(manager, this.BuildPackage(AlgorithmAutoModeCmd.reset, null, null), option);
}
/// <summary>
/// 边线检测校准 /// 边线检测校准
/// </summary> /// </summary>
/// <param name="borderpoint">边线检测校准点</param> /// <param name="borderpoint">边线检测校准点</param>
......
...@@ -119,7 +119,7 @@ namespace VIZ.H2V.Module ...@@ -119,7 +119,7 @@ namespace VIZ.H2V.Module
/// <summary> /// <summary>
/// 更新算法是否拥有目标框 /// 更新算法是否拥有目标框
/// </summary> /// </summary>
void UpdateIsAlgorithmTargetBoxExists(); void UpdateAlgorithmTargetBoxLostFrame();
/// <summary> /// <summary>
/// 停止算法 /// 停止算法
...@@ -144,6 +144,11 @@ namespace VIZ.H2V.Module ...@@ -144,6 +144,11 @@ namespace VIZ.H2V.Module
void SendErrorTag(); void SendErrorTag();
/// <summary> /// <summary>
/// 发送取消错误标记
/// </summary>
void SendCancelErrorTag();
/// <summary>
/// 当算法停止时处理 /// 当算法停止时处理
/// </summary> /// </summary>
void WhenAlgorithmStop(); void WhenAlgorithmStop();
......
...@@ -71,7 +71,7 @@ ...@@ -71,7 +71,7 @@
StrategyModeListString="center_mode"> StrategyModeListString="center_mode">
</resource:NDIViewProperty2VisibilityConverter> </resource:NDIViewProperty2VisibilityConverter>
<!-- 目标框丢失指示灯 --> <!-- 目标框丢失指示灯 -->
<resource:AlgorithmTargetBoxExistsConverter x:Key="AlgorithmTargetBoxExistsConverter"></resource:AlgorithmTargetBoxExistsConverter> <resource:AlgorithmTargetBoxLostFrameConverter x:Key="AlgorithmTargetBoxLostFrameConverter"></resource:AlgorithmTargetBoxLostFrameConverter>
</ResourceDictionary> </ResourceDictionary>
</UserControl.Resources> </UserControl.Resources>
...@@ -83,7 +83,7 @@ ...@@ -83,7 +83,7 @@
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="80"></RowDefinition> <RowDefinition Height="70"></RowDefinition>
<RowDefinition Height="*"></RowDefinition> <RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
...@@ -133,7 +133,7 @@ ...@@ -133,7 +133,7 @@
MaxWidth="300"></TextBlock> MaxWidth="300"></TextBlock>
</Grid> </Grid>
<!-- 算法 --> <!-- 算法 -->
<Grid Grid.RowSpan="2" Margin="0,20,0,0"> <Grid Grid.RowSpan="2" Margin="0,16,-6,0">
<Grid IsEnabled="{Binding Path=ViewStatus,Converter={StaticResource NDIViewStatus2IsEnabledConverter}}"> <Grid IsEnabled="{Binding Path=ViewStatus,Converter={StaticResource NDIViewStatus2IsEnabledConverter}}">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="60"></RowDefinition> <RowDefinition Height="60"></RowDefinition>
...@@ -160,8 +160,8 @@ ...@@ -160,8 +160,8 @@
IsHitTestVisible="False" IsHitTestVisible="False"
HorizontalAlignment="Left" VerticalAlignment="Center" Margin="25,0,0,0"> HorizontalAlignment="Left" VerticalAlignment="Center" Margin="25,0,0,0">
<CheckBox.IsChecked> <CheckBox.IsChecked>
<MultiBinding Converter="{StaticResource AlgorithmTargetBoxExistsConverter}"> <MultiBinding Converter="{StaticResource AlgorithmTargetBoxLostFrameConverter}">
<Binding Path="IsAlgorithmTargetBoxExists"></Binding> <Binding Path="AlgorithmTargetBoxLostFrame"></Binding>
<Binding Path="ViewStatus"></Binding> <Binding Path="ViewStatus"></Binding>
</MultiBinding> </MultiBinding>
</CheckBox.IsChecked> </CheckBox.IsChecked>
......
...@@ -488,70 +488,5 @@ namespace VIZ.H2V.Module ...@@ -488,70 +488,5 @@ namespace VIZ.H2V.Module
} }
#endregion #endregion
#region AlgorithmErrorTagCommand -- 算法错误标记命令
/// <summary>
/// 算法错误标记命令
/// </summary>
public VCommand AlgorithmErrorTagCommand { get; set; }
/// <summary>
/// 算法错误标记
/// </summary>
private void AlgorithmErrorTag()
{
// 只有在自动模式下可以标记
if (this.StrategyMode != AlgorithmStrategyMode.auto_mode)
return;
// 只有裁切状态下可以标记
if (this.ViewStatus != NDIViewStatus.CropRoi)
return;
// 目前单人机位不支持错误标记
if (this.StrategyType == AlgorithmStrategyType.Single)
return;
NDIView view = this.GetView<NDIView>();
if (view == null)
return;
VideoRenderInfo renderInfo = view.video.GetRenderInfo();
if (renderInfo == null)
return;
TrackingBoxPlugin trackingBoxPlugin = view.video.GetPlugin<TrackingBoxPlugin>(VideoControlPluginNames.TrackingBox);
if (trackingBoxPlugin == null)
return;
List<TrackingBoxInfo> trackingBoxInfos = trackingBoxPlugin.GetTrackingBoxInfos();
if (trackingBoxInfos == null || trackingBoxInfos.Count == 0)
return;
TrackingBoxInfo boxInfo = trackingBoxInfos[0];
// 标记错误
List<int> box = new List<int>();
box.Add((int)boxInfo.SrcRect.Left);
box.Add((int)boxInfo.SrcRect.Top);
box.Add((int)boxInfo.SrcRect.Right);
box.Add((int)boxInfo.SrcRect.Bottom);
this.AlgorithmControllerDic[this.StrategyType].ErrorTag(box, renderInfo.Frame.TimeStamp);
//====================================================================
// CODE: SYSTEM_LOG | 记录日志
//====================================================================
// 记录日志: 算法错误标记 | [类型:{0}],<坐标:({1},{2},{3},{4}), 时码: {5}>
string system_log = string.Format(SystemLogStringFormats.ALGORITHM_ERROR_TAG,
this.StrategyType.GetDescription(),
box[0], box[1], box[2], box[3],
renderInfo.Frame.TimeStamp);
ApplicationDomainEx.CsvContext.AppendSystemLog(this.ViewKey, this.DisplayName, system_log);
//====================================================================
}
#endregion
} }
} }
...@@ -221,8 +221,15 @@ namespace VIZ.H2V.Module ...@@ -221,8 +221,15 @@ namespace VIZ.H2V.Module
/// <param name="view">视图</param> /// <param name="view">视图</param>
private void OnAlgorithmMessage__crop_roi__target_bbox(AlgorithmMessage__crop_roi msg, VideoRenderInfo renderInfo, NDIView view) private void OnAlgorithmMessage__crop_roi__target_bbox(AlgorithmMessage__crop_roi msg, VideoRenderInfo renderInfo, NDIView view)
{ {
// 当前是否拥有目标框 // 当前是否拥有目标框,如果没有目标框则记录当前丢失目标框帧数
this.isAlgorithmTargetBoxExists_cache = msg.target_bbox != null; if (msg.target_bbox == null)
{
++this.algorithmTargetBoxLostFrame_cache;
}
else
{
this.algorithmTargetBoxLostFrame_cache = 0;
}
// 没有目标框 || 配置是否显示目标框 // 没有目标框 || 配置是否显示目标框
if (msg.target_bbox == null || !this.IsShowAlgorithmTargetBox) if (msg.target_bbox == null || !this.IsShowAlgorithmTargetBox)
......
...@@ -380,23 +380,25 @@ namespace VIZ.H2V.Module ...@@ -380,23 +380,25 @@ namespace VIZ.H2V.Module
#endregion #endregion
#region IsAlgorithmTargetBoxExists -- 算法目标框是否存在 #region AlgorithmTargetBoxLostFrame -- 算法目标框连续丢失帧数
private bool isAlgorithmTargetBoxExists_cache; /// <summary>
/// 算法目标框连续丢失帧数 缓存
/// </summary>
/// <remarks>
/// 算法目标框连续丢失帧数 值首先记录在cache中
/// 真实值更新则在 NDIMainViewModel 的 LoopController 中
/// </remarks>
private int algorithmTargetBoxLostFrame_cache;
private bool isAlgorithmTargetBoxExists; private int algorithmTargetBoxLostFrame;
/// <summary> /// <summary>
/// 算法目标框是否存在 /// 算法目标框连续丢失帧数
/// </summary> /// </summary>
public bool IsAlgorithmTargetBoxExists public int AlgorithmTargetBoxLostFrame
{ {
get { return isAlgorithmTargetBoxExists; } get { return algorithmTargetBoxLostFrame; }
set set { algorithmTargetBoxLostFrame = value; this.RaisePropertyChanged(nameof(AlgorithmTargetBoxLostFrame)); }
{
isAlgorithmTargetBoxExists = value;
isAlgorithmTargetBoxExists_cache = value;
this.RaisePropertySaveChanged(nameof(IsAlgorithmTargetBoxExists));
}
} }
#endregion #endregion
......
...@@ -82,7 +82,6 @@ namespace VIZ.H2V.Module ...@@ -82,7 +82,6 @@ namespace VIZ.H2V.Module
this.IsAreaCorrectionEnabledChangedCommand = new VCommand(this.IsAreaCorrectionEnabledChanged); this.IsAreaCorrectionEnabledChangedCommand = new VCommand(this.IsAreaCorrectionEnabledChanged);
this.SaveAlgorithmConfigCommand = new VCommand(this.SaveAlgorithmConfig); this.SaveAlgorithmConfigCommand = new VCommand(this.SaveAlgorithmConfig);
this.SetActiveCommand = new VCommand(this.SetActive); this.SetActiveCommand = new VCommand(this.SetActive);
this.AlgorithmErrorTagCommand = new VCommand(this.AlgorithmErrorTag);
} }
/// <summary> /// <summary>
...@@ -399,12 +398,12 @@ namespace VIZ.H2V.Module ...@@ -399,12 +398,12 @@ namespace VIZ.H2V.Module
/// <summary> /// <summary>
/// 更新算法是否拥有目标框 /// 更新算法是否拥有目标框
/// </summary> /// </summary>
public void UpdateIsAlgorithmTargetBoxExists() public void UpdateAlgorithmTargetBoxLostFrame()
{ {
if (this.IsAlgorithmTargetBoxExists == this.isAlgorithmTargetBoxExists_cache) if (this.AlgorithmTargetBoxLostFrame == this.algorithmTargetBoxLostFrame_cache)
return; return;
this.IsAlgorithmTargetBoxExists = this.isAlgorithmTargetBoxExists_cache; this.AlgorithmTargetBoxLostFrame = this.algorithmTargetBoxLostFrame_cache;
} }
/// <summary> /// <summary>
...@@ -420,7 +419,92 @@ namespace VIZ.H2V.Module ...@@ -420,7 +419,92 @@ namespace VIZ.H2V.Module
/// </summary> /// </summary>
public void SendErrorTag() public void SendErrorTag()
{ {
this.AlgorithmErrorTag(); // 只有在自动模式下可以标记
if (this.StrategyMode != AlgorithmStrategyMode.auto_mode)
return;
// 只有裁切状态下可以标记
if (this.ViewStatus != NDIViewStatus.CropRoi)
return;
// 目前单人机位不支持错误标记
if (this.StrategyType == AlgorithmStrategyType.Single)
return;
NDIView view = this.GetView<NDIView>();
if (view == null)
return;
VideoRenderInfo renderInfo = view.video.GetRenderInfo();
if (renderInfo == null)
return;
TrackingBoxPlugin trackingBoxPlugin = view.video.GetPlugin<TrackingBoxPlugin>(VideoControlPluginNames.TrackingBox);
if (trackingBoxPlugin == null)
return;
List<TrackingBoxInfo> trackingBoxInfos = trackingBoxPlugin.GetTrackingBoxInfos();
if (trackingBoxInfos == null || trackingBoxInfos.Count == 0)
return;
TrackingBoxInfo boxInfo = trackingBoxInfos[0];
// 标记错误
List<int> box = new List<int>();
box.Add((int)boxInfo.SrcRect.Left);
box.Add((int)boxInfo.SrcRect.Top);
box.Add((int)boxInfo.SrcRect.Right);
box.Add((int)boxInfo.SrcRect.Bottom);
this.AlgorithmControllerDic[this.StrategyType].ErrorTag(box, renderInfo.Frame.TimeStamp);
//====================================================================
// CODE: SYSTEM_LOG | 记录日志
//====================================================================
// 记录日志: 算法错误标记 | [类型:{0}],<坐标:({1},{2},{3},{4}), 时码: {5}>
string system_log = string.Format(SystemLogStringFormats.ALGORITHM_ERROR_TAG,
this.StrategyType.GetDescription(),
box[0], box[1], box[2], box[3],
renderInfo.Frame.TimeStamp);
ApplicationDomainEx.CsvContext.AppendSystemLog(this.ViewKey, this.DisplayName, system_log);
//====================================================================
}
/// <summary>
/// 发送取消错误标记
/// </summary>
public void SendCancelErrorTag()
{
// 只有在自动模式下可以标记
if (this.StrategyMode != AlgorithmStrategyMode.auto_mode)
return;
// 只有裁切状态下可以标记
if (this.ViewStatus != NDIViewStatus.CropRoi)
return;
// 目前单人机位不支持错误标记
if (this.StrategyType == AlgorithmStrategyType.Single)
return;
NDIView view = this.GetView<NDIView>();
if (view == null)
return;
VideoRenderInfo renderInfo = view.video.GetRenderInfo();
if (renderInfo == null)
return;
this.AlgorithmControllerDic[this.StrategyType].CancelErrorTag(renderInfo.Frame.TimeStamp);
//====================================================================
// CODE: SYSTEM_LOG | 记录日志
//====================================================================
// 记录日志: 算法取消错误标记,[类型:{0}],<时码: {1}>
string system_log = string.Format(SystemLogStringFormats.ALGORITHM_CANCEL_ERROR_TAG,
this.StrategyType.GetDescription(), renderInfo.Frame.TimeStamp);
ApplicationDomainEx.CsvContext.AppendSystemLog(this.ViewKey, this.DisplayName, system_log);
//====================================================================
} }
/// <summary> /// <summary>
...@@ -428,8 +512,8 @@ namespace VIZ.H2V.Module ...@@ -428,8 +512,8 @@ namespace VIZ.H2V.Module
/// </summary> /// </summary>
public void WhenAlgorithmStop() public void WhenAlgorithmStop()
{ {
// 清理目标跟踪框信息 // 从新统计目标框丢失帧数
this.isAlgorithmTargetBoxExists_cache = false; this.algorithmTargetBoxLostFrame_cache = 0;
} }
/// <summary> /// <summary>
......
...@@ -167,13 +167,11 @@ ...@@ -167,13 +167,11 @@
</Grid> </Grid>
<!-- 标记误检快捷键 --> <!-- 标记误检快捷键 -->
<TextBlock Text="标记误检快捷键" Foreground="#AAFFFFFF" FontSize="20" VerticalAlignment="Center" Grid.Row="8"></TextBlock> <TextBlock Text="标记当前窗口误检快捷键" Foreground="#AAFFFFFF" FontSize="20" VerticalAlignment="Center" Grid.Row="8"></TextBlock>
<Rectangle Grid.Row="8" VerticalAlignment="Bottom" Height="2" Fill="#ff364051"></Rectangle> <Rectangle Grid.Row="8" VerticalAlignment="Bottom" Height="2" Fill="#ff364051"></Rectangle>
<Grid Grid.Row="9"> <Grid Grid.Row="9">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="50"></RowDefinition> <RowDefinition Height="50"></RowDefinition>
<RowDefinition Height="50"></RowDefinition>
<RowDefinition Height="50"></RowDefinition>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="120"></ColumnDefinition> <ColumnDefinition Width="120"></ColumnDefinition>
...@@ -181,26 +179,14 @@ ...@@ -181,26 +179,14 @@
<ColumnDefinition Width="120"></ColumnDefinition> <ColumnDefinition Width="120"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition> <ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<!-- CAM 1 --> <!-- 标记 -->
<TextBlock Text="CAM 1" Foreground="White" FontSize="18" VerticalAlignment="Center" Grid.Row="0"></TextBlock> <TextBlock Text="标记" Foreground="White" FontSize="18" VerticalAlignment="Center"></TextBlock>
<fcommon:HotkeyBox Grid.Column="1" Hotkey="{Binding Path=ErrorTagCAM1,Mode=TwoWay}" Height="30" <fcommon:HotkeyBox Grid.Column="1" Hotkey="{Binding Path=ErrorTagActivedCAM,Mode=TwoWay}" Height="30"
Style="{StaticResource HotkeyBox_Setting}" Margin="0,0,20,0"></fcommon:HotkeyBox>
<!-- CAM 2 -->
<TextBlock Text="CAM 2" Foreground="White" FontSize="18" VerticalAlignment="Center" Grid.Row="0" Grid.Column="2"></TextBlock>
<fcommon:HotkeyBox Grid.Column="3" Hotkey="{Binding Path=ErrorTagCAM2,Mode=TwoWay}" Height="30" Grid.Row="0"
Style="{StaticResource HotkeyBox_Setting}" Margin="0,0,20,0"></fcommon:HotkeyBox>
<!-- CAM 3 -->
<TextBlock Text="CAM 3" Foreground="White" FontSize="18" VerticalAlignment="Center" Grid.Row="1"></TextBlock>
<fcommon:HotkeyBox Grid.Column="1" Hotkey="{Binding Path=ErrorTagCAM3,Mode=TwoWay}" Height="30" Grid.Row="1"
Style="{StaticResource HotkeyBox_Setting}" Margin="0,0,20,0"></fcommon:HotkeyBox>
<!-- CAM 4 -->
<TextBlock Text="CAM 4" Foreground="White" FontSize="18" VerticalAlignment="Center" Grid.Row="1" Grid.Column="2"></TextBlock>
<fcommon:HotkeyBox Grid.Column="3" Hotkey="{Binding Path=ErrorTagCAM4,Mode=TwoWay}" Height="30" Grid.Row="1"
Style="{StaticResource HotkeyBox_Setting}" Margin="0,0,20,0"></fcommon:HotkeyBox> Style="{StaticResource HotkeyBox_Setting}" Margin="0,0,20,0"></fcommon:HotkeyBox>
<!-- 当前激活窗口 --> <!-- 取消标记 -->
<TextBlock Text="当前激活窗口" Foreground="White" FontSize="18" VerticalAlignment="Center" Grid.Row="2"></TextBlock> <TextBlock Text="取消标记" Foreground="White" FontSize="18" VerticalAlignment="Center" Grid.Column="2"></TextBlock>
<fcommon:HotkeyBox Grid.Column="1" Hotkey="{Binding Path=ErrorTagActivedCAM,Mode=TwoWay}" Height="30" Grid.Row="2" <fcommon:HotkeyBox Grid.Column="3" Hotkey="{Binding Path=CancelErrorTagActivedCAM,Mode=TwoWay}" Height="30"
Style="{StaticResource HotkeyBox_Setting}" Margin="0,0,20,0"></fcommon:HotkeyBox> Style="{StaticResource HotkeyBox_Setting}" Margin="0,0,20,0"></fcommon:HotkeyBox>
</Grid> </Grid>
</Grid> </Grid>
......
...@@ -379,77 +379,32 @@ namespace VIZ.H2V.Module ...@@ -379,77 +379,32 @@ namespace VIZ.H2V.Module
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// 错误标记 // 错误标记
#region ErrorTagCAM1 -- 错误标记 视图1 #region ErrorTagActivedCAM -- 错误标记 当前激活的视图
private string errorTagCAM1;
/// <summary>
/// 错误标记 视图1
/// </summary>
[HotkeyProperty]
public string ErrorTagCAM1
{
get { return errorTagCAM1; }
set { errorTagCAM1 = value; this.RaisePropertyChanged(nameof(ErrorTagCAM1)); }
}
#endregion
#region ErrorTagCAM2 -- 错误标记 视图2
private string errorTagCAM2;
/// <summary>
/// 错误标记 视图2
/// </summary>
[HotkeyProperty]
public string ErrorTagCAM2
{
get { return errorTagCAM2; }
set { errorTagCAM2 = value; this.RaisePropertyChanged(nameof(ErrorTagCAM2)); }
}
#endregion
#region ErrorTagCAM3 -- 错误标记 视图3
private string errorTagCAM3;
/// <summary>
/// 错误标记 视图3
/// </summary>
[HotkeyProperty]
public string ErrorTagCAM3
{
get { return errorTagCAM3; }
set { errorTagCAM3 = value; this.RaisePropertyChanged(nameof(ErrorTagCAM3)); }
}
#endregion
#region ErrorTagCAM4 -- 错误标记 视图4
private string errorTagCAM4; private string errorTagActivedCAM;
/// <summary> /// <summary>
/// 错误标记 视图4 /// 错误标记 当前激活的视图
/// </summary> /// </summary>
[HotkeyProperty] [HotkeyProperty]
public string ErrorTagCAM4 public string ErrorTagActivedCAM
{ {
get { return errorTagCAM4; } get { return errorTagActivedCAM; }
set { errorTagCAM4 = value; this.RaisePropertyChanged(nameof(ErrorTagCAM4)); } set { errorTagActivedCAM = value; this.RaisePropertyChanged(nameof(ErrorTagActivedCAM)); }
} }
#endregion #endregion
#region ErrorTagActivedCAM -- 错误标记 当前激活的视图 #region CancelErrorTagActivedCAM -- 取消错误标记 当前激活对的视图
private string errorTagActivedCAM; private string cancelErrorTagActivedCAM;
/// <summary> /// <summary>
/// 错误标记 当前激活的视图 /// 取消错误标记 当前激活对的视图
/// </summary> /// </summary>
[HotkeyProperty] [HotkeyProperty]
public string ErrorTagActivedCAM public string CancelErrorTagActivedCAM
{ {
get { return errorTagActivedCAM; } get { return cancelErrorTagActivedCAM; }
set { errorTagActivedCAM = value; this.RaisePropertyChanged(nameof(ErrorTagActivedCAM)); } set { cancelErrorTagActivedCAM = value; this.RaisePropertyChanged(nameof(CancelErrorTagActivedCAM)); }
} }
#endregion #endregion
...@@ -500,11 +455,8 @@ namespace VIZ.H2V.Module ...@@ -500,11 +455,8 @@ namespace VIZ.H2V.Module
this.ActiveCAM4 = this.HotkeyConfig.ActiveCAM4; this.ActiveCAM4 = this.HotkeyConfig.ActiveCAM4;
// 错误标记 // 错误标记
this.ErrorTagCAM1 = this.HotkeyConfig.ErrorTagCAM1;
this.ErrorTagCAM2 = this.HotkeyConfig.ErrorTagCAM2;
this.ErrorTagCAM3 = this.HotkeyConfig.ErrorTagCAM3;
this.ErrorTagCAM4 = this.HotkeyConfig.ErrorTagCAM4;
this.ErrorTagActivedCAM = this.HotkeyConfig.ErrorTagActivedCAM; this.ErrorTagActivedCAM = this.HotkeyConfig.ErrorTagActivedCAM;
this.CancelErrorTagActivedCAM = this.HotkeyConfig.CancelErrorTagActivedCAM;
} }
#endregion #endregion
...@@ -556,16 +508,10 @@ namespace VIZ.H2V.Module ...@@ -556,16 +508,10 @@ namespace VIZ.H2V.Module
return true; return true;
// 错误标记 // 错误标记
if (this.ErrorTagCAM1 != this.HotkeyConfig.ErrorTagCAM1)
return true;
if (this.ErrorTagCAM2 != this.HotkeyConfig.ErrorTagCAM2)
return true;
if (this.ErrorTagCAM3 != this.HotkeyConfig.ErrorTagCAM3)
return true;
if (this.ErrorTagCAM4 != this.HotkeyConfig.ErrorTagCAM4)
return true;
if (this.ErrorTagActivedCAM != this.HotkeyConfig.ErrorTagActivedCAM) if (this.ErrorTagActivedCAM != this.HotkeyConfig.ErrorTagActivedCAM)
return true; return true;
if (this.CancelErrorTagActivedCAM != this.HotkeyConfig.CancelErrorTagActivedCAM)
return true;
// 不需要保存 // 不需要保存
return false; return false;
...@@ -602,11 +548,8 @@ namespace VIZ.H2V.Module ...@@ -602,11 +548,8 @@ namespace VIZ.H2V.Module
this.HotkeyConfig.ActiveCAM4 = this.ActiveCAM4; this.HotkeyConfig.ActiveCAM4 = this.ActiveCAM4;
// 错误标记 // 错误标记
this.HotkeyConfig.ErrorTagCAM1 = this.ErrorTagCAM1;
this.HotkeyConfig.ErrorTagCAM2 = this.ErrorTagCAM2;
this.HotkeyConfig.ErrorTagCAM3 = this.ErrorTagCAM3;
this.HotkeyConfig.ErrorTagCAM4 = this.ErrorTagCAM4;
this.HotkeyConfig.ErrorTagActivedCAM = this.ErrorTagActivedCAM; this.HotkeyConfig.ErrorTagActivedCAM = this.ErrorTagActivedCAM;
this.HotkeyConfig.CancelErrorTagActivedCAM = this.CancelErrorTagActivedCAM;
// 更新配置 // 更新配置
ApplicationDomainEx.LiteDbContext.HotkeyConfig.Upsert(this.HotkeyConfig); ApplicationDomainEx.LiteDbContext.HotkeyConfig.Upsert(this.HotkeyConfig);
......
...@@ -70,5 +70,10 @@ namespace VIZ.H2V.Storage ...@@ -70,5 +70,10 @@ namespace VIZ.H2V.Storage
/// 算法错误标记 /// 算法错误标记
/// </summary> /// </summary>
public const string ALGORITHM_ERROR_TAG = "算法错误标记,[类型:{0}],<坐标:({1},{2},{3},{4}), 时码: {5}>"; public const string ALGORITHM_ERROR_TAG = "算法错误标记,[类型:{0}],<坐标:({1},{2},{3},{4}), 时码: {5}>";
/// <summary>
/// 算法取消错误标记
/// </summary>
public const string ALGORITHM_CANCEL_ERROR_TAG = "算法取消错误标记,[类型:{0}],<时码: {1}>";
} }
} }
...@@ -23,5 +23,11 @@ namespace VIZ.H2V.Storage ...@@ -23,5 +23,11 @@ namespace VIZ.H2V.Storage
/// </summary> /// </summary>
[Ini(Section = "Algorithm", DefaultValue = "30000", Type = typeof(int))] [Ini(Section = "Algorithm", DefaultValue = "30000", Type = typeof(int))]
public string ALGORITHM_STOP_TIMEOUT { get; set; } public string ALGORITHM_STOP_TIMEOUT { get; set; }
/// <summary>
/// ALGORITHM_TARGET_BOX_LOST_FRAME
/// </summary>
[Ini(Section = "Algorithm", DefaultValue = "25", Type = typeof(int))]
public string ALGORITHM_TARGET_BOX_LOST_FRAME { get; set; }
} }
} }
...@@ -98,28 +98,13 @@ namespace VIZ.H2V.Storage ...@@ -98,28 +98,13 @@ namespace VIZ.H2V.Storage
public string ActiveCAM4 { get; set; } = "F4"; public string ActiveCAM4 { get; set; } = "F4";
/// <summary> /// <summary>
/// 错误标记 视图1 /// 错误标记 当前激活的视图
/// </summary>
public string ErrorTagCAM1 { get; set; } = "Ctrl + D1";
/// <summary>
/// 错误标记 视图2
/// </summary>
public string ErrorTagCAM2 { get; set; } = "Ctrl + D2";
/// <summary>
/// 错误标记 视图3
/// </summary>
public string ErrorTagCAM3 { get; set; } = "Ctrl + D3";
/// <summary>
/// 错误标记 视图4
/// </summary> /// </summary>
public string ErrorTagCAM4 { get; set; } = "Ctrl + D4"; public string ErrorTagActivedCAM { get; set; } = "Q";
/// <summary> /// <summary>
/// 错误标记 当前激活的视图 /// 取消错误标记 当前激活的窗口
/// </summary> /// </summary>
public string ErrorTagActivedCAM { get; set; } = "Q"; public string CancelErrorTagActivedCAM { get; set; } = "R";
} }
} }
...@@ -81,3 +81,5 @@ ALGORITHM_PYTHON_PATH=E:\Projects\VIZ.H2V\VIZ.H2V.UdpTestTool\bin\x64\Debug\VIZ. ...@@ -81,3 +81,5 @@ ALGORITHM_PYTHON_PATH=E:\Projects\VIZ.H2V\VIZ.H2V.UdpTestTool\bin\x64\Debug\VIZ.
ALGORITHM_STOP_TIMEOUT=5000 ALGORITHM_STOP_TIMEOUT=5000
;是否显示目标框 ;是否显示目标框
ALGORITHM_IS_SHOW_TARGET_BOX=true ALGORITHM_IS_SHOW_TARGET_BOX=true
;算法目标框连续丢失帧数(如果目标框连续丢失则改变指示灯状态)
ALGORITHM_TARGET_BOX_LOST_FRAME=25
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment