当前位置: 首页>>代码示例>>C#>>正文


C# HTuple.TupleReal方法代码示例

本文整理汇总了C#中HTuple.TupleReal方法的典型用法代码示例。如果您正苦于以下问题:C# HTuple.TupleReal方法的具体用法?C# HTuple.TupleReal怎么用?C# HTuple.TupleReal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HTuple的用法示例。


在下文中一共展示了HTuple.TupleReal方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: eval_caltab_size

    /// <summary>
    /// Evaluates the area covered by the calibration plate in the calibration
    /// image.
    /// </summary>
    public void eval_caltab_size(HObject ho_Image, 
                                HObject ho_Caltab, 
                                HObject ho_Marks,
                                out HTuple hv_SizeScore)
    {
        // Local iconic variables

          HObject ho_Region = null, ho_RegionUnion = null;

          // Local control variables

          HTuple hv_Width, hv_Height, hv_Number, hv_Row1 = new HTuple();
          HTuple hv_Column1 = new HTuple(), hv_Phi1 = new HTuple(), hv_Length1 = new HTuple();
          HTuple hv_Length2 = new HTuple(), hv_Area = new HTuple(), hv_Row = new HTuple();
          HTuple hv_Column = new HTuple(), hv_MinRatio, hv_MaxRatio;
          HTuple hv_Ratio;

          // Initialize local and output iconic variables
          HOperatorSet.GenEmptyObj(out ho_Region);
          HOperatorSet.GenEmptyObj(out ho_RegionUnion);

          hv_SizeScore = 0.0;
          HOperatorSet.GetImageSize(ho_Image, out hv_Width, out hv_Height);
          HOperatorSet.CountObj(ho_Marks, out hv_Number);
          if ((int)(new HTuple(hv_Number.TupleGreaterEqual(4))) != 0)
          {
          //Best approach: Use the surrounding box of the marks as reference size
          ho_Region.Dispose();
          HOperatorSet.GenRegionContourXld(ho_Marks, out ho_Region, "filled");
          ho_RegionUnion.Dispose();
          HOperatorSet.Union1(ho_Region, out ho_RegionUnion);
          HOperatorSet.SmallestRectangle2(ho_RegionUnion, out hv_Row1, out hv_Column1,
              out hv_Phi1, out hv_Length1, out hv_Length2);
          hv_Area = (hv_Length2 * hv_Length1) * 4;
          }
          else
          {
          //If no marks could be found: use the caltab as reference size
          HOperatorSet.AreaCenter(ho_Caltab, out hv_Area, out hv_Row, out hv_Column);
          if ((int)((new HTuple(hv_Area.TupleEqual(0))).TupleOr(new HTuple(hv_Area.TupleEqual(
              new HTuple())))) != 0)
          {
              ho_Region.Dispose();
              ho_RegionUnion.Dispose();

              return;
          }
          }
          hv_MinRatio = 0.015;
          hv_MaxRatio = 0.075;
          hv_Ratio = (hv_Area.TupleReal()) / (hv_Width * hv_Height);
          if ((int)(new HTuple(hv_Ratio.TupleGreater(hv_MinRatio))) != 0)
          {
          hv_SizeScore = (hv_Ratio - hv_MinRatio) / (hv_MaxRatio - hv_MinRatio);
          hv_SizeScore = (((new HTuple(1.0)).TupleConcat(hv_SizeScore))).TupleMin();
          }
          ho_Region.Dispose();
          ho_RegionUnion.Dispose();

          return;
    }
开发者ID:rtigithub,项目名称:HALCON-12-codelets,代码行数:65,代码来源:QualityProcedures.cs


注:本文中的HTuple.TupleReal方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。