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


C# HTuple.TupleSelectRange方法代码示例

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


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

示例1: Distance

        /// <summary>
        /// If calibration data is available and valid, then transform the
        /// distance between measure result edges into world coordinates,
        /// else leave them the same.
        /// </summary>
        public HTuple Distance(HTuple row1, HTuple col1, HTuple row2, HTuple col2, int shift)
        {
            HTuple rows, cols, rowRect, colRect;
            HTuple distance = new HTuple();
            HXLDCont contour;

            if (shift == 0)
            {
                if (mROIType == ROI.ROI_TYPE_CIRCLEARC)
                {
                    double cRow, cCol, radius, extent, phi1, phi2, phi, res, length, tmp;

                    cRow = mROICoord[0].D;
                    cCol = mROICoord[1].D;
                    radius = mROICoord[2].D;
                    extent = mROICoord[4].D;

                    HOperatorSet.TupleGenConst(new HTuple(row1.Length), 0.0, out distance);

                    for (int i=0; i < distance.Length; i++)
                    {
                        phi1 = HMisc.AngleLx(cRow, cCol, row1[i].D, col1[i].D);
                        phi2 = HMisc.AngleLx(cRow, cCol, row2[i].D, col2[i].D);

                        if (extent < 0)
                        {
                            tmp = phi1;
                            phi1 = phi2;
                            phi2 = tmp;
                        }

                        phi = phi2 - phi1;

                        if (phi < 0)
                            phi += 2 * Math.PI;

                        res = 0.05 * 24.0 / (radius * phi);

                        contour = new HXLDCont();
                        contour.GenEllipseContourXld(cRow, cCol, 0, radius, radius, phi1, phi2, "positive", res);
                        contour.GetContourXld(out rows, out cols);
                        Rectify(rows, cols, out rowRect, out colRect);
                        contour.Dispose();
                        contour.GenContourPolygonXld(rowRect, colRect);
                        length = contour.LengthXld();
                        distance[i].D = length;
                        contour.Dispose();
                    }

                }
                else if (mROIType == ROI.ROI_TYPE_LINE)
                {
                    HTuple rRect1, cRect1, rRect2, cRect2;
                    Rectify(row1, col1, out rRect1, out cRect1);
                    Rectify(row2, col2, out rRect2, out cRect2);
                    distance = HMisc.DistancePp(rRect1, cRect1, rRect2, cRect2);
                }
                return distance;

            }
            else
            {
                HTuple rClip1, cClip1, rShift2, cShift2;

                rClip1 = row1.TupleSelectRange(new HTuple(0), new HTuple(row1.Length - shift - 1));
                cClip1 = col1.TupleSelectRange(new HTuple(0), new HTuple(col1.Length - shift - 1));
                rShift2 = row2.TupleSelectRange(new HTuple(shift), new HTuple(row2.Length - 1));
                cShift2 = col2.TupleSelectRange(new HTuple(shift), new HTuple(col2.Length - 1));

                return this.Distance(rClip1, cClip1, rShift2, cShift2, 0);
            }
        }
开发者ID:rtigithub,项目名称:HALCON-12-codelets,代码行数:77,代码来源:Measurement.cs


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