Commit cfe6e1e6 by liulongfei

手动调整

parent c4be4b7c
...@@ -28,7 +28,6 @@ namespace VIZ.H2V.Module ...@@ -28,7 +28,6 @@ namespace VIZ.H2V.Module
public ManualController(IManualSupport support) public ManualController(IManualSupport support)
{ {
this.Support = support; this.Support = support;
} }
/// <summary> /// <summary>
...@@ -95,7 +94,8 @@ namespace VIZ.H2V.Module ...@@ -95,7 +94,8 @@ namespace VIZ.H2V.Module
double x = this.ClipBoxTargetX + this.GetMappingValue(); double x = this.ClipBoxTargetX + this.GetMappingValue();
x = MathHelper.Clip(min, max, x); x = MathHelper.Clip(min, max, x);
this.ClipBoxTargetX = x; this.ClipBoxTargetX = x;
double result = this.ClipBoxSmooth.Call(this.ClipBoxTargetX, 1);
double result = this.ClipBoxSmooth.Call(this.ClipBoxTargetX, 0.6d);
return result; return result;
} }
......
...@@ -97,7 +97,7 @@ namespace VIZ.H2V.Module ...@@ -97,7 +97,7 @@ namespace VIZ.H2V.Module
int x = (int)boxInfo.SrcRect.Left; int x = (int)boxInfo.SrcRect.Left;
int y = 0; int y = 0;
int w = x + 810; int w = 810;
int h = 1080; int h = 1080;
Mat cut = dst[new Rect(x, y, w, h)]; Mat cut = dst[new Rect(x, y, w, h)];
......
...@@ -70,16 +70,6 @@ namespace VIZ.H2V.Module ...@@ -70,16 +70,6 @@ namespace VIZ.H2V.Module
{ {
this.IsActive = true; this.IsActive = true;
} }
#if DEBUG
// ====================================================================
// 录制测试
if (this.ViewKey == NDIViewKeys.CAM_1)
{
this.ReecordingController = new RecordingController(this);
}
// ====================================================================
#endif
} }
/// <summary> /// <summary>
......
...@@ -49,8 +49,24 @@ namespace VIZ.H2V.Module ...@@ -49,8 +49,24 @@ namespace VIZ.H2V.Module
{ {
SystemConfig config = ApplicationDomainEx.LiteDbContext.SystemConfig.FindAll().FirstOrDefault(); SystemConfig config = ApplicationDomainEx.LiteDbContext.SystemConfig.FindAll().FirstOrDefault();
this.ManualController.ClipBoxSmooth.MinCutoff = config.ManualSmoothCoeff; this.ManualController.ClipBoxSmooth.Init(555, 555, config.ManualSmoothCoeff);
this.ManualController.ClipBoxTargetX = 555; this.ManualController.ClipBoxTargetX = 555;
CompositionTarget.Rendering -= CompositionTarget_Rendering;
CompositionTarget.Rendering += CompositionTarget_Rendering;
}
/// <summary>
/// 渲染处理
/// </summary>
private void CompositionTarget_Rendering(object sender, EventArgs e)
{
// 更新手动裁切框
// 仅手动模式下处理 & 需要进行裁切 & 3D鼠标准备完毕 时才处理
if (this.StrategyMode == AlgorithmStrategyMode.manual_mode && this.IsUseClip)
{
this.UpdateClipBoxWithManual();
}
} }
/// <summary> /// <summary>
...@@ -100,25 +116,6 @@ namespace VIZ.H2V.Module ...@@ -100,25 +116,6 @@ namespace VIZ.H2V.Module
if (view == null) if (view == null)
return; return;
// 更新手动裁切框
// 仅手动模式下处理 & 需要进行裁切 & 3D鼠标准备完毕 时才处理
if (this.StrategyMode == AlgorithmStrategyMode.manual_mode && this.IsUseClip)
{
this.UpdateClipBoxWithManual();
}
#if DEBUG
// ====================================================================
// 录制测试
if (this.ReecordingController != null)
{
ClipBoxInfo temp = new ClipBoxInfo();
temp.SrcRect = new RawRectangleF((float)this.ClipBoxX, 0, (float)this.ClipBoxX + 810, 1080);
this.ReecordingController.Append(e.Frame, temp);
}
// ====================================================================
#endif
// 更新画面 // 更新画面
view.video.UpdateVideoFrame(e.Frame); view.video.UpdateVideoFrame(e.Frame);
...@@ -129,8 +126,10 @@ namespace VIZ.H2V.Module ...@@ -129,8 +126,10 @@ namespace VIZ.H2V.Module
if (manager == null) if (manager == null)
return; return;
// TODO: 平滑系数读取 List<int> roi = this.GetManulRoi();
AlgorithmSender.ManualMode(manager, this.ID, this.ViewConfig.IsSendToCrop, this.GetManulRoi(), this.AlgorithmConfig.SmoothCoeff);
// 向算法发送裁切框
AlgorithmSender.ManualMode(manager, this.ID, this.ViewConfig.IsSendToCrop, roi, this.AlgorithmConfig.SmoothCoeff);
// 在需要发送裁切框时 // 在需要发送裁切框时
if (this.viewConfig.IsSendToCrop) if (this.viewConfig.IsSendToCrop)
...@@ -138,7 +137,7 @@ namespace VIZ.H2V.Module ...@@ -138,7 +137,7 @@ namespace VIZ.H2V.Module
UdpEndpointManager manager_clip = ConnectionManager.UdpConnection.GetEndpointManager($"{this.ViewKey}__CLIP"); UdpEndpointManager manager_clip = ConnectionManager.UdpConnection.GetEndpointManager($"{this.ViewKey}__CLIP");
if (manager_clip != null) if (manager_clip != null)
{ {
ClipSender.CropRoi(manager_clip, 0, this.GetManulRoi(), (int)CLIP_BOX_WIDTH, e.Frame.Height, e.Frame.TimeStamp); ClipSender.CropRoi(manager_clip, 0, roi, CLIP_BOX_WIDTH, e.Frame.Height, e.Frame.TimeStamp);
} }
} }
} }
......
...@@ -31,7 +31,7 @@ namespace VIZ.H2V.Module ...@@ -31,7 +31,7 @@ namespace VIZ.H2V.Module
/// <summary> /// <summary>
/// 剪切框宽度 /// 剪切框宽度
/// </summary> /// </summary>
private readonly double CLIP_BOX_WIDTH = ApplicationDomainEx.IniStorage.GetValue<VideoConfig, double>(p => p.VIDEO_CLIP_BOX_WIDTH); private readonly int CLIP_BOX_WIDTH = ApplicationDomainEx.IniStorage.GetValue<VideoConfig, int>(p => p.VIDEO_CLIP_BOX_WIDTH);
/// <summary> /// <summary>
/// 剪切框宽度 /// 剪切框宽度
......
...@@ -223,15 +223,12 @@ namespace VIZ.H2V.Module ...@@ -223,15 +223,12 @@ namespace VIZ.H2V.Module
/// <returns>手动裁切框</returns> /// <returns>手动裁切框</returns>
public List<int> GetManulRoi() public List<int> GetManulRoi()
{ {
NDIView view = this.GetView<NDIView>(); int left = (int)this.ClipBoxX;
if (view == null) int top = 0;
return null; int right = left + this.CLIP_BOX_WIDTH;
int bottom = 1080;
VideoRenderInfo renderInfo = view.video.GetRenderInfo();
if (renderInfo == null)
return null;
return new List<int> { (int)this.ClipBoxX, 0, (int)(this.ClipBoxX + this.CLIP_BOX_WIDTH), renderInfo.Frame.Height }; return new List<int> { left, top, right, bottom };
} }
/// <summary> /// <summary>
......
...@@ -38,13 +38,6 @@ namespace VIZ.H2V ...@@ -38,13 +38,6 @@ namespace VIZ.H2V
// 初始化3D鼠标 // 初始化3D鼠标
AppSetup.AppendLoad(new AppSetup_Navigation3D()); AppSetup.AppendLoad(new AppSetup_Navigation3D());
#if DEBUG
// ====================================================================
// 录制测试
AppSetup.AppendSetup(new AppSetup_Recording());
// ====================================================================
#endif
// 执行启动流程 // 执行启动流程
AppSetupContext context = AppSetup.Setup(); AppSetupContext context = AppSetup.Setup();
......
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