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


C# HTuple.TupleEqual方法代码示例

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


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

示例1: Action


//.........这里部分代码省略.........
            hv_STD_R1_V_Row = hv_STD_R1_Row - hv_STD_Row;
            hv_STD_R1_V_Col = hv_STD_R1_Col - hv_STD_Col;

            //R1_X, R1_Y 分量
            hv_R1_X = (hv_STD_R1_V_Col * (hv_Img_Rotate_Angle.TupleCos())) + (hv_STD_R1_V_Row * (hv_Img_Rotate_Angle.TupleSin()
                ));
            hv_R1_Y = (hv_STD_R1_V_Row * (hv_Img_Rotate_Angle.TupleCos())) - (hv_STD_R1_V_Col * (hv_Img_Rotate_Angle.TupleSin()
                ));

            //目前圖形 R1_ 位置
            hv_R1_Pos_Row = (hv_STD_Row + hv_R1_Y) + hv_OffsetRow;
            hv_R1_Pos_Col = (hv_STD_Col + hv_R1_X) + hv_OffsetCol;

            hv_R1_R = 20;
            //*ROI
            ho_R1_Circle.Dispose();
            HOperatorSet.GenCircle(out ho_R1_Circle, hv_R1_Pos_Row, hv_R1_Pos_Col, hv_R1_R);
            ho_R1_ROI_Image.Dispose();
            HOperatorSet.ReduceDomain(ho_Image, ho_R1_Circle, out ho_R1_ROI_Image);
            ho_R1_Region.Dispose();
            HOperatorSet.FastThreshold(ho_R1_ROI_Image, out ho_R1_Region, 100, 255, 20);
            ho_R1_ImageReduced.Dispose();
            HOperatorSet.ReduceDomain(ho_R1_ROI_Image, ho_R1_Region, out ho_R1_ImageReduced
                );

            //sobel_fast 具有較寬的選擇範圍,搭配 alpha 參數 (alpha 越大, 容錯範圍大)
            hv_alpha = 0.9;
            hv_R1_low = 20;
            hv_R1_high = 40;
            ho_R1_Edges.Dispose();
            HOperatorSet.EdgesSubPix(ho_R1_ImageReduced, out ho_R1_Edges, "sobel_fast",
                hv_alpha, hv_R1_low, hv_R1_high);
            //stop ()
            //*所有的數值越小,表示容錯範圍大,反之亦然
            ho_R1_ContoursSplit.Dispose();
            HOperatorSet.SegmentContoursXld(ho_R1_Edges, out ho_R1_ContoursSplit, "lines_circles",
                17, 1, 1);
            //Display the results
            //===========================================================
            HOperatorSet.CountObj(ho_R1_ContoursSplit, out hv_R1_NumSegments);
            hv_NumCircles = 0;
            hv_Num_Circle_Point = 5;
            hv_R1 = 999;
            hv_R1_limit = 10;
            for (hv_i = 1; hv_i.Continue(hv_R1_NumSegments, 1); hv_i = hv_i.TupleAdd(1))
            {
                ho_R1_SingleSegment.Dispose();
                HOperatorSet.SelectObj(ho_R1_ContoursSplit, out ho_R1_SingleSegment, hv_i);
                HOperatorSet.GetContourGlobalAttribXld(ho_R1_SingleSegment, "cont_approx", out hv_Attrib);

                if ((int)(new HTuple(hv_Attrib.TupleEqual(1))) != 0)
                {
                    HOperatorSet.FitCircleContourXld(ho_R1_SingleSegment, "atukey", -1, 2,
                        hv_Num_Circle_Point, 5, 2, out hv_R1_Row, out hv_R1_Column, out hv_R1_Radius,
                        out hv_R1_StartPhi, out hv_R1_EndPhi, out hv_R1_PointOrder);

                    //ho_R1_ContEllipse.Dispose();
                    //HOperatorSet.GenEllipseContourXld(out ho_R1_ContEllipse, hv_R1_Row, hv_R1_Column,
                    //	0, hv_R1_Radius, hv_R1_Radius, 0, (new HTuple(360)).TupleRad(), "positive",
                    //	1.0);

                    //HOperatorSet.DistEllipseContourXld(ho_R1_SingleSegment, "algebraic", -1,
                    //	0, hv_R1_Row, hv_R1_Column, 0, hv_R1_Radius, hv_R1_Radius, out hv_R1_MinDist,
                    //	out hv_R1_MaxDist, out hv_R1_AvgDist, out hv_R1_SigmaDist);

                    hv_NumCircles = hv_NumCircles + 1;
                    if ((int)(new HTuple(hv_R1.TupleGreater(hv_R1_Radius))) != 0)
                    {
                        hv_R1 = hv_R1_Radius.Clone();
                        //hv_ResultText = (((("C" + hv_NumCircles) + ": Radius = ") + (hv_R1_Radius.TupleString(
                        //	".3"))) + " / MaxDeviation: ") + (hv_R1_MaxDist.TupleString(".3"));
                        //HOperatorSet.SetTposition(hv_WindowHandle, hv_R1_Pos_Row - hv_msgOffsetY,
                        //	hv_R1_Pos_Col - hv_msgOffsetX);
                        //HOperatorSet.WriteString(hv_WindowHandle, "R1");

                        #region 組合結果
                        mResult = new CircleResult(new HTuple(hv_R1_Row)
                                                , new HTuple(hv_R1_Column)
                                                , new HTuple(hv_R1_Radius)
                                                , new HTuple(hv_R1_StartPhi)
                                                , new HTuple(hv_R1_EndPhi)
                                                , new HTuple(hv_R1_PointOrder)) { };
                        #endregion
                    }
                }
            }
            hv_MeasureReasult = hv_R1.Clone();
            //****R1 End
            //ho_Image.Dispose();
            ho_R1_Circle.Dispose();
            ho_R1_ROI_Image.Dispose();
            ho_R1_Region.Dispose();
            ho_R1_ImageReduced.Dispose();
            ho_R1_Edges.Dispose();
            ho_R1_ContoursSplit.Dispose();
            ho_R1_SingleSegment.Dispose();
            //ho_R1_ContEllipse.Dispose();

            return mResult;
        }
