Commit cfe6e1e6 by liulongfei

手动调整

parent c4be4b7c
......@@ -28,7 +28,6 @@ namespace VIZ.H2V.Module
public ManualController(IManualSupport support)
{
this.Support = support;
}
/// <summary>
......@@ -95,7 +94,8 @@ namespace VIZ.H2V.Module
double x = this.ClipBoxTargetX + this.GetMappingValue();
x = MathHelper.Clip(min, max, x);
this.ClipBoxTargetX = x;
double result = this.ClipBoxSmooth.Call(this.ClipBoxTargetX, 1);
double result = this.ClipBoxSmooth.Call(this.ClipBoxTargetX, 0.6d);
return result;
}
......
......@@ -97,7 +97,7 @@ namespace VIZ.H2V.Module
int x = (int)boxInfo.SrcRect.Left;
int y = 0;
int w = x + 810;
int w = 810;
int h = 1080;
Mat cut = dst[new Rect(x, y, w, h)];
......
......@@ -70,16 +70,6 @@ namespace VIZ.H2V.Module
{
this.IsActive = true;
}
#if DEBUG
// ====================================================================
// 录制测试
if (this.ViewKey == NDIViewKeys.CAM_1)
{
this.ReecordingController = new RecordingController(this);
}
// ====================================================================
#endif
}
/// <summary>
......
......@@ -49,8 +49,24 @@ namespace VIZ.H2V.Module
{
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;
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>
......@@ -100,25 +116,6 @@ namespace VIZ.H2V.Module
if (view == null)
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);
......@@ -129,8 +126,10 @@ namespace VIZ.H2V.Module
if (manager == null)
return;
// TODO: 平滑系数读取
AlgorithmSender.ManualMode(manager, this.ID, this.ViewConfig.IsSendToCrop, this.GetManulRoi(), this.AlgorithmConfig.SmoothCoeff);
List<int> roi = this.GetManulRoi();
// 向算法发送裁切框
AlgorithmSender.ManualMode(manager, this.ID, this.ViewConfig.IsSendToCrop, roi, this.AlgorithmConfig.SmoothCoeff);
// 在需要发送裁切框时
if (this.viewConfig.IsSendToCrop)
......@@ -138,7 +137,7 @@ namespace VIZ.H2V.Module
UdpEndpointManager manager_clip = ConnectionManager.UdpConnection.GetEndpointManager($"{this.ViewKey}__CLIP");
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
/// <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>
/// 剪切框宽度
......
......@@ -223,15 +223,12 @@ namespace VIZ.H2V.Module
/// <returns>手动裁切框</returns>
public List<int> GetManulRoi()
{
NDIView view = this.GetView<NDIView>();
if (view == null)
return null;
VideoRenderInfo renderInfo = view.video.GetRenderInfo();
if (renderInfo == null)
return null;
int left = (int)this.ClipBoxX;
int top = 0;
int right = left + this.CLIP_BOX_WIDTH;
int bottom = 1080;
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>
......
......@@ -38,13 +38,6 @@ namespace VIZ.H2V
// 初始化3D鼠标
AppSetup.AppendLoad(new AppSetup_Navigation3D());
#if DEBUG
// ====================================================================
// 录制测试
AppSetup.AppendSetup(new AppSetup_Recording());
// ====================================================================
#endif
// 执行启动流程
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