Commit 58136158 by 鲁志-悦动

只在调整入点的时候显示入点跟踪框 And 入点和入点跟踪框不一致加提示 And 有入点跟踪框的时候点选的入点框数据清空 And 修复双人项目有入点跟踪框的情况下只发送一人数据的缺陷

parent 1b842e9b
......@@ -10,11 +10,11 @@ none
false
DEBUG;TRACE
22-1578589972
1-1441241311
11-1602666439
23-2035776870
221979955803
1470602451
11-350624472
24-1321085892
Resources\StringResource.zh-CN.xaml;Resources\StringResource.en.xaml;Style\Button\Button_NdiView.xaml;Style\Button\Button_Setting.xaml;Style\Button\Button_WindowTop.xaml;Style\CheckBox\CheckBox_NdiView.xaml;Style\CheckBox\CheckBox_RaidoButtonStyle.xaml;Style\CheckBox\CheckBox_Setting.xaml;Style\CheckBox\CheckBox_WindowTop.xaml;Style\ComboBox\ComboBox_Setting.xaml;Style\HotkeyBox\HotkeyBox_Setting.xaml;Style\MessageBox\MessageBoxEx.xaml;Style\RadioButton\RadioButton_FootballSide.xaml;Style\RadioButton\RadioButton_NdiMainViewBlue.xaml;Style\RadioButton\RadioButton_NdiView.xaml;Style\RadioButton\RadioButton_Setting.xaml;Style\Slider\Slider_Setting.xaml;Style\TextBlock\TextBlock_Setting.xaml;Style\TextBox\TextBox_Setting.xaml;Style\ToogleButton\ToogleButton_Setting.xaml;Themes\Generic.xaml;Toolkit\NumericUpDown\NumericUpDown.xaml;
True
False
......@@ -46,9 +46,9 @@ namespace VIZ.FGOUT.Module
public Rect rectReplay;
// public Rectangle rectInvalid;
public List<Rect> rectsReplay = new List<Rect>();
public TrackingBoxInfo saveInfo = new TrackingBoxInfo();
public List<TrackingBoxInfo> saveInfos = new List<TrackingBoxInfo>();
public static List<Rect> rectsReplay = new List<Rect>();
public static TrackingBoxInfo saveInfo = new TrackingBoxInfo();
public static List<TrackingBoxInfo> saveInfos = new List<TrackingBoxInfo>();
// public Path myPath = new Path();
// public Path myPath1 = new Path();
......
......@@ -164,6 +164,8 @@ namespace VIZ.FGOUT.Module
/// </summary>
private void NDIStream_ExecuteVideoFrame(object sender, VideoFrameEventArgs e)
{
try
{
var view = this.GetView<NDIView>();
if (view == null)
return;
......@@ -222,6 +224,7 @@ namespace VIZ.FGOUT.Module
}
else if (matExtend.TimeStamp == EndTime)
break;
index++;
}
......@@ -250,7 +253,7 @@ namespace VIZ.FGOUT.Module
#region 公共代码
//var index = view.vm.SliderValue;
if (index >= (50* STREAM_CACHEED_TIME)) index = (50 * STREAM_CACHEED_TIME - 1);
if (index >= (50 * STREAM_CACHEED_TIME)) index = (50 * STREAM_CACHEED_TIME - 1);
if ((buffer.Count - 1) >= index && index >= 0)
{
var dse = buffer.ElementAt(index);
......@@ -284,6 +287,7 @@ namespace VIZ.FGOUT.Module
_cam3Infos.Add(info);
}
}
//匹配的时候只匹配BBox下的
if (infoBBuffers.Count > 0)
{
......@@ -296,7 +300,7 @@ namespace VIZ.FGOUT.Module
#region 算法track到人的情况下跟踪框标红
if (_cam3BInfos.Count > 0)
if (_cam3BInfos.Count > 0 && view.vm.IsStartValue)
{
var info2 = _cam3BInfos[0];
if (info2.BboxType != null && info2.BboxType.Equals(AlgorithmPackageSignal.track))
......@@ -304,7 +308,8 @@ namespace VIZ.FGOUT.Module
var gameName = ApplicationDomainEx.LiteDbContext.ViewConfig
.FindOne(p => p.ViewKey == NDIViewKeys.CAM_1).GameName;
//当双人3m跳水,双人10m跳水,双人速度攀岩时,保存2个入点框
if (gameName.Equals(SportsProjectCodes.SS) || gameName.Equals(SportsProjectCodes.ST) ||
if (gameName.Equals(SportsProjectCodes.SS) ||
gameName.Equals(SportsProjectCodes.ST) ||
gameName.Equals(SportsProjectCodes.SP))
{
_twoInfos = new List<TrackingBoxInfo>();
......@@ -317,7 +322,12 @@ namespace VIZ.FGOUT.Module
//记录标红框时入点时间戳
_RecordStartTime = saveInfo.TimeCode;
//赋值
_twoInfos.Add(saveInfo);
//清除点选跟踪框的数据
//view.saveInfos = new List<TrackingBoxInfo>();
NDIView.saveInfos = new List<TrackingBoxInfo>();
}
}
else
......@@ -329,8 +339,17 @@ namespace VIZ.FGOUT.Module
//记录标红框时入点时间戳
_RecordStartTime = info2.TimeCode;
//赋值
_singleInfo = info2;
}
//清除点选跟踪框的数据
//view.saveInfo = new TrackingBoxInfo();
NDIView.saveInfo = new TrackingBoxInfo();
//清除拖框的数据
//view.rectsReplay.Clear();
NDIView.rectsReplay.Clear();
}
}
......@@ -351,7 +370,6 @@ namespace VIZ.FGOUT.Module
var view3 = this.FindChild<NDIView>(Application.Current.MainWindow, NDIViewKeys.cam3);
if (view3 != null)
{
// 更新视频流
view3.video.UpdateVideoFrame(dsExtend, true);
......@@ -396,12 +414,16 @@ namespace VIZ.FGOUT.Module
if (_cam3BInfos.Count > 0)
{
_cam3StaticInfos = _cam3BInfos;
var gameName = ApplicationDomainEx.LiteDbContext.ViewConfig.FindOne(p => p.ViewKey == NDIViewKeys.CAM_1).GameName;
var gameName = ApplicationDomainEx.LiteDbContext.ViewConfig
.FindOne(p => p.ViewKey == NDIViewKeys.CAM_1).GameName;
//当双人3m跳水,双人10m跳水,双人速度攀岩时,保存2个入点框
//if (gameName.Equals("SS") || gameName.Equals("ST") || gameName.Equals("SP"))
if (gameName.Equals(SportsProjectCodes.SS) || gameName.Equals(SportsProjectCodes.ST) || gameName.Equals(SportsProjectCodes.SP))
if (gameName.Equals(SportsProjectCodes.SS) ||
gameName.Equals(SportsProjectCodes.ST) ||
gameName.Equals(SportsProjectCodes.SP))
{
foreach (var saveInfo in view3.saveInfos)
foreach (var saveInfo in NDIView.saveInfos)
//foreach (var saveInfo in view3.saveInfos)
{
//更新红色点中框
if (saveInfo.SrcRect.Left > 0)
......@@ -423,7 +445,8 @@ namespace VIZ.FGOUT.Module
else
{
//单人
var info = view3.saveInfo;
//var info = view3.saveInfo;
var info = NDIView.saveInfo;
//更新红色点中框
if (info.SrcRect.Left > 0)
{
......@@ -437,6 +460,7 @@ namespace VIZ.FGOUT.Module
_RecordStartTime = info.TimeCode;
}
}
//先清除跟踪框
//view3.video.ClearTrackingBox();
//再更新跟踪框信息
......@@ -483,7 +507,7 @@ namespace VIZ.FGOUT.Module
//时间戳获取
timecode = e.Frame.TimeStamp;
//_frameBuffer.AddFrame(resizedFrame);
_frameBuffer.AddFrame(new MatExtend(){ Mat = resizedFrame, TimeStamp = timecode });
_frameBuffer.AddFrame(new MatExtend() { Mat = resizedFrame, TimeStamp = timecode });
// 释放视频帧资源
mat.Dispose();
......@@ -519,31 +543,37 @@ namespace VIZ.FGOUT.Module
#endregion
}
// 更新画面
view.video.UpdateVideoFrame(e.Frame);
// 更新手动裁切框
// 仅手动模式下处理 & 居中模式下处理 & 需要进行裁切时才处理
if ((this.StrategyMode == AlgorithmStrategyMode.center_mode || this.StrategyMode == AlgorithmStrategyMode.manual_mode) && this.IsUseClip)
if ((this.StrategyMode == AlgorithmStrategyMode.center_mode ||
this.StrategyMode == AlgorithmStrategyMode.manual_mode) && this.IsUseClip)
this.UpdateClipBoxWithManualAndCenter();
// 获取将要发送的裁切数据, 无论什么模式均要发送
Navigation3DSmoothWithSavitzkyGolayResult sendValue = this.ManualController.GetSavitzkyGolayValue(e.Frame.TimeStamp, this.ClipBoxX + ApplicationDomainEx.VIDEO_CLIP_BOX_WIDTH / 2);
Navigation3DSmoothWithSavitzkyGolayResult sendValue =
this.ManualController.GetSavitzkyGolayValue(e.Frame.TimeStamp,
this.ClipBoxX + ApplicationDomainEx.VIDEO_CLIP_BOX_WIDTH / 2);
// 如果当前模式为手动模式或居中模式且处于接收裁切信号状态,并且需要进行裁切,那么发送手动裁切信号 && this.ViewStatus == NDIViewStatus.CropRoi
if (e.Frame != null && this.IsUseClip
&& (this.StrategyMode == AlgorithmStrategyMode.center_mode || this.StrategyMode == AlgorithmStrategyMode.manual_mode))
&& (this.StrategyMode == AlgorithmStrategyMode.center_mode ||
this.StrategyMode == AlgorithmStrategyMode.manual_mode))
{
UdpEndpointManager manager = ConnectionManager.UdpConnection.GetEndpointManager(this.ViewKey);
if (manager == null)
return;
if (manager == null) return;
List<int> roi = this.GetManulRoi();
// 向算法发送裁切框
if (this.StrategyMode == AlgorithmStrategyMode.center_mode)
AlgorithmSender.CenterMode(manager, this.ID, this.ViewConfig.IsSendToCrop, roi, this.AlgorithmConfig.SmoothCoeff);
AlgorithmSender.CenterMode(manager, this.ID, this.ViewConfig.IsSendToCrop, roi,
this.AlgorithmConfig.SmoothCoeff);
else if (this.StrategyMode == AlgorithmStrategyMode.manual_mode)
AlgorithmSender.ManualMode(manager, this.ID, this.ViewConfig.IsSendToCrop, roi, this.AlgorithmConfig.SmoothCoeff);
AlgorithmSender.ManualMode(manager, this.ID, this.ViewConfig.IsSendToCrop, roi,
this.AlgorithmConfig.SmoothCoeff);
// 在需要发送裁切框时
//if (this.viewConfig.IsSendToCrop)
......@@ -559,6 +589,12 @@ namespace VIZ.FGOUT.Module
//this.ClipFPS.CalcFps();
}
}
catch (Exception ex)
{
log.Error(ex);
return;
}
}
}
public class TrackingBoxInfoBuffer
......
......@@ -263,18 +263,40 @@ namespace VIZ.FGOUT.Module
//前三个手拖框、双人项目、单人项目都是判断是否有值
//手拖框
if (nDIView.rectsReplay.Count > 0 && nDIView.rectsReplay[0].Width > 0 && nDIView.rectsReplay[0].Height > 0)
//if (nDIView.rectsReplay.Count > 0 && nDIView.rectsReplay[0].Width > 0 && nDIView.rectsReplay[0].Height > 0)
//{
// inPoints = Coordinate(nDIView.rectsReplay, srcWidth, srcHeight);
// isInPoint = true;
//}
if (NDIView.rectsReplay.Count > 0 && NDIView.rectsReplay[0].Width > 0 && NDIView.rectsReplay[0].Height > 0)
{
inPoints = Coordinate(nDIView.rectsReplay, srcWidth, srcHeight);
inPoints = Coordinate(NDIView.rectsReplay, srcWidth, srcHeight);
isInPoint = true;
}
//双人项目
else if(nDIView.saveInfos.Count > 0)
//else if(nDIView.saveInfos.Count > 0)
//{
// if (nDIView.saveInfos.Count == 2)
// {
// if (InPointIsMoved()) return; //入点和入点标记框位置不一致,返回
// inPoints = CoordinateTrackingBoxInfos(nDIView.saveInfos, srcWidth, srcHeight);
// isInPoint = true;
// }
// else
// {
// WPFHelper.BeginInvoke(() =>
// {
// MessageBoxEx.ShowDialog("双人比赛项目应选择两个入点.");
// });
// return;
// }
//}
else if (NDIView.saveInfos.Count > 0)
{
if (nDIView.saveInfos.Count == 2)
if (NDIView.saveInfos.Count == 2)
{
if (InPointIsMoved()) return; //入点和入点标记框位置不一致,返回
inPoints = CoordinateTrackingBoxInfos(nDIView.saveInfos, srcWidth, srcHeight);
inPoints = CoordinateTrackingBoxInfos(NDIView.saveInfos, srcWidth, srcHeight);
isInPoint = true;
}
else
......@@ -296,21 +318,29 @@ namespace VIZ.FGOUT.Module
// isInPoint = true;
// }
//}
else if (nDIView.saveInfo.SrcRect.Left > 0)
//else if (nDIView.saveInfo.SrcRect.Left > 0)
//{
// if (InPointIsMoved()) return; //入点和入点标记框位置不一致,返回
// inPoints = CoordinateTrackingBoxInfo(nDIView.saveInfo.SrcRect, srcWidth, srcHeight);
// isInPoint = true;
//}
else if (NDIView.saveInfo.SrcRect.Left > 0)
{
if (InPointIsMoved()) return; //入点和入点标记框位置不一致,返回
inPoints = CoordinateTrackingBoxInfo(nDIView.saveInfo.SrcRect, srcWidth, srcHeight);
inPoints = CoordinateTrackingBoxInfo(NDIView.saveInfo.SrcRect, srcWidth, srcHeight);
isInPoint = true;
}
#region 算法识别到人的情况下
else if (_twoInfos.Count > 0)
{
if (InPointIsMoved()) return; //入点和入点标记框位置不一致,返回
inPoints = CoordinateTrackingBoxInfos(_twoInfos, srcWidth, srcHeight);
isInPoint = true;
}
else if (_singleInfo.SrcRect.Left > 0)
{
if (InPointIsMoved()) return; //入点和入点标记框位置不一致,返回
inPoints = CoordinateTrackingBoxInfo(_singleInfo.SrcRect, srcWidth, srcHeight);
isInPoint = true;
}
......@@ -361,11 +391,14 @@ namespace VIZ.FGOUT.Module
if (this.ViewKey != NDIViewKeys.CAM_3) return;
var ndiView = this.GetView<NDIView>();
if (ndiView == null) return;
ndiView.rectsReplay.Clear();
//ndiView.rectsReplay.Clear();
NDIView.rectsReplay.Clear();
ndiView.canvas1.Children.Clear();
//清除跟踪框的数据
ndiView.saveInfo = new TrackingBoxInfo();
ndiView.saveInfos = new List<TrackingBoxInfo>();
//ndiView.saveInfo = new TrackingBoxInfo();
//ndiView.saveInfos = new List<TrackingBoxInfo>();
NDIView.saveInfo = new TrackingBoxInfo();
NDIView.saveInfos = new List<TrackingBoxInfo>();
_singleInfo = new TrackingBoxInfo();
_twoInfos = new List<TrackingBoxInfo>();
......@@ -522,16 +555,32 @@ namespace VIZ.FGOUT.Module
NDIView nDIView = this.GetView<NDIView>();
if (nDIView == null) return;
//清除拖框的数据
nDIView.rectsReplay.Clear();
//nDIView.rectsReplay.Clear();
NDIView.rectsReplay.Clear();
nDIView.canvas1.Children.Clear();
//清除跟踪框的数据
nDIView.saveInfo = new TrackingBoxInfo();
nDIView.saveInfos = new List<TrackingBoxInfo>();
//nDIView.saveInfo = new TrackingBoxInfo();
//nDIView.saveInfos = new List<TrackingBoxInfo>();
NDIView.saveInfo = new TrackingBoxInfo();
NDIView.saveInfos = new List<TrackingBoxInfo>();
_singleInfo = new TrackingBoxInfo();
_twoInfos = new List<TrackingBoxInfo>();
}
}
/// <summary>
/// 清除拖框和跟踪框的数据
/// </summary>
//private void ClearMoveAndTrackRectangleBoxData()
//{
// //清除拖框的数据
// nDIView.rectsReplay.Clear();
// nDIView.canvas1.Children.Clear();
// //清除跟踪框的数据
// nDIView.saveInfo = new TrackingBoxInfo();
// nDIView.saveInfos = new List<TrackingBoxInfo>();
//}
public bool IsMark;
/// <summary>
/// 算法标记命令
......@@ -1749,8 +1798,10 @@ namespace VIZ.FGOUT.Module
// view.rectsInvalid.RemoveAt(view.rectsInvalid.Count - 1);
else if (IsDrawInvalidPlace && view.polygonsInvalid.Count > 0)
view.polygonsInvalid.RemoveAt(view.polygonsInvalid.Count - 1);
else if (IsReplay && view.rectsReplay.Count > 0)
view.rectsReplay.RemoveAt(view.rectsReplay.Count - 1);
//else if (IsReplay && view.rectsReplay.Count > 0)
// view.rectsReplay.RemoveAt(view.rectsReplay.Count - 1);
else if (IsReplay && NDIView.rectsReplay.Count > 0)
NDIView.rectsReplay.RemoveAt(NDIView.rectsReplay.Count - 1);
//先清空
view.canvas1.Children.Clear();
......
......@@ -55,5 +55,5 @@ using System.Windows;
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.8.0")]
[assembly: AssemblyFileVersion("1.0.8.0")]
[assembly: AssemblyVersion("1.0.9.0")]
[assembly: AssemblyFileVersion("1.0.9.0")]
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