miss晴空
2022-01-27 15:26
VM算法平台

通过代码怎么设置模块ROI?

如何通过代码来设置模块的ROI区域?VM4.0.0 + VS2015以上


  • 517
  • 0
  • 分享

全部回答1

这里以DL字符识别CPU模块为例,代码如下,其中0.5f是比例关系(将图看作1)。

1. C# 
2. public void OCRROISetFunc(ref VMControls.WPF.Release.VmRenderControl vmRenderControl1)
3. {
4.     /////////OCRROISET
5.     IMVSOcrDlModuCTool iMVSOcrDlModuCTool = (IMVSOcrDlModuCTool)VmSolution.Instance["流程1.DL字符识别C1"];
6.     RoiBox roiBox = new RoiBox();
7.     roiBox.bRoiType = (byte)RoiType.ROI_TYPE_BOX;
8.     roiBox.fCenterX = 0.5f;
9.     roiBox.fCenterY = 0.68f;
10.      roiBox.fWidth = 0.5f;
11.      roiBox.fHeight = 0.1f;
12.   
13.      IntPtr ptr = Marshal.AllocHGlobal(Marshal.SizeOf(roiBox));
14.      Marshal.StructureToPtr(roiBox, ptr, false);
15.      iMVSOcrDlModuCTool.ModuParams.SetBinaryData("RoiType", ptr, (uint)Marshal.SizeOf(roiBox));
16.      vmRenderControl1.ModuleSource = iMVSOcrDlModuCTool;
17.  }


2022-01-27 16:06 未知地区
    |
  • 评论
  • |
  • 1

请升级浏览器版本

您正在使用的浏览器版本过低,请升级最新版本以获得更好的体验。

推荐使用以下浏览器