开发者ID:Joncash,项目名称:HanboAOMClassLibrary,代码行数:101,代码来源:SDMS_R1.cs

示例2: Action


//.........这里部分代码省略.........
            hv_STD_R17_V_Row = hv_STD_R17_Row - hv_STD_Row;
            hv_STD_R17_V_Col = hv_STD_R17_Col - hv_STD_Col;

            //R17_X, R17_Y 分量
            hv_R17_X = (hv_STD_R17_V_Col * (hv_Img_Rotate_Angle.TupleCos())) + (hv_STD_R17_V_Row * (hv_Img_Rotate_Angle.TupleSin()
                ));
            hv_R17_Y = (hv_STD_R17_V_Row * (hv_Img_Rotate_Angle.TupleCos())) - (hv_STD_R17_V_Col * (hv_Img_Rotate_Angle.TupleSin()
                ));

            //目前圖形 R17_ 位置
            hv_R17_Pos_Row = (hv_STD_Row + hv_R17_Y) + hv_OffsetRow;
            hv_R17_Pos_Col = (hv_STD_Col + hv_R17_X) + hv_OffsetCol;

            hv_R17_R = 17;

            ho_R17_Circle.Dispose();
            HOperatorSet.GenCircle(out ho_R17_Circle, hv_R17_Pos_Row, hv_R17_Pos_Col, hv_R17_R);
            if (HDevWindowStack.IsOpen())
            {
                //dev_display (R17_Circle)
            }
            //stop ()

            ho_R17_ROI_Image.Dispose();
            HOperatorSet.ReduceDomain(ho_Image, ho_R17_Circle, out ho_R17_ROI_Image);
            ho_R17_Region.Dispose();
            HOperatorSet.FastThreshold(ho_R17_ROI_Image, out ho_R17_Region, 100, 255, 15);
            ho_R17_ImageReduced.Dispose();
            HOperatorSet.ReduceDomain(ho_R17_ROI_Image, ho_R17_Region, out ho_R17_ImageReduced
                );
            //stop ()
            //sobel_fast 具有較寬的選擇範圍,搭配 alpha 參數 (alpha 越大, 容錯範圍大)
            hv_alpha = 0.9;
            hv_R17_low = 10;
            hv_R17_high = 60;
            ho_R17_Edges.Dispose();
            HOperatorSet.EdgesSubPix(ho_R17_ImageReduced, out ho_R17_Edges, "sobel_fast",
                hv_alpha, hv_R17_low, hv_R17_high);
            //stop ()
            //*所有的數值越小,表示容錯範圍大,反之亦然
            ho_R17_ContoursSplit.Dispose();
            HOperatorSet.SegmentContoursXld(ho_R17_Edges, out ho_R17_ContoursSplit, "lines_circles",
                17, 1, 1);
            //Display the results
            //===========================================================
            HOperatorSet.CountObj(ho_R17_ContoursSplit, out hv_R17_NumSegments);
            hv_NumCircles = 0;
            hv_Num_Circle_Point = 0;
            hv_R17 = 999;
            for (hv_i = 1; hv_i.Continue(hv_R17_NumSegments, 1); hv_i = hv_i.TupleAdd(1))
            {
                ho_R17_SingleSegment.Dispose();
                HOperatorSet.SelectObj(ho_R17_ContoursSplit, out ho_R17_SingleSegment, hv_i);
                HOperatorSet.GetContourGlobalAttribXld(ho_R17_SingleSegment, "cont_approx",
                    out hv_Attrib);
                if ((int)(new HTuple(hv_Attrib.TupleEqual(1))) != 0)
                {
                    HOperatorSet.FitCircleContourXld(ho_R17_SingleSegment, "atukey", -1, 2,
                        hv_Num_Circle_Point, 5, 2, out hv_R17_Row, out hv_R17_Column, out hv_R17_Radius,
                        out hv_R17_StartPhi, out hv_R17_EndPhi, out hv_R17_PointOrder);
                    ho_R17_ContEllipse.Dispose();
                    HOperatorSet.GenEllipseContourXld(out ho_R17_ContEllipse, hv_R17_Row, hv_R17_Column,
                        0, hv_R17_Radius, hv_R17_Radius, 0, (new HTuple(360)).TupleRad(), "positive",
                        1.0);
                    if (HDevWindowStack.IsOpen())
                    {
                        HOperatorSet.DispObj(ho_R17_ContEllipse, HDevWindowStack.GetActive());
                    }
                    HOperatorSet.DistEllipseContourXld(ho_R17_SingleSegment, "algebraic", -1,
                        0, hv_R17_Row, hv_R17_Column, 0, hv_R17_Radius, hv_R17_Radius, out hv_R17_MinDist,
                        out hv_R17_MaxDist, out hv_R17_AvgDist, out hv_R17_SigmaDist);
                    hv_NumCircles = hv_NumCircles + 1;
                    if ((int)(new HTuple(hv_R17.TupleGreater(hv_R17_Radius))) != 0)
                    {
                        hv_R17 = hv_R17_Radius.Clone();
                        mResult = new CircleResult()
                        {
                            Row = new HTuple(hv_R17_Row),
                            Col = new HTuple(hv_R17_Column),
                            Radius = new HTuple(hv_R17_Radius),
                            StartPhi = new HTuple(hv_R17_StartPhi),
                            EndPhi = new HTuple(hv_R17_EndPhi),
                            PointOrder = new HTuple(hv_R17_PointOrder),
                        };
                    }
                    //stop ()
                }
            }

            ho_R17_Circle.Dispose();
            ho_R17_ROI_Image.Dispose();
            ho_R17_Region.Dispose();
            ho_R17_ImageReduced.Dispose();
            ho_R17_Edges.Dispose();
            ho_R17_ContoursSplit.Dispose();
            ho_R17_SingleSegment.Dispose();
            ho_R17_ContEllipse.Dispose();

            return mResult;
        }
