欢迎光临散文网 会员登陆 & 注册

技术杂谈|HALCON算子封装新函数

2021-09-19 09:09 作者:HALCON之家  | 我要投稿

创建新函数:将多个算子封装成一个新的函数


mean_image (Image, ImageMean, mean_width, mean_height)
reduce_domain (ImageMean, Rectangle, ImageReduced)
threshold (ImageReduced, Region, 78, 255)
area_center (Region, Area, Row, Column)


也可以在菜单栏中创建


定义新函数名称


点击图中“参数”,删减参数,把不用的参数删掉即可


生成的新函数

选中函数右键鼠标 选择显示函数可以查看封装的Halcon算子

比如不需要Area参数名 将其移除后点击应用

参数介绍:

图标参数:一般Region、Image、XLD等都属于图标参数。

控制参数:一般数据、字符串都属于控制参数。

以上Halcon函数介绍完毕。

public void Centera (HObject ho_Image, HObject ho_Rectangle, out HObject ho_ImageMean,
      out HObject ho_ImageReduced, out HObject ho_Region, HTuple hv_mean_width, HTuple hv_mean_height,
      out HTuple hv_Row, out HTuple hv_Column)
  {
    // Local control variables
    HTuple hv_Area = new HTuple();
    // Initialize local and output iconic variables
    HOperatorSet.GenEmptyObj(out ho_ImageMean);
    HOperatorSet.GenEmptyObj(out ho_ImageReduced);
    HOperatorSet.GenEmptyObj(out ho_Region);
    hv_Row = new HTuple();
    hv_Column = new HTuple();
    ho_ImageMean.Dispose();
    HOperatorSet.MeanImage(ho_Image, out ho_ImageMean, hv_mean_width, hv_mean_height);
    ho_ImageReduced.Dispose();
    HOperatorSet.ReduceDomain(ho_ImageMean, ho_Rectangle, out ho_ImageReduced);
    ho_Region.Dispose();
    HOperatorSet.Threshold(ho_ImageReduced, out ho_Region, 78, 255);
    hv_Area.Dispose();hv_Row.Dispose();hv_Column.Dispose();
    HOperatorSet.AreaCenter(ho_Region, out hv_Area, out hv_Row, out hv_Column);
  }


技术杂谈|HALCON算子封装新函数的评论 (共 条)

分享到微博请遵守国家法律