Commit 7b6c36b6 by 鲁志-悦动

优化入出点自动跟踪和手拖框混合的逻辑

parent e57a4a7c
...@@ -20,6 +20,7 @@ using VIZ.Framework.Common; ...@@ -20,6 +20,7 @@ using VIZ.Framework.Common;
using VIZ.Framework.Connection; using VIZ.Framework.Connection;
using VIZ.Framework.Core; using VIZ.Framework.Core;
using VIZ.Framework.Domain; using VIZ.Framework.Domain;
using VIZ.Framework.Storage;
using Application = System.Windows.Application; using Application = System.Windows.Application;
namespace VIZ.FGOUT.Module namespace VIZ.FGOUT.Module
...@@ -540,28 +541,31 @@ namespace VIZ.FGOUT.Module ...@@ -540,28 +541,31 @@ namespace VIZ.FGOUT.Module
{ {
UdpEndpointManager manager = ConnectionManager.UdpConnection.GetEndpointManager(NDIViewKeys.CAM_1); UdpEndpointManager manager = ConnectionManager.UdpConnection.GetEndpointManager(NDIViewKeys.CAM_1);
if (manager == null) return; if (manager == null) return;
var number = ApplicationDomainEx.LiteDbContext.ViewConfig.FindOne(p => p.ViewKey == NDIViewKeys.CAM_1) var number = ApplicationDomainEx.LiteDbContext.ViewConfig.FindOne(p => p.ViewKey == NDIViewKeys.CAM_1)
.GameName; .GameName;
if (!string.IsNullOrEmpty(number)) if (!string.IsNullOrEmpty(number))
{ {
var config = ApplicationDomainEx.LiteDbContext.JavelinThrowConfig.FindOne(p => p.Number == number); var config = ApplicationDomainEx.LiteDbContext.JavelinThrowConfig.FindOne(p => p.Number == number);
if (config == null) return; if (config == null) return;
//拿出来,更新修改数据 //拿出来,修改数据
var alPackage = (AlgorithmPackage_Figout_sports_model)JsonConvert.DeserializeObject(config.AlgorithmData, typeof(AlgorithmPackage_Figout_sports_model)); var alPackage = (AlgorithmPackage_Figout_sports_model)JsonConvert.DeserializeObject(config.AlgorithmData, typeof(AlgorithmPackage_Figout_sports_model));
if (alPackage == null) return; if (alPackage == null) return;
if (IsIntervalPixel) alPackage.Matting_interval = Matting_interval;
{
alPackage.Matting_interval = 0;
}
else
{
alPackage.Matting_interval = Matting_interval;
}
alPackage.Moving_pixel = Moving_pixel; alPackage.Moving_pixel = Moving_pixel;
alPackage.Remove_out_point_pixel = Remove_out_point_pixel; alPackage.Remove_out_point_pixel = Remove_out_point_pixel;
alPackage.Is_Keep_highest = IsKeepHighest; alPackage.Is_Keep_highest = IsKeepHighest;
alPackage.Is_Big_Model = IsBigModel; alPackage.Is_Big_Model = IsBigModel;
//再放回数据库
var algorithmMessage = JsonConvert.SerializeObject(alPackage, JSON_SERIALIZER_SETTINGS);
config.AlgorithmData = algorithmMessage;
ApplicationDomainEx.LiteDbContext.JavelinThrowConfig.Upsert(config);
if (IsIntervalPixel)
{
alPackage.Matting_interval = 0;
}
//发送给算法 //发送给算法
manager.SendJson(alPackage); manager.SendJson(alPackage);
...@@ -572,18 +576,6 @@ namespace VIZ.FGOUT.Module ...@@ -572,18 +576,6 @@ namespace VIZ.FGOUT.Module
MessageBoxEx.ShowDialog("算法参数保存成功。"); MessageBoxEx.ShowDialog("算法参数保存成功。");
}); });
} }
////如果IsIntervalPixel,把_temp_Matting_interval赋值给Matting_interval
//if (IsIntervalPixel)
//{
// alPackage.Matting_interval = _temp_Matting_interval;
//}
alPackage.Matting_interval = Matting_interval;
//再放回去
var algorithmMessage = JsonConvert.SerializeObject(alPackage, JSON_SERIALIZER_SETTINGS);
config.AlgorithmData = algorithmMessage;
ApplicationDomainEx.LiteDbContext.JavelinThrowConfig.Upsert(config);
} }
} }
...@@ -1756,12 +1748,16 @@ namespace VIZ.FGOUT.Module ...@@ -1756,12 +1748,16 @@ namespace VIZ.FGOUT.Module
private void NotCut() private void NotCut()
{ {
// 发送UDP命令给音视频 // 发送UDP命令给音视频
UdpEndpointManager manager = ConnectionManager.UdpConnection.GetEndpointManager(NDIViewKeys.CAM_1__CLIP); var manager = ConnectionManager.UdpConnection.GetEndpointManager(NDIViewKeys.CAM_1__CLIP);
if (manager == null) return; if (manager == null) return;
CutPackage package = new CutPackage() { point = new int[] { 0, 0 },width = 3840, height = 2160, type = ClipPackageSignal.CUT }; // 视频的宽度和高度
var resWith = ApplicationDomain.IniStorage.GetValue<VideoConfig, int>(p => p.VIDEO_WIDTH);
var resHeight = ApplicationDomain.IniStorage.GetValue<VideoConfig, int>(p => p.VIDEO_HEIGHT);
var package = new CutPackage() { point = new int[] { 0, 0 },width = resWith, height = resHeight, type = ClipPackageSignal.CUT };
manager.SendJson(package); manager.SendJson(package);
WPFHelper.BeginInvoke(() => { MessageBoxEx.ShowDialog("取消裁切发送成功。"); }); //WPFHelper.BeginInvoke(() => { MessageBoxEx.ShowDialog("取消裁切发送成功。"); });
} }
#endregion #endregion
......
...@@ -344,45 +344,46 @@ namespace VIZ.FGOUT.Module ...@@ -344,45 +344,46 @@ namespace VIZ.FGOUT.Module
// } // }
//} //}
//裁切 ////1
if (vm.IsSelected) ////裁切
{ //if (vm.IsSelected)
if (rectSelected.Width > 320 && rectSelected.Height > 180) //{
{ // if (rectSelected.Width > 320 && rectSelected.Height > 180)
Path tempPath = new Path(); // {
foreach (UIElement uec in canvas1.Children) // Path tempPath = new Path();
{ // foreach (UIElement uec in canvas1.Children)
var path = uec as Path; // {
if (path?.Stroke == Brushes.Yellow) // var path = uec as Path;
{ // if (path?.Stroke == Brushes.Yellow)
tempPath = path; // {
} // tempPath = path;
} // }
canvas1.Children.Remove(tempPath); // }
// canvas1.Children.Remove(tempPath);
//16:9 // //16:9
rectSelected.Height = rectSelected.Width * 9 / 16; // rectSelected.Height = rectSelected.Width * 9 / 16;
//高度出画面的情况 // //高度出画面的情况
if (rectSelected.TopLeft.Y + rectSelected.Height > this.video.Height) // if (rectSelected.TopLeft.Y + rectSelected.Height > this.video.Height)
{ // {
//先算出高,再反算出宽 // //先算出高,再反算出宽
rectSelected.Height = this.video.Height - rectSelected.TopLeft.Y - 6; // rectSelected.Height = this.video.Height - rectSelected.TopLeft.Y - 6;
rectSelected.Width = rectSelected.Height * 16 / 9; // rectSelected.Width = rectSelected.Height * 16 / 9;
} // }
aa = new PathGeometry(); // aa = new PathGeometry();
aa.AddGeometry(new RectangleGeometry(rectSelected)); // aa.AddGeometry(new RectangleGeometry(rectSelected));
var myPath = new Path() // var myPath = new Path()
{ // {
Fill = Brushes.Transparent, // Fill = Brushes.Transparent,
Stroke = Brushes.Yellow, // Stroke = Brushes.Yellow,
StrokeThickness = 1, // StrokeThickness = 1,
Data = aa // Data = aa
}; // };
this.canvas1.Children.Add(myPath); // this.canvas1.Children.Add(myPath);
} // }
} //}
if (vm.IsReplay) if (vm.IsReplay)
{ {
...@@ -452,7 +453,8 @@ namespace VIZ.FGOUT.Module ...@@ -452,7 +453,8 @@ namespace VIZ.FGOUT.Module
var y = Convert.ToInt32(startPoint.Y / xy); var y = Convert.ToInt32(startPoint.Y / xy);
//最小距离 //最小距离
double minDistance = 3840; //double minDistance = 3840;
double minDistance = 816;
if (vm.IsStartValue) if (vm.IsStartValue)
{ {
saveInfo = new TrackingBoxInfo(); saveInfo = new TrackingBoxInfo();
...@@ -682,36 +684,36 @@ namespace VIZ.FGOUT.Module ...@@ -682,36 +684,36 @@ namespace VIZ.FGOUT.Module
{ {
var currentPoint = e.GetPosition(this.canvas1); var currentPoint = e.GetPosition(this.canvas1);
//1 ////1
//rectSelected = new Rect(startPoint, e.GetPosition(this.canvas1)); ////rectSelected = new Rect(startPoint, e.GetPosition(this.canvas1));
rectSelected = new Rect(startPoint, currentPoint); //rectSelected = new Rect(startPoint, currentPoint);
////2 //2
//var startX = startPoint.X; var startX = startPoint.X;
//var startY = startPoint.Y; var startY = startPoint.Y;
//double width = Math.Abs(currentPoint.X - startX); var width = Math.Abs(currentPoint.X - startX);
//double height = width * 9 / 16; var height = width * 9 / 16;
//var rg = new RectangleGeometry var rg = new RectangleGeometry
//{ {
// Rect = new Rect(startX, startY, width, height) Rect = new Rect(startX, startY, width, height)
//}; };
//rectSelected = new Rect(startPoint, currentPoint); rectSelected = new Rect(startPoint, currentPoint);
//if (_currMarkPath == null) if (_currMarkPath == null)
//{ {
// _currMarkPath = new Path _currMarkPath = new Path
// { {
// Stroke = Brushes.Yellow, Stroke = Brushes.Yellow,
// StrokeThickness = 1, StrokeThickness = 1,
// Data = rg Data = rg
// }; };
// this.canvas1.Children.Add(_currMarkPath); this.canvas1.Children.Add(_currMarkPath);
//} }
//else else
//{ {
// _currMarkPath.Data = rg; _currMarkPath.Data = rg;
//} }
} }
} }
} }
......
...@@ -216,6 +216,7 @@ namespace VIZ.FGOUT.Module ...@@ -216,6 +216,7 @@ namespace VIZ.FGOUT.Module
ApplicationDomain.MessageManager.Register<SendSelectedModel>(this, this.SendSelected); ApplicationDomain.MessageManager.Register<SendSelectedModel>(this, this.SendSelected);
} }
private CutPackage _package;
/// <summary> /// <summary>
/// 发送裁切框数据 /// 发送裁切框数据
/// </summary> /// </summary>
...@@ -238,8 +239,14 @@ namespace VIZ.FGOUT.Module ...@@ -238,8 +239,14 @@ namespace VIZ.FGOUT.Module
CutPackage package = Coordinate(rect, srcWidth, srcHeight); CutPackage package = Coordinate(rect, srcWidth, srcHeight);
package.type = ClipPackageSignal.CUT; package.type = ClipPackageSignal.CUT;
//if (_package != null && _package.point[0] == package.point[0] && _package.point[1] == package.point[1] && _package.width == package.width && _package.height == package.height)
//{
// return;
//}
//_package = package;
manager.SendJson(package); manager.SendJson(package);
WPFHelper.BeginInvoke(() => { MessageBoxEx.ShowDialog("裁切框发送成功。"); }); //WPFHelper.BeginInvoke(() => { MessageBoxEx.ShowDialog("裁切框发送成功。"); });
} }
} }
...@@ -271,6 +278,8 @@ namespace VIZ.FGOUT.Module ...@@ -271,6 +278,8 @@ namespace VIZ.FGOUT.Module
nDIView.rectSelected = new Rect(); nDIView.rectSelected = new Rect();
nDIView._currMarkPath = null; nDIView._currMarkPath = null;
} }
_package = null;
} }
} }
...@@ -1177,9 +1186,8 @@ namespace VIZ.FGOUT.Module ...@@ -1177,9 +1186,8 @@ namespace VIZ.FGOUT.Module
private List<List<List<int>>> Coordinate(List<System.Windows.Rect> rects, double srcWidth, double srcHeight) private List<List<List<int>>> Coordinate(List<System.Windows.Rect> rects, double srcWidth, double srcHeight)
{ {
// 视频的宽度 // 视频的宽度和高度
int resWith = ApplicationDomain.IniStorage.GetValue<VideoConfig, int>(p => p.VIDEO_WIDTH); int resWith = ApplicationDomain.IniStorage.GetValue<VideoConfig, int>(p => p.VIDEO_WIDTH);
// 视频的高度
int resHeight = ApplicationDomain.IniStorage.GetValue<VideoConfig, int>(p => p.VIDEO_HEIGHT); int resHeight = ApplicationDomain.IniStorage.GetValue<VideoConfig, int>(p => p.VIDEO_HEIGHT);
double xp = srcWidth / resWith; double xp = srcWidth / resWith;
...@@ -1210,23 +1218,22 @@ namespace VIZ.FGOUT.Module ...@@ -1210,23 +1218,22 @@ namespace VIZ.FGOUT.Module
private CutPackage Coordinate(Rect rect, double srcWidth, double srcHeight) private CutPackage Coordinate(Rect rect, double srcWidth, double srcHeight)
{ {
// 视频的宽度 // 视频的宽度和高度
int resWith = ApplicationDomain.IniStorage.GetValue<VideoConfig, int>(p => p.VIDEO_WIDTH); var resWith = ApplicationDomain.IniStorage.GetValue<VideoConfig, int>(p => p.VIDEO_WIDTH);
// 视频的高度 var resHeight = ApplicationDomain.IniStorage.GetValue<VideoConfig, int>(p => p.VIDEO_HEIGHT);
int resHeight = ApplicationDomain.IniStorage.GetValue<VideoConfig, int>(p => p.VIDEO_HEIGHT);
double xp = srcWidth / resWith; var xp = srcWidth / resWith;
double xy = srcHeight / resHeight; var xy = srcHeight / resHeight;
int dx = Convert.ToInt32(rect.X / xp); var dx = Convert.ToInt32(rect.X / xp);
int dy = Convert.ToInt32(rect.Y / xy); var dy = Convert.ToInt32(rect.Y / xy);
int width = Convert.ToInt32(rect.Width / xp); var width = Convert.ToInt32(rect.Width / xp);
if (width + dx > resWith) if (width + dx > resWith)
{ {
width = resWith - dx; width = resWith - dx;
} }
int height = Convert.ToInt32(width * 9 / 16); var height = Convert.ToInt32(width * 9 / 16);
//int height2 = Convert.ToInt32(rect.Height / xy); //int height2 = Convert.ToInt32(rect.Height / xy);
if (height + dy > resHeight) if (height + dy > resHeight)
{ {
......
 C:\Projects\FGOUT\VIZ.FGOUT\VIZ.FGOUT.Module\obj\x64\Debug\GeneratedInternalTypeHelper.g.cs
FC:\Projects\FGOUT\VIZ.FGOUT\VIZ.FGOUT.Module\NDIMainView\View\NDIMainView.xaml;; FC:\Projects\FGOUT\VIZ.FGOUT\VIZ.FGOUT.Module\NDIMainView\View\NDIMainView.xaml;;
FC:\Projects\FGOUT\VIZ.FGOUT\VIZ.FGOUT.Module\NDIPreviewView\View\NDIPreviewView.xaml;; FC:\Projects\FGOUT\VIZ.FGOUT\VIZ.FGOUT.Module\NDIPreviewView\View\NDIPreviewView.xaml;;
......
...@@ -55,5 +55,5 @@ using System.Windows; ...@@ -55,5 +55,5 @@ using System.Windows;
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示: //通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.20.0")] [assembly: AssemblyVersion("1.0.22.0")]
[assembly: AssemblyFileVersion("1.0.20.0")] [assembly: AssemblyFileVersion("1.0.22.0")]
...@@ -86,7 +86,7 @@ UDP_UESETTING_PORT=8888 ...@@ -86,7 +86,7 @@ UDP_UESETTING_PORT=8888
;UDP算法端口 ;UDP算法端口
UDP_Algorithm_PORT=8001 UDP_Algorithm_PORT=8001
;UDP音视频流IP, 如果该值不配置,那么会从流中获取 ;UDP音视频流IP, 如果该值不配置,那么会从流中获取
;UDP_Stream_IP=192.168.31.83 UDP_Stream_IP=192.168.31.83
; ============================================================ ; ============================================================
; === Algorithm === ; === Algorithm ===
; ============================================================ ; ============================================================
......
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