开发者ID:Joncash,项目名称:HanboAOMClassLibrary,代码行数:101,代码来源:SDMS_R17.cs

示例3: eval_caltab_focus

    /// <summary>
    /// Evaluates the sharpness of the calibration plate in the calibration
    /// image.
    /// </summary>
    public void eval_caltab_focus(HObject ho_Image, 
                                 HObject ho_Marks,
                                 HTuple hv_Contrast,
                                 out HTuple hv_FocusScore)
    {
        // Local iconic variables

        HObject ho_Region, ho_RegionUnion, ho_ImageReduced;
        HObject ho_DerivGauss;

        // Local control variables

        HTuple hv_Number, hv_MeanGradient, hv_Deviation;
        HTuple hv_MinScore, hv_RawResult;

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

        hv_FocusScore = 0.0;
        if ((int)(new HTuple(hv_Contrast.TupleEqual(0))) != 0)
        {
          ho_Region.Dispose();
          ho_RegionUnion.Dispose();
          ho_ImageReduced.Dispose();
          ho_DerivGauss.Dispose();

          return;
        }
        HOperatorSet.CountObj(ho_Marks, out hv_Number);
        if ((int)(new HTuple(hv_Number.TupleLess(3))) != 0)
        {
          ho_Region.Dispose();
          ho_RegionUnion.Dispose();
          ho_ImageReduced.Dispose();
          ho_DerivGauss.Dispose();

          return;
        }
        ho_Region.Dispose();
        HOperatorSet.GenRegionContourXld(ho_Marks, out ho_Region, "margin");
        ho_RegionUnion.Dispose();
        HOperatorSet.Union1(ho_Region, out ho_RegionUnion);
        ho_ImageReduced.Dispose();
        HOperatorSet.ReduceDomain(ho_Image, ho_RegionUnion, out ho_ImageReduced);
        ho_DerivGauss.Dispose();
        HOperatorSet.DerivateGauss(ho_ImageReduced, out ho_DerivGauss, 0.7, "gradient");
        HOperatorSet.Intensity(ho_Region, ho_DerivGauss, out hv_MeanGradient, out hv_Deviation);
        hv_MinScore = 0.25;
        //Normalize the Gradient with the contrast
        hv_RawResult = hv_MeanGradient / hv_Contrast;
        hv_FocusScore = (((hv_RawResult * 4.5)).TupleSort())[(new HTuple((new HTuple(hv_RawResult.TupleLength()
        )) / 20.0)).TupleRound()];
        hv_FocusScore = ((((((((hv_FocusScore - hv_MinScore)).TupleConcat(0.0))).TupleMax()
        )).TupleConcat(1.0))).TupleMin();
        ho_Region.Dispose();
        ho_RegionUnion.Dispose();
        ho_ImageReduced.Dispose();
        ho_DerivGauss.Dispose();

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

示例4: 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

示例5: Action


//.........这里部分代码省略.........
            }
            if (HDevWindowStack.IsOpen())
            {
                HOperatorSet.DispObj(ho_Image, HDevWindowStack.GetActive());
            }
            //*****R3
            hv_R3_R = 29;

            //STD R3_ 位置
            hv_STD_R3_Row = 252;
            hv_STD_R3_Col = 1381;

            //STD 向量 STD_R3_
            hv_STD_R3_V_Row = hv_STD_R3_Row - hv_STD_Row;
            hv_STD_R3_V_Col = hv_STD_R3_Col - hv_STD_Col;

            //R3_X, R3_Y 分量
            hv_R3_X = (hv_STD_R3_V_Col * (hv_Img_Rotate_Angle.TupleCos())) + (hv_STD_R3_V_Row * (hv_Img_Rotate_Angle.TupleSin()
                ));
            hv_R3_Y = (hv_STD_R3_V_Row * (hv_Img_Rotate_Angle.TupleCos())) - (hv_STD_R3_V_Col * (hv_Img_Rotate_Angle.TupleSin()
                ));

            //目前圖形 R3_ 位置
            hv_R3_Pos_Row = (hv_STD_Row + hv_R3_Y) + hv_OffsetRow;
            hv_R3_Pos_Col = (hv_STD_Col + hv_R3_X) + hv_OffsetCol;

            //** 開始計算
            ho_R3_Circle.Dispose();
            HOperatorSet.GenCircle(out ho_R3_Circle, hv_R3_Pos_Row, hv_R3_Pos_Col, hv_R3_R);
            ho_R3_ROI_Image.Dispose();
            HOperatorSet.ReduceDomain(ho_Image, ho_R3_Circle, out ho_R3_ROI_Image);
            ho_R3_Region.Dispose();
            HOperatorSet.FastThreshold(ho_R3_ROI_Image, out ho_R3_Region, 100, 255, 15);
            ho_R3_ImageReduced.Dispose();
            HOperatorSet.ReduceDomain(ho_R3_ROI_Image, ho_R3_Region, out ho_R3_ImageReduced
                );
            //stop ()
            //sobel_fast 具有較寬的選擇範圍,搭配 alpha 參數 (alpha 越大, 容錯範圍大)
            hv_alpha = 0.9;
            hv_R3_low = 20;
            hv_R3_high = 60;
            ho_R3_Edges.Dispose();
            HOperatorSet.EdgesSubPix(ho_R3_ImageReduced, out ho_R3_Edges, "sobel_fast",
                hv_alpha, hv_R3_low, hv_R3_high);
            //stop ()
            //*所有的數值越小,表示容錯範圍大,反之亦然
            ho_R3_ContoursSplit.Dispose();
            HOperatorSet.SegmentContoursXld(ho_R3_Edges, out ho_R3_ContoursSplit, "lines_circles",
                17, 4, 2);
            //Display the results
            //===========================================================
            HOperatorSet.CountObj(ho_R3_ContoursSplit, out hv_R3_NumSegments);
            hv_NumCircles = 0;
            hv_Num_Circle_Point = 0;
            hv_R3 = 999;
            for (hv_i = 1; hv_i.Continue(hv_R3_NumSegments, 1); hv_i = hv_i.TupleAdd(1))
            {
                ho_R3_SingleSegment.Dispose();
                HOperatorSet.SelectObj(ho_R3_ContoursSplit, out ho_R3_SingleSegment, hv_i);
                HOperatorSet.GetContourGlobalAttribXld(ho_R3_SingleSegment, "cont_approx",
                    out hv_Attrib);
                if ((int)(new HTuple(hv_Attrib.TupleEqual(1))) != 0)
                {
                    HOperatorSet.FitCircleContourXld(ho_R3_SingleSegment, "atukey", -1, 2,
                        hv_Num_Circle_Point, 5, 2, out hv_R3_Row, out hv_R3_Column, out hv_R3_Radius,
                        out hv_R3_StartPhi, out hv_R3_EndPhi, out hv_R3_PointOrder);

                    hv_NumCircles = hv_NumCircles + 1;
                    if ((int)(new HTuple(hv_R3.TupleGreater(hv_R3_Radius))) != 0)
                    {
                        hv_R3 = hv_R3_Radius.Clone();
                        mResult = new CircleResult()
                        {
                            Row = new HTuple(hv_R3_Row),
                            Col = new HTuple(hv_R3_Column),
                            Radius = new HTuple(hv_R3_Radius),
                            StartPhi = new HTuple(hv_R3_StartPhi),
                            EndPhi = new HTuple(hv_R3_EndPhi),
                            PointOrder = new HTuple(hv_R3_PointOrder),
                        };
                        //HOperatorSet.SetTposition(hv_WindowHandle, (hv_R3_Pos_Row - hv_msgOffsetY) + 60,
                        //	(hv_R3_Pos_Col + hv_msgOffsetX) - 60);
                        //HOperatorSet.WriteString(hv_WindowHandle, "R3");
                        //stop ()
                    }
                }
            }

            //*****R3 End
            ho_R3_Circle.Dispose();
            ho_R3_ROI_Image.Dispose();
            ho_R3_Region.Dispose();
            ho_R3_ImageReduced.Dispose();
            ho_R3_Edges.Dispose();
            ho_R3_ContoursSplit.Dispose();
            ho_R3_SingleSegment.Dispose();
            ho_R3_ContEllipse.Dispose();

            return mResult;
        }
开发者ID:Joncash,项目名称:HanboAOMClassLibrary,代码行数:101,代码来源:SDMS_R3.cs

示例6: Action


//.........这里部分代码省略.........
            }
            if (HDevWindowStack.IsOpen())
            {
                HOperatorSet.DispObj(ho_Image, HDevWindowStack.GetActive());
            }
            //*****B
            //STD B_ 位置
            hv_STD_B_Row = 743;
            hv_STD_B_Col = 1118;

            //STD 向量 STD_B_
            hv_STD_B_V_Row = hv_STD_B_Row - hv_STD_Row;
            hv_STD_B_V_Col = hv_STD_B_Col - hv_STD_Col;

            //B_X, B_Y 分量
            hv_B_X = (hv_STD_B_V_Col * (hv_Img_Rotate_Angle.TupleCos())) + (hv_STD_B_V_Row * (hv_Img_Rotate_Angle.TupleSin()
                ));
            hv_B_Y = (hv_STD_B_V_Row * (hv_Img_Rotate_Angle.TupleCos())) - (hv_STD_B_V_Col * (hv_Img_Rotate_Angle.TupleSin()
                ));

            //目前圖形 B_ 位置
            hv_B_Pos_Row = (hv_STD_Row + hv_B_Y) + hv_OffsetRow;
            hv_B_Pos_Col = (hv_STD_Col + hv_B_X) + hv_OffsetCol;

            hv_ROI_W = 150;
            hv_ROI_H = 600;
            ho_ROI_Rec.Dispose();
            HOperatorSet.GenRectangle2(out ho_ROI_Rec, hv_B_Pos_Row, hv_B_Pos_Col, hv_Img_Rotate_Angle,
                hv_ROI_W, hv_ROI_H);
            //stop ()
            ho_ROI_Image.Dispose();
            HOperatorSet.ReduceDomain(ho_Image, ho_ROI_Rec, out ho_ROI_Image);
            //corner detect
            hv_low = 130;
            hv_high = 180;
            ho_ROI_Edges.Dispose();
            HOperatorSet.EdgesSubPix(ho_ROI_Image, out ho_ROI_Edges, "lanser2", 0.3, hv_low,
                hv_high);
            //stop ()
            hv_algo = "lines";
            ho_ROI_ContoursSplit.Dispose();
            HOperatorSet.SegmentContoursXld(ho_ROI_Edges, out ho_ROI_ContoursSplit, hv_algo,
                9, 4, 2);
            ho_ROI_SortedContours.Dispose();
            HOperatorSet.SortContoursXld(ho_ROI_ContoursSplit, out ho_ROI_SortedContours,
                "upper_left", "true", "row");
            HOperatorSet.CountObj(ho_ROI_SortedContours, out hv_Number);
            if (HDevWindowStack.IsOpen())
            {
                //dev_display (ROI_SortedContours)
            }
            //兩線段
            if ((int)(new HTuple(hv_Number.TupleEqual(2))) != 0)
            {
                ho_FirstLine.Dispose();
                HOperatorSet.SelectObj(ho_ROI_SortedContours, out ho_FirstLine, 1);
                ho_SecondLine.Dispose();
                HOperatorSet.SelectObj(ho_ROI_SortedContours, out ho_SecondLine, 2);
                HOperatorSet.FitLineContourXld(ho_FirstLine, "tukey", -1, 0, 5, 2, out hv_FirstRowBegin,
                    out hv_FirstColBegin, out hv_FirstRowEnd, out hv_FirstColEnd, out hv_FirstNr,
                    out hv_FirstNc, out hv_FirstDist);
                HOperatorSet.FitLineContourXld(ho_SecondLine, "tukey", -1, 0, 5, 2, out hv_SecondRowBegin,
                    out hv_SecondColBegin, out hv_SecondRowEnd, out hv_SecondColEnd, out hv_SecondNr,
                    out hv_SecondNc, out hv_SecondDist);

                //line to line
                //取兩線段的最小距離
                HOperatorSet.DistanceSs(hv_FirstRowBegin, hv_FirstColBegin, hv_FirstRowEnd,
                    hv_FirstColEnd, hv_SecondRowBegin, hv_SecondColBegin, hv_SecondRowEnd,
                    hv_SecondColEnd, out hv_minDist, out hv_maxDist);

                mResult = new DistanceResult()
                {
                    FirstRowBegin = new HTuple(hv_FirstRowBegin),
                    FirstColBegin = new HTuple(hv_FirstColBegin),
                    FirstRowEnd = new HTuple(hv_FirstRowEnd),
                    FirstColEnd = new HTuple(hv_FirstColEnd),
                    SecondRowBegin = new HTuple(hv_SecondRowBegin),
                    SecondColBegin = new HTuple(hv_SecondColBegin),
                    SecondRowEnd = new HTuple(hv_SecondRowEnd),
                    SecondColEnd = new HTuple(hv_SecondColEnd),
                    Angle = new HTuple(this.hv_AllModelAngle),
                    Distance = new HTuple(hv_minDist),
                    Direction = LineDirection.Vertical,
                };

            }

            //*****B End

            ho_ROI_Rec.Dispose();
            ho_ROI_Image.Dispose();
            ho_ROI_Edges.Dispose();
            ho_ROI_ContoursSplit.Dispose();
            ho_ROI_SortedContours.Dispose();
            ho_FirstLine.Dispose();
            ho_SecondLine.Dispose();

            return mResult;
        }
开发者ID:Joncash,项目名称:HanboAOMClassLibrary,代码行数:101,代码来源:SDMS_B.cs

示例7: Action


//.........这里部分代码省略.........
            //****Display
            if (HDevWindowStack.IsOpen())
            {
                HOperatorSet.ClearWindow(HDevWindowStack.GetActive());
            }
            if (HDevWindowStack.IsOpen())
            {
                HOperatorSet.DispObj(ho_Image, HDevWindowStack.GetActive());
            }
            //*****R6
            hv_R6 = 999;
            //STD R6_ 位置
            hv_STD_R6_Row = 1292;
            hv_STD_R6_Col = 639;

            //STD 向量 STD_R6_
            hv_STD_R6_V_Row = hv_STD_R6_Row - hv_STD_Row;
            hv_STD_R6_V_Col = hv_STD_R6_Col - hv_STD_Col;

            //R6_X, R6_Y 分量
            hv_R6_X = (hv_STD_R6_V_Col * (hv_Img_Rotate_Angle.TupleCos())) + (hv_STD_R6_V_Row * (hv_Img_Rotate_Angle.TupleSin()
                ));
            hv_R6_Y = (hv_STD_R6_V_Row * (hv_Img_Rotate_Angle.TupleCos())) - (hv_STD_R6_V_Col * (hv_Img_Rotate_Angle.TupleSin()
                ));

            //目前圖形 R4 位置
            hv_R6_Pos_Row = (hv_STD_Row + hv_R6_Y) + hv_OffsetRow;
            hv_R6_Pos_Col = (hv_STD_Col + hv_R6_X) + hv_OffsetCol;

            //R6_Region 由半徑 29 開始搜尋, 最大搜尋至 41, Inc =2
            hv_R6_R = 29;
            hv_R6_R_Max = 41;
            hv_R6_R_Inc = 2;
            while ((int)((new HTuple(hv_R6.TupleEqual(999))).TupleAnd(new HTuple(hv_R6_R.TupleLess(
                hv_R6_R_Max)))) != 0)
            {
                //*******************************
                ho_R6_Circle.Dispose();
                HOperatorSet.GenCircle(out ho_R6_Circle, hv_R6_Pos_Row, hv_R6_Pos_Col, hv_R6_R);
                ho_R6_ROI_Image.Dispose();
                HOperatorSet.ReduceDomain(ho_Image, ho_R6_Circle, out ho_R6_ROI_Image);
                ho_R6_Region.Dispose();
                HOperatorSet.Threshold(ho_R6_ROI_Image, out ho_R6_Region, 100, 255);
                ho_R6_RegionBorder.Dispose();
                HOperatorSet.Boundary(ho_R6_Region, out ho_R6_RegionBorder, "inner");
                ho_R6_RegionDilation.Dispose();
                HOperatorSet.DilationCircle(ho_R6_RegionBorder, out ho_R6_RegionDilation,
                    1.5);
                ho_R6_ImageReduced.Dispose();
                HOperatorSet.ReduceDomain(ho_R6_ROI_Image, ho_R6_RegionDilation, out ho_R6_ImageReduced
                    );
                ho_R6_Edges.Dispose();
                HOperatorSet.EdgesSubPix(ho_R6_ImageReduced, out ho_R6_Edges, "lanser2",
                    0.3, 40, 90);

                //fast_threshold (R6_ROI_Image, R6_Region, 80, 255, 15)
                //reduce_domain (R6_ROI_Image, R6_Region, R6_ImageReduced)
                //sobel_fast 具有較寬的選擇範圍,搭配 alpha 參數 (alpha 越大, 容錯範圍大)
                //alpha := 10
                //R6_low := 10
                //R6_high := 60
                //edges_sub_pix (R6_ImageReduced, R6_Edges, 'sobel_fast', alpha, R6_low, R6_high)
                //stop ()
                //*所有的數值越小,表示容錯範圍大,反之亦然
                ho_R6_ContoursSplit.Dispose();
                HOperatorSet.SegmentContoursXld(ho_R6_Edges, out ho_R6_ContoursSplit, "lines_circles",
开发者ID:Joncash,项目名称:HanboAOMClassLibrary,代码行数:67,代码来源:SDMS_R6.cs


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