Commit d45f1472 by liulongfei

1. 添加战术机位

2. 添加索道机位
parent 76736ae4
......@@ -37,8 +37,7 @@ namespace VIZ.H2V.Connection
/// <summary>
/// 执行
/// </summary>
/// <param name="info"></param>
/// <exception cref="NotImplementedException"></exception>
/// <param name="info">信息</param>
protected override void Execute(ConnSingleJsonInfo info)
{
Task.Run(() =>
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VIZ.H2V.Connection
{
/// <summary>
/// 设置参数 -- 索道机位
/// </summary>
public class AlgorithmPackage__auto_mode_Cableway : AlgorithmPackage__auto_mode
{
/// <summary>
/// 无球时自动跟人(1:选中,0:未选中)
/// </summary>
public int auto_follow_human { get; set; }
/// <summary>
/// 最小面积(相对全图的归一化占比)(0~1)
/// </summary>
public double min_human_area { get; set; }
/// <summary>
/// 最小置信度(0~1)
/// </summary>
public double min_conf { get; set; }
/// <summary>
/// 面积所占权重(0~1)
/// </summary>
public double weight_area { get; set; }
/// <summary>
/// 置信度所占权重(0~1)
/// </summary>
public double weight_conf { get; set; }
/// <summary>
/// 距离所占权重(0~1)
/// </summary>
public double weight_distance { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VIZ.H2V.Connection
{
/// <summary>
/// 设置参数 -- 战术机位
/// </summary>
public class AlgorithmPackage__auto_mode_Tactics : AlgorithmPackage__auto_mode
{
/// <summary>
/// 无球时自动跟人(1:选中,0:未选中)
/// </summary>
public int auto_follow_human { get; set; }
/// <summary>
/// 最小面积(相对全图的归一化占比)(0~1)
/// </summary>
public double min_human_area { get; set; }
/// <summary>
/// 最小置信度(0~1)
/// </summary>
public double min_conf { get; set; }
/// <summary>
/// 面积所占权重(0~1)
/// </summary>
public double weight_area { get; set; }
/// <summary>
/// 置信度所占权重(0~1)
/// </summary>
public double weight_conf { get; set; }
/// <summary>
/// 距离所占权重(0~1)
/// </summary>
public double weight_distance { get; set; }
}
}
......@@ -84,6 +84,8 @@
<Compile Include="UDP\Algorithm\Signal\Recv\AlgorithmRecvPackage__detect.cs" />
<Compile Include="UDP\Algorithm\Signal\Recv\AlgorithmRecvPackage__crop_roi.cs" />
<Compile Include="UDP\Algorithm\Signal\Recv\AlgorithmRecvPackage__checked_ok.cs" />
<Compile Include="UDP\Algorithm\Signal\Send\AlgorithmPackage__auto_mode_Cableway.cs" />
<Compile Include="UDP\Algorithm\Signal\Send\AlgorithmPackage__auto_mode_Tactics.cs" />
<Compile Include="UDP\Algorithm\Signal\Send\AlgorithmPackage__no_mode.cs" />
<Compile Include="UDP\Algorithm\Signal\Send\AlgorithmPackage__manual_mode.cs" />
<Compile Include="UDP\Algorithm\Signal\Send\AlgorithmPackage__center_mode.cs" />
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using VIZ.Framework.Core;
namespace VIZ.H2V.Module
{
/// <summary>
/// AlgorithmCablewayPanelView.xaml 的交互逻辑
/// </summary>
public partial class AlgorithmCablewayPanelView : UserControl
{
public AlgorithmCablewayPanelView()
{
InitializeComponent();
WPFHelper.BindingViewModel(this, new AlgorithmCablewayPanelViewModel());
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using VIZ.Framework.Core;
namespace VIZ.H2V.Module
{
/// <summary>
/// AlgorithmTacticsPanelView.xaml 的交互逻辑
/// </summary>
public partial class AlgorithmTacticsPanelView : UserControl
{
public AlgorithmTacticsPanelView()
{
InitializeComponent();
WPFHelper.BindingViewModel(this, new AlgorithmTacticsPanelViewModel());
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Framework.Common;
using VIZ.Framework.Core;
using VIZ.H2V.Domain;
using VIZ.H2V.Storage;
namespace VIZ.H2V.Module
{
/// <summary>
/// 设置面板模型 -- 索道机位
/// </summary>
public class AlgorithmCablewayPanelViewModel : AlgorithmPanelViewModelBase
{
// ======================================================================================
// === Field ===
// ======================================================================================
/// <summary>
/// 配置
/// </summary>
private AlgorithmCableway Config;
// ======================================================================================
// === Property ===
// ======================================================================================
#region PersonAreaProportion -- 人物面积占比
private double personAreaProportion;
/// <summary>
/// 人物面积占比
/// </summary>
public double PersonAreaProportion
{
get { return personAreaProportion; }
set { personAreaProportion = value; this.RaisePropertyChanged(nameof(PersonAreaProportion)); }
}
#endregion
#region PersonAreaProportionWeight -- 人物面积占比权重
private double personAreaProportionWeight;
/// <summary>
/// 人物面积占比权重
/// </summary>
public double PersonAreaProportionWeight
{
get { return personAreaProportionWeight; }
set { personAreaProportionWeight = value; this.RaisePropertyChanged(nameof(PersonAreaProportionWeight)); }
}
#endregion
#region Confidence -- 置信度
private double confidence;
/// <summary>
/// 置信度
/// </summary>
public double Confidence
{
get { return confidence; }
set { confidence = value; this.RaisePropertyChanged(nameof(Confidence)); }
}
#endregion
#region ConfidenceWeight -- 置信度权重
private double confidenceWeight;
/// <summary>
/// 置信度权重
/// </summary>
public double ConfidenceWeight
{
get { return confidenceWeight; }
set { confidenceWeight = value; this.RaisePropertyChanged(nameof(ConfidenceWeight)); }
}
#endregion
#region PositionToCenterWeight -- 距离中心位置权重
private double positionToCenterWeight;
/// <summary>
/// 距离中心位置权重
/// </summary>
public double PositionToCenterWeight
{
get { return positionToCenterWeight; }
set { positionToCenterWeight = value; this.RaisePropertyChanged(nameof(PositionToCenterWeight)); }
}
#endregion
#region NoBallAutoChangeToPerson -- 无球时自动跟人
private bool noBallAutoChangeToPerson;
/// <summary>
/// 无球时自动跟人
/// </summary>
public bool NoBallAutoChangeToPerson
{
get { return noBallAutoChangeToPerson; }
set { noBallAutoChangeToPerson = value; this.RaisePropertyChanged(nameof(NoBallAutoChangeToPerson)); }
}
#endregion
// ======================================================================================
// === Command ===
// ======================================================================================
// ======================================================================================
// === Override ===
// ======================================================================================
/// <summary>
/// 加载
/// </summary>
protected override void Loaded()
{
base.Loaded();
this.StrategyType = AlgorithmStrategyType.Cableway;
AlgorithmCableway config = ApplicationDomainEx.LiteDbContext.AlgorithmCableway.FindOne(p => p.ViewKey == this.ViewKey);
this.Config = config;
this.PersonAreaProportionWeight = config.PersonAreaProportionWeight;
this.PersonAreaProportion = config.PersonAreaProportion;
this.ConfidenceWeight = config.ConfidenceWeight;
this.Confidence = config.Confidence;
this.PositionToCenterWeight = config.PositionToCenterWeight;
this.NoBallAutoChangeToPerson = config.NoBallAutoChangeToPerson;
this.SmoothCoeff = config.SmoothCoeff;
this.KeepPrevFrame = config.KeepPrevFrame;
}
/// <summary>
/// 是否需要保存
/// </summary>
/// <returns>是否需要保存</returns>
public override bool IsNeedSave()
{
if (this.ViewConfig.StrategyType != this.StrategyType)
return false;
if (this.PersonAreaProportion != this.Config.PersonAreaProportion)
return true;
if (this.PersonAreaProportionWeight != this.Config.PersonAreaProportionWeight)
return true;
if (this.Confidence != this.Config.Confidence)
return true;
if (this.ConfidenceWeight != this.Config.ConfidenceWeight)
return true;
if (this.PositionToCenterWeight != this.Config.PositionToCenterWeight)
return true;
if (this.NoBallAutoChangeToPerson != this.Config.NoBallAutoChangeToPerson)
return true;
if (this.SmoothCoeff != this.Config.SmoothCoeff)
return true;
if (this.KeepPrevFrame != this.Config.KeepPrevFrame)
return true;
if (this.SelectedGpuInfo.Physics != this.ViewConfig.GPU)
return true;
return false;
}
/// <summary>
/// 是否需要重启算法
/// </summary>
/// <returns>是否需要重启算法</returns>
public override bool IsNeedRestart()
{
if (this.SelectedGpuInfo.Physics != this.ViewConfig.GPU)
return true;
return false;
}
/// <summary>
/// 保存
/// </summary>
public override bool Save()
{
// 校验
if (this.PersonAreaProportionWeight + this.ConfidenceWeight + this.PositionToCenterWeight > 100)
{
MessageBoxEx.ShowDialog("占比权重总和应该在100以内", this.GetWindow());
return false;
}
// 保存
this.Config.PersonAreaProportionWeight = this.PersonAreaProportionWeight;
this.Config.PersonAreaProportion = this.PersonAreaProportion;
this.Config.ConfidenceWeight = this.ConfidenceWeight;
this.Config.Confidence = this.Confidence;
this.Config.PositionToCenterWeight = this.PositionToCenterWeight;
this.Config.NoBallAutoChangeToPerson = this.NoBallAutoChangeToPerson;
this.Config.SmoothCoeff = this.SmoothCoeff;
this.Config.KeepPrevFrame = this.KeepPrevFrame;
this.ViewConfig.GPU = this.SelectedGpuInfo?.Physics ?? 0;
ApplicationDomainEx.LiteDbContext.AlgorithmCableway.Upsert(this.Config);
ApplicationDomainEx.LiteDbContext.ViewConfig.Upsert(this.ViewConfig);
// 返回
return true;
}
/// <summary>
/// 应用设置
/// </summary>
/// <returns>是否成功</returns>
public override bool Apply()
{
return true;
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Framework.Common;
using VIZ.Framework.Core;
using VIZ.H2V.Domain;
using VIZ.H2V.Storage;
namespace VIZ.H2V.Module
{
/// <summary>
/// 设置面板模型 -- 战术机位
/// </summary>
public class AlgorithmTacticsPanelViewModel : AlgorithmPanelViewModelBase
{
// ======================================================================================
// === Field ===
// ======================================================================================
/// <summary>
/// 配置
/// </summary>
private AlgorithmTactics Config;
// ======================================================================================
// === Property ===
// ======================================================================================
#region PersonAreaProportion -- 人物面积占比
private double personAreaProportion;
/// <summary>
/// 人物面积占比
/// </summary>
public double PersonAreaProportion
{
get { return personAreaProportion; }
set { personAreaProportion = value; this.RaisePropertyChanged(nameof(PersonAreaProportion)); }
}
#endregion
#region PersonAreaProportionWeight -- 人物面积占比权重
private double personAreaProportionWeight;
/// <summary>
/// 人物面积占比权重
/// </summary>
public double PersonAreaProportionWeight
{
get { return personAreaProportionWeight; }
set { personAreaProportionWeight = value; this.RaisePropertyChanged(nameof(PersonAreaProportionWeight)); }
}
#endregion
#region Confidence -- 置信度
private double confidence;
/// <summary>
/// 置信度
/// </summary>
public double Confidence
{
get { return confidence; }
set { confidence = value; this.RaisePropertyChanged(nameof(Confidence)); }
}
#endregion
#region ConfidenceWeight -- 置信度权重
private double confidenceWeight;
/// <summary>
/// 置信度权重
/// </summary>
public double ConfidenceWeight
{
get { return confidenceWeight; }
set { confidenceWeight = value; this.RaisePropertyChanged(nameof(ConfidenceWeight)); }
}
#endregion
#region PositionToCenterWeight -- 距离中心位置权重
private double positionToCenterWeight;
/// <summary>
/// 距离中心位置权重
/// </summary>
public double PositionToCenterWeight
{
get { return positionToCenterWeight; }
set { positionToCenterWeight = value; this.RaisePropertyChanged(nameof(PositionToCenterWeight)); }
}
#endregion
#region NoBallAutoChangeToPerson -- 无球时自动跟人
private bool noBallAutoChangeToPerson;
/// <summary>
/// 无球时自动跟人
/// </summary>
public bool NoBallAutoChangeToPerson
{
get { return noBallAutoChangeToPerson; }
set { noBallAutoChangeToPerson = value; this.RaisePropertyChanged(nameof(NoBallAutoChangeToPerson)); }
}
#endregion
// ======================================================================================
// === Command ===
// ======================================================================================
// ======================================================================================
// === Override ===
// ======================================================================================
/// <summary>
/// 加载
/// </summary>
protected override void Loaded()
{
base.Loaded();
this.StrategyType = AlgorithmStrategyType.Tactics;
AlgorithmTactics config = ApplicationDomainEx.LiteDbContext.AlgorithmTactics.FindOne(p => p.ViewKey == this.ViewKey);
this.Config = config;
this.PersonAreaProportionWeight = config.PersonAreaProportionWeight;
this.PersonAreaProportion = config.PersonAreaProportion;
this.ConfidenceWeight = config.ConfidenceWeight;
this.Confidence = config.Confidence;
this.PositionToCenterWeight = config.PositionToCenterWeight;
this.NoBallAutoChangeToPerson = config.NoBallAutoChangeToPerson;
this.SmoothCoeff = config.SmoothCoeff;
this.KeepPrevFrame = config.KeepPrevFrame;
}
/// <summary>
/// 是否需要保存
/// </summary>
/// <returns>是否需要保存</returns>
public override bool IsNeedSave()
{
if (this.ViewConfig.StrategyType != this.StrategyType)
return false;
if (this.PersonAreaProportion != this.Config.PersonAreaProportion)
return true;
if (this.PersonAreaProportionWeight != this.Config.PersonAreaProportionWeight)
return true;
if (this.Confidence != this.Config.Confidence)
return true;
if (this.ConfidenceWeight != this.Config.ConfidenceWeight)
return true;
if (this.PositionToCenterWeight != this.Config.PositionToCenterWeight)
return true;
if (this.NoBallAutoChangeToPerson != this.Config.NoBallAutoChangeToPerson)
return true;
if (this.SmoothCoeff != this.Config.SmoothCoeff)
return true;
if (this.KeepPrevFrame != this.Config.KeepPrevFrame)
return true;
if (this.SelectedGpuInfo.Physics != this.ViewConfig.GPU)
return true;
return false;
}
/// <summary>
/// 是否需要重启算法
/// </summary>
/// <returns>是否需要重启算法</returns>
public override bool IsNeedRestart()
{
if (this.SelectedGpuInfo.Physics != this.ViewConfig.GPU)
return true;
return false;
}
/// <summary>
/// 保存
/// </summary>
public override bool Save()
{
// 校验
if (this.PersonAreaProportionWeight + this.ConfidenceWeight + this.PositionToCenterWeight > 100)
{
MessageBoxEx.ShowDialog("占比权重总和应该在100以内", this.GetWindow());
return false;
}
// 保存
this.Config.PersonAreaProportionWeight = this.PersonAreaProportionWeight;
this.Config.PersonAreaProportion = this.PersonAreaProportion;
this.Config.ConfidenceWeight = this.ConfidenceWeight;
this.Config.Confidence = this.Confidence;
this.Config.PositionToCenterWeight = this.PositionToCenterWeight;
this.Config.NoBallAutoChangeToPerson = this.NoBallAutoChangeToPerson;
this.Config.SmoothCoeff = this.SmoothCoeff;
this.Config.KeepPrevFrame = this.KeepPrevFrame;
this.ViewConfig.GPU = this.SelectedGpuInfo?.Physics ?? 0;
ApplicationDomainEx.LiteDbContext.AlgorithmTactics.Upsert(this.Config);
ApplicationDomainEx.LiteDbContext.ViewConfig.Upsert(this.ViewConfig);
// 返回
return true;
}
/// <summary>
/// 应用设置
/// </summary>
/// <returns>是否成功</returns>
public override bool Apply()
{
return true;
}
}
}
......@@ -155,6 +155,8 @@ namespace VIZ.H2V.Module
case AlgorithmStrategyType.Single: return typeof(AlgorithmSinglePanelView);
case AlgorithmStrategyType.Near: return typeof(AlgorithmNearPanelView);
case AlgorithmStrategyType.Sixteen: return typeof(AlgorithmSixteenPanelView);
case AlgorithmStrategyType.Tactics: return typeof(AlgorithmTacticsPanelView);
case AlgorithmStrategyType.Cableway: return typeof(AlgorithmCablewayPanelView);
default: return null;
}
}
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Framework.Common;
using VIZ.Framework.Connection;
using VIZ.H2V.Connection;
using VIZ.H2V.Domain;
using VIZ.H2V.Storage;
namespace VIZ.H2V.Module
{
/// <summary>
/// 算法控制器 -- 16米机位
/// </summary>
public class AlgorithmController_Cableway : AlgorithmControllerBase
{
/// <summary>
/// 算法控制器 -- 16米机位
/// </summary>
/// <param name="support">算法支持</param>
public AlgorithmController_Cableway(IAlgorithmSupport support) : base(support, AlgorithmStrategyType.Cableway)
{ }
/// <summary>
/// 切换至自动模式
/// </summary>
/// <param name="context">切换模式上下文</param>
public override void ChangeAutoMode(ChangeStrategyContext context)
{
UdpEndpointManager manager = ConnectionManager.UdpConnection.GetEndpointManager(this.Support.ViewKey);
AlgorithmSender.AutoMode(manager, this.BuildPackage(), this.Support.ID, this.Support.ViewConfig.IsSendToCrop);
}
/// <summary>
/// 初始化完成
/// </summary>
public override void CheckOk()
{
this.Support.ViewStatus = NDIViewStatus.CropRoi;
UdpEndpointManager manager = ConnectionManager.UdpConnection.GetEndpointManager(this.Support.ViewKey);
AlgorithmSender.AutoMode(manager, this.BuildPackage(), this.Support.ID, this.Support.ViewConfig.IsSendToCrop);
}
/// <summary>
/// 检测
/// </summary>
public override void Detect()
{
}
/// <summary>
/// 跟踪
/// </summary>
/// <param name="box">跟踪框</param>
public override void Tracking(TrackingBoxInfo box)
{
}
/// <summary>
/// 构建数据包
/// </summary>
/// <returns>数据包</returns>
public AlgorithmPackage__auto_mode_Cableway BuildPackage()
{
AlgorithmCableway config = ApplicationDomainEx.LiteDbContext.AlgorithmCableway.FindOne(p => p.ViewKey == this.Support.ViewKey);
if (config == null)
return null;
AlgorithmPackage__auto_mode_Cableway package = new AlgorithmPackage__auto_mode_Cableway();
package.smooth = config.SmoothCoeff;
package.max_fixed_frames = config.KeepPrevFrame;
package.min_human_area = config.PersonAreaProportion / 100d;
package.weight_area = config.PersonAreaProportionWeight / 100d;
package.min_conf = config.Confidence / 100d;
package.weight_conf = config.ConfidenceWeight / 100d;
package.weight_distance = config.PositionToCenterWeight / 100d;
package.auto_follow_human = config.NoBallAutoChangeToPerson ? 1 : 0;
return package;
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Framework.Common;
using VIZ.Framework.Connection;
using VIZ.H2V.Connection;
using VIZ.H2V.Domain;
using VIZ.H2V.Storage;
namespace VIZ.H2V.Module
{
/// <summary>
/// 算法控制器 -- 战术机位
/// </summary>
public class AlgorithmController_Tactics : AlgorithmControllerBase
{
/// <summary>
/// 算法控制器 -- 战术机位
/// </summary>
/// <param name="support">算法支持</param>
public AlgorithmController_Tactics(IAlgorithmSupport support) : base(support, AlgorithmStrategyType.Tactics)
{ }
/// <summary>
/// 切换至自动模式
/// </summary>
/// <param name="context">切换模式上下文</param>
public override void ChangeAutoMode(ChangeStrategyContext context)
{
UdpEndpointManager manager = ConnectionManager.UdpConnection.GetEndpointManager(this.Support.ViewKey);
AlgorithmSender.AutoMode(manager, this.BuildPackage(), this.Support.ID, this.Support.ViewConfig.IsSendToCrop);
}
/// <summary>
/// 初始化完成
/// </summary>
public override void CheckOk()
{
this.Support.ViewStatus = NDIViewStatus.CropRoi;
UdpEndpointManager manager = ConnectionManager.UdpConnection.GetEndpointManager(this.Support.ViewKey);
AlgorithmSender.AutoMode(manager, this.BuildPackage(), this.Support.ID, this.Support.ViewConfig.IsSendToCrop);
}
/// <summary>
/// 检测
/// </summary>
public override void Detect()
{
}
/// <summary>
/// 跟踪
/// </summary>
/// <param name="box">跟踪框</param>
public override void Tracking(TrackingBoxInfo box)
{
}
/// <summary>
/// 构建数据包
/// </summary>
/// <returns>数据包</returns>
public AlgorithmPackage__auto_mode_Tactics BuildPackage()
{
AlgorithmTactics config = ApplicationDomainEx.LiteDbContext.AlgorithmTactics.FindOne(p => p.ViewKey == this.Support.ViewKey);
if (config == null)
return null;
AlgorithmPackage__auto_mode_Tactics package = new AlgorithmPackage__auto_mode_Tactics();
package.smooth = config.SmoothCoeff;
package.max_fixed_frames = config.KeepPrevFrame;
package.min_human_area = config.PersonAreaProportion / 100d;
package.weight_area = config.PersonAreaProportionWeight / 100d;
package.min_conf = config.Confidence / 100d;
package.weight_conf = config.ConfidenceWeight / 100d;
package.weight_distance = config.PositionToCenterWeight / 100d;
package.auto_follow_human = config.NoBallAutoChangeToPerson ? 1 : 0;
return package;
}
}
}
......@@ -62,6 +62,8 @@ namespace VIZ.H2V.Module
this.AlgorithmControllerDic.Add(AlgorithmStrategyType.Single, new AlgorithmController_Single(this));
this.AlgorithmControllerDic.Add(AlgorithmStrategyType.Near, new AlgorithmController_Near(this));
this.AlgorithmControllerDic.Add(AlgorithmStrategyType.Sixteen, new AlgorithmController_Sixteen(this));
this.AlgorithmControllerDic.Add(AlgorithmStrategyType.Tactics, new AlgorithmController_Tactics(this));
this.AlgorithmControllerDic.Add(AlgorithmStrategyType.Cableway, new AlgorithmController_Cableway(this));
}
/// <summary>
......
......@@ -109,6 +109,26 @@ namespace VIZ.H2V.Module
ApplicationDomainEx.LiteDbContext.AlgorithmSixteen.Upsert(sixteenConfig);
}
// 战术机位
AlgorithmTactics tacticsConfig = ApplicationDomainEx.LiteDbContext.AlgorithmTactics.FindOne(p => p.ViewKey == viewKey);
if (tacticsConfig == null)
{
tacticsConfig = new AlgorithmTactics();
tacticsConfig.ViewKey = viewKey;
ApplicationDomainEx.LiteDbContext.AlgorithmTactics.Upsert(tacticsConfig);
}
// 索道机位
AlgorithmCableway cablewayConfig = ApplicationDomainEx.LiteDbContext.AlgorithmCableway.FindOne(p => p.ViewKey == viewKey);
if (cablewayConfig == null)
{
cablewayConfig = new AlgorithmCableway();
cablewayConfig.ViewKey = viewKey;
ApplicationDomainEx.LiteDbContext.AlgorithmCableway.Upsert(cablewayConfig);
}
}
/// <summary>
......
......@@ -94,6 +94,14 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="NDISettingView\View\Algorithm\AlgorithmCablewayPanelView.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="NDISettingView\View\Algorithm\AlgorithmTacticsPanelView.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="NDISettingView\View\Algorithm\AlgorithmSixteenPanelView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
......@@ -152,10 +160,20 @@
</Page>
</ItemGroup>
<ItemGroup>
<Compile Include="NDISettingView\ViewModel\Algorithm\AlgorithmCablewayPanelViewModel.cs" />
<Compile Include="NDISettingView\ViewModel\Algorithm\AlgorithmTacticsPanelViewModel.cs" />
<Compile Include="NDISettingView\ViewModel\INDISetting.cs" />
<Compile Include="NDISettingView\View\Algorithm\AlgorithmCablewayPanelView.xaml.cs">
<DependentUpon>AlgorithmCablewayPanelView.xaml</DependentUpon>
</Compile>
<Compile Include="NDISettingView\View\Algorithm\AlgorithmTacticsPanelView.xaml.cs">
<DependentUpon>AlgorithmTacticsPanelView.xaml</DependentUpon>
</Compile>
<Compile Include="NDIView\Controller\Algorithm\AlgorithmControllerBase.cs" />
<Compile Include="NDIView\Controller\Algorithm\IAlgorithmController.cs" />
<Compile Include="NDIView\Controller\Algorithm\IAlgorithmSupport.cs" />
<Compile Include="NDIView\Controller\Algorithm\Strategy\AlgorithmController_Cableway.cs" />
<Compile Include="NDIView\Controller\Algorithm\Strategy\AlgorithmController_Tactics.cs" />
<Compile Include="NDIView\Controller\Algorithm\Strategy\AlgorithmController_Sixteen.cs" />
<Compile Include="NDIView\Controller\Algorithm\Strategy\AlgorithmController_Near.cs" />
<Compile Include="NDIView\Controller\Algorithm\Strategy\AlgorithmController_Single.cs" />
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VIZ.H2V.Storage
{
/// <summary>
/// 索道机位
/// </summary>
public class AlgorithmCableway : AlgorithmBase
{
/// <summary>
/// 人物面积占比
/// </summary>
public double PersonAreaProportion { get; set; } = 9;
/// <summary>
/// 人物面积占比权重
/// </summary>
public double PersonAreaProportionWeight { get; set; } = 40;
/// <summary>
/// 置信度
/// </summary>
public double Confidence { get; set; } = 40;
/// <summary>
/// 置信度权重
/// </summary>
public double ConfidenceWeight { get; set; } = 40;
/// <summary>
/// 距离中心位置权重
/// </summary>
public double PositionToCenterWeight { get; set; } = 20;
/// <summary>
/// 无球时自动切换为跟人
/// </summary>
public bool NoBallAutoChangeToPerson { get; set; } = true;
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VIZ.H2V.Storage
{
/// <summary>
/// 战术机位
/// </summary>
public class AlgorithmTactics : AlgorithmBase
{
/// <summary>
/// 人物面积占比
/// </summary>
public double PersonAreaProportion { get; set; } = 9;
/// <summary>
/// 人物面积占比权重
/// </summary>
public double PersonAreaProportionWeight { get; set; } = 40;
/// <summary>
/// 置信度
/// </summary>
public double Confidence { get; set; } = 40;
/// <summary>
/// 置信度权重
/// </summary>
public double ConfidenceWeight { get; set; } = 40;
/// <summary>
/// 距离中心位置权重
/// </summary>
public double PositionToCenterWeight { get; set; } = 20;
/// <summary>
/// 无球时自动切换为跟人
/// </summary>
public bool NoBallAutoChangeToPerson { get; set; } = true;
}
}
......@@ -28,6 +28,18 @@ namespace VIZ.H2V.Storage
/// 16米机位
/// </summary>
[Description("16米机位")]
Sixteen = 3
Sixteen = 3,
/// <summary>
/// 战术机位
/// </summary>
[Description("战术机位")]
Tactics = 4,
/// <summary>
/// 索道机位
/// </summary>
[Description("索道机位")]
Cableway = 5
}
}
......@@ -39,6 +39,9 @@ namespace VIZ.H2V.Storage
this.AlgorithmSingle = this.Database.GetCollection<AlgorithmSingle>();
this.AlgorithmNear = this.Database.GetCollection<AlgorithmNear>();
this.AlgorithmSixteen = this.Database.GetCollection<AlgorithmSixteen>();
this.AlgorithmTactics = this.Database.GetCollection<AlgorithmTactics>();
this.AlgorithmCableway = this.Database.GetCollection<AlgorithmCableway>();
// 视图设置
this.ViewConfig = this.Database.GetCollection<NdiViewConfig>();
// 系统设置
this.SystemConfig = this.Database.GetCollection<SystemConfig>();
......@@ -83,6 +86,16 @@ namespace VIZ.H2V.Storage
public ILiteCollection<AlgorithmSixteen> AlgorithmSixteen { get; private set; }
/// <summary>
/// 战术机位
/// </summary>
public ILiteCollection<AlgorithmTactics> AlgorithmTactics { get; private set; }
/// <summary>
/// 索道机位
/// </summary>
public ILiteCollection<AlgorithmCableway> AlgorithmCableway { get; private set; }
/// <summary>
/// NDI视图配置
/// </summary>
public ILiteCollection<NdiViewConfig> ViewConfig { get; private set; }
......@@ -106,6 +119,8 @@ namespace VIZ.H2V.Storage
this.AlgorithmSingle = null;
this.AlgorithmNear = null;
this.AlgorithmSixteen = null;
this.AlgorithmTactics = null;
this.AlgorithmCableway = null;
this.ViewConfig = null;
this.SystemConfig = null;
......
......@@ -95,6 +95,8 @@
<Compile Include="LiteDB\Algorithm\AlgorithmStrategyType.cs" />
<Compile Include="LiteDB\Algorithm\Algorithm\AlgorithmNear.cs" />
<Compile Include="LiteDB\Algorithm\Algorithm\AlgorithmSingle.cs" />
<Compile Include="LiteDB\Algorithm\Algorithm\AlgorithmCableway.cs" />
<Compile Include="LiteDB\Algorithm\Algorithm\AlgorithmTactics.cs" />
<Compile Include="LiteDB\Algorithm\Algorithm\AlgorithmSixteen.cs" />
<Compile Include="LiteDB\LiteDbContext.cs" />
<Compile Include="LiteDB\NdiView\NdiViewConfig.cs" />
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Framework.Common;
using VIZ.Framework.Connection;
using VIZ.H2V.Connection;
using VIZ.H2V.Domain;
using VIZ.H2V.Storage;
namespace VIZ.H2V.Module
{
/// <summary>
/// 算法控制器 -- 16米机位
/// </summary>
public class AlgorithmController_Sixteen : AlgorithmControllerBase
{
/// <summary>
/// 算法控制器 -- 16米机位
/// </summary>
/// <param name="support">算法支持</param>
public AlgorithmController_Sixteen(IAlgorithmSupport support) : base(support, AlgorithmStrategyType.Sixteen)
{ }
/// <summary>
/// 切换至自动模式
/// </summary>
/// <param name="context">切换模式上下文</param>
public override void ChangeAutoMode(ChangeStrategyContext context)
{
UdpEndpointManager manager = ConnectionManager.UdpConnection.GetEndpointManager(this.Support.ViewKey);
AlgorithmSender.AutoMode(manager, this.BuildPackage(), this.Support.ID, this.Support.ViewConfig.IsSendToCrop);
}
/// <summary>
/// 初始化完成
/// </summary>
public override void CheckOk()
{
this.Support.ViewStatus = NDIViewStatus.CropRoi;
UdpEndpointManager manager = ConnectionManager.UdpConnection.GetEndpointManager(this.Support.ViewKey);
AlgorithmSender.AutoMode(manager, this.BuildPackage(), this.Support.ID, this.Support.ViewConfig.IsSendToCrop);
}
/// <summary>
/// 检测
/// </summary>
public override void Detect()
{
}
/// <summary>
/// 跟踪
/// </summary>
/// <param name="box">跟踪框</param>
public override void Tracking(TrackingBoxInfo box)
{
}
/// <summary>
/// 构建数据包
/// </summary>
/// <returns>数据包</returns>
public AlgorithmPackage__auto_mode_Sixteen BuildPackage()
{
AlgorithmSixteen config = ApplicationDomainEx.LiteDbContext.AlgorithmSixteen.FindOne(p => p.ViewKey == this.Support.ViewKey);
if (config == null)
return null;
AlgorithmPackage__auto_mode_Sixteen package = new AlgorithmPackage__auto_mode_Sixteen();
package.smooth = config.SmoothCoeff;
package.max_fixed_frames = config.KeepPrevFrame;
package.min_human_area = config.PersonAreaProportion / 100d;
package.weight_area = config.PersonAreaProportionWeight / 100d;
package.min_conf = config.Confidence / 100d;
package.weight_conf = config.ConfidenceWeight / 100d;
package.weight_distance = config.PositionToCenterWeight / 100d;
package.auto_follow_human = config.NoBallAutoChangeToPerson ? 1 : 0;
return package;
}
}
}
......@@ -64,6 +64,9 @@
<Reference Include="ICSharpCode.SharpZipLib, Version=1.3.3.11, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL">
<HintPath>..\packages\SharpZipLib.1.3.3\lib\net45\ICSharpCode.SharpZipLib.dll</HintPath>
</Reference>
<Reference Include="LiteDB, Version=5.0.12.0, Culture=neutral, PublicKeyToken=4ee40123013c9f27, processorArchitecture=MSIL">
<HintPath>..\packages\LiteDB.5.0.12\lib\net45\LiteDB.dll</HintPath>
</Reference>
<Reference Include="log4net, Version=2.0.14.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>..\packages\log4net.2.0.14\lib\net45\log4net.dll</HintPath>
</Reference>
......@@ -85,6 +88,7 @@
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Data" />
<Reference Include="System.Runtime" />
<Reference Include="System.Web" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
......@@ -112,6 +116,7 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Compile Include="AlgorithmController_Sixteen.cs" />
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType>
......
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="LiteDB" version="5.0.12" targetFramework="net48" />
<package id="log4net" version="2.0.14" targetFramework="net48" />
<package id="Microsoft.Xaml.Behaviors.Wpf" version="1.1.39" targetFramework="net48" />
<package id="NPOI" version="2.5.6" targetFramework="net48" />
......
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