public ShapeMatch(HObject Image, Algorithm al)
 {
     HOperatorSet.GenEmptyObj(out RegionToDisp);
     RegionToDisp.Dispose();
     this.Image = Image; this.algorithm = al; vOrh = "h";
     pixeldist  = 1;
 }
Ejemplo n.º 2
0
 public ScrewPitchTool(HObject Image, Algorithm al)
 {
     this.Image = Image; this.algorithm.Image = Image; this.algorithm = al;
     HOperatorSet.GenEmptyObj(out RegionToDisp);
     RegionToDisp.Dispose();
     pixeldist = 1;
 }
 public BigSmallDiameter(HObject Image, Algorithm al)
 {
     this.Image           = Image;
     this.algorithm.Image = Image;
     this.algorithm       = al;
     HOperatorSet.GenEmptyObj(out RegionToDisp);
     RegionToDisp.Dispose();
     pixeldist = 1;
 }
Ejemplo n.º 4
0
        private void Initial()
        {
            centerRow    = null;
            centerColumn = null;
            radius       = null;
            centerRow    = new HTuple();
            centerColumn = new HTuple();
            radius       = new HTuple();

            HOperatorSet.GenEmptyObj(out RegionToDisp);
            RegionToDisp.Dispose();
        }
Ejemplo n.º 5
0
        private void Initial()
        {
            //Dthv = null;
            Length1      = null;
            Length2      = null;
            Phi          = null;
            centerRow    = null;
            centerColumn = null;
            //centerRow = new HTuple();
            //Dthv = new HTuple();
            Length1      = new HTuple();
            Length2      = new HTuple();
            Phi          = new HTuple();
            centerRow    = new HTuple();
            centerColumn = new HTuple();

            HOperatorSet.GenEmptyObj(out RegionToDisp);
            RegionToDisp.Dispose();
        }
 public chilunbiaomian2()
 {
     //RegionToDisp = Image;
     HOperatorSet.GenEmptyObj(out RegionToDisp);
     RegionToDisp.Dispose();
 }
Ejemplo n.º 7
0
 public OutCircletool()
 {
     HOperatorSet.GenEmptyObj(out RegionToDisp);
     RegionToDisp.Dispose();
 }
Ejemplo n.º 8
0
 public luowencc()
 {
     //RegionToDisp = Image;
     HOperatorSet.GenEmptyObj(out RegionToDisp);
     RegionToDisp.Dispose();
 }
Ejemplo n.º 9
0
 public nbzcdmian5()
 {
     //RegionToDisp = Image;
     HOperatorSet.GenEmptyObj(out RegionToDisp);
     RegionToDisp.Dispose();
 }
Ejemplo n.º 10
0
 public queliao()
 {
     //RegionToDisp = Image;
     HOperatorSet.GenEmptyObj(out RegionToDisp);
     RegionToDisp.Dispose();
 }
Ejemplo n.º 11
0
        // Main procedure
        private void action()
        {
            // Local iconic variables
            HObject ho_Rectangle;
            HObject ho_RegionFillUp, ho_RegionOut, Region;
            // Local control variables
            HTuple hv_length = new HTuple();

            // Initialize local and output iconic variables
            HOperatorSet.GenEmptyObj(out ho_Rectangle);
            HOperatorSet.GenEmptyObj(out ho_RegionFillUp);
            HOperatorSet.GenEmptyObj(out ho_RegionOut);
            HOperatorSet.GenEmptyObj(out Region);
            try
            {
                try
                {
                    ho_Rectangle.Dispose();
                    HOperatorSet.GenRectangle1(out ho_Rectangle, this.rr1, rc1, rr2,
                                               rc2);
                    Region.Dispose();
                    HOperatorSet.Intersection(ho_Rectangle, this.algorithm.Region, out Region);

                    ho_RegionFillUp.Dispose();
                    HOperatorSet.FillUp(Region, out ho_RegionFillUp);
                    ho_RegionOut.Dispose();
                    screwLength(ho_RegionFillUp, out ho_RegionOut, tr1, tc1, tr2,
                                tc2, hv_vOrh, out hv_length);
                    if (ho_RegionOut.IsInitialized())
                    {
                        RegionToDisp.Dispose();
                        HOperatorSet.Union1(ho_RegionOut, out RegionToDisp);
                        //HOperatorSet.ConcatObj(ho_RegionOut, RegionToDisp, out RegionToDisp);
                    }
                }
                catch (Exception e)
                {
                    hv_length = 0;
                }
                finally
                {
                    HTuple hv_result = new HTuple();
                    hv_result = hv_result.TupleConcat("螺牙长度");
                    hv_result = hv_result.TupleConcat(hv_length * pixeldist);
                    result    = hv_result.Clone();
                }
            }
            catch (HalconException HDevExpDefaultException)
            {
                ho_Rectangle.Dispose();
                ho_RegionFillUp.Dispose();
                ho_RegionOut.Dispose();
                throw HDevExpDefaultException;
            }
            finally
            {
                ho_Rectangle.Dispose();
                ho_RegionFillUp.Dispose();
                ho_RegionOut.Dispose();
            }
        }
 public xiaomaoding1()
 {
     //RegionToDisp = Image;
     HOperatorSet.GenEmptyObj(out RegionToDisp);
     RegionToDisp.Dispose();
 }
Ejemplo n.º 13
0
        private void action()
        {
            _length = 0;
            // Local iconic variables

            HObject ho_Rectangle, ho_ImageReduced;
            HObject ho_Arrow, region;
            HObject ho_RegionTrans;
            HTuple  hv_Row, hv_Column, hv_Phi, hv_Length1, hv_Length2, hv_Distance_Measure_01_0;
            // Local control variables
            HTuple hv_Number;

            HOperatorSet.GenEmptyObj(out region);
            HOperatorSet.GenEmptyObj(out ho_Rectangle);
            HOperatorSet.GenEmptyObj(out ho_ImageReduced);
            HOperatorSet.GenEmptyObj(out ho_Arrow);
            HOperatorSet.GenEmptyObj(out ho_RegionTrans);
            try
            {
                ho_Rectangle.Dispose();
                HOperatorSet.GenRectangle1(out ho_Rectangle, this.DRow1, this.DColumn1, this.DRow2, this.DColumn2);
                HOperatorSet.Intersection(algorithm.Region, ho_Rectangle, out region);
                this.result = new HTuple();
                ho_Arrow.Dispose();
                ho_RegionTrans.Dispose();
                HOperatorSet.ShapeTrans(region, out ho_RegionTrans, "rectangle2");
                HOperatorSet.SmallestRectangle2(ho_RegionTrans, out hv_Row, out hv_Column, out hv_Phi,
                                                out hv_Length1, out hv_Length2);
                ho_Rectangle.Dispose();
                HOperatorSet.GenRectangle2(out ho_Rectangle, hv_Row, hv_Column, hv_Phi, hv_Length1,
                                           hv_Length2);

                xldLength(algorithm.Image, ho_Rectangle, out ho_Arrow, hv_Phi, out hv_Distance_Measure_01_0);
                this._length = hv_Distance_Measure_01_0;
                if (algorithm.Region.IsInitialized())
                {
                    HOperatorSet.CountObj(region, out hv_Number);
                    if ((int)(new HTuple(hv_Number.TupleEqual(1))) != 0)
                    {
                        this.Result = this.Result.TupleConcat("XLDlength");
                        this.Result = this.Result.TupleConcat(this._length * pixeldist);
                    }
                    else
                    {
                        this.Result = this.Result.TupleConcat("XLDlength");
                        this.Result = this.Result.TupleConcat(0);
                    }
                    //HOperatorSet.SetColor(this.LWindowHandle, "green");
                    //HOperatorSet.DispObj(ho_Arrow, this.LWindowHandle);
                    if (ho_Arrow.IsInitialized())
                    {
                        RegionToDisp.Dispose();
                        if (RegionToDisp.IsInitialized())
                        {
                            HOperatorSet.ConcatObj(ho_Arrow, RegionToDisp, out RegionToDisp);
                        }
                        else
                        {
                            HOperatorSet.CopyObj(ho_Arrow, out RegionToDisp, 1, 1);
                            HOperatorSet.Union1(RegionToDisp, out RegionToDisp);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                this.Result = new HTuple();
                this.Result = this.Result.TupleConcat("XLDlength");
                this.Result = this.Result.TupleConcat(0);
            }
            finally
            {
                algorithm.Region.Dispose();
                region.Dispose();
                ho_Rectangle.Dispose();
                ho_ImageReduced.Dispose();
                ho_Arrow.Dispose();
                ho_RegionTrans.Dispose();
            }
        }
Ejemplo n.º 14
0
 public XldLength()
 {
     HOperatorSet.GenEmptyObj(out RegionToDisp);
     RegionToDisp.Dispose();
 }
Ejemplo n.º 15
0
 public dengzuoz()
 {
     //RegionToDisp = Image;
     HOperatorSet.GenEmptyObj(out RegionToDisp);
     RegionToDisp.Dispose();
 }
Ejemplo n.º 16
0
 public kakou()
 {
     HOperatorSet.GenEmptyObj(out RegionToDisp);
     RegionToDisp.Dispose();
 }
        private void action()
        {
            _length = 0;
            // Local iconic variables

            HObject ho_ImageReduced;
            HObject region, ho_regionOpening;
            // Local control variables
            HTuple hv_Number;
            HTuple hv_Row, hv_Column, hv_Angle, hv_Score, hv_Newtuple;

            HOperatorSet.GenEmptyObj(out region);

            HOperatorSet.GenEmptyObj(out ho_ImageReduced);

            try
            {
                if (hv_ModelID.Length != 1)
                {
                    HOperatorSet.ReadShapeModel(PathHelper.currentProductPath + @"\Pictures.shm", out hv_ModelID);
                }

                HOperatorSet.FindShapeModel(this.Image, hv_ModelID, 0, (new HTuple(360)).TupleRad()
                                            , 0.5, 0, 0.5, "least_squares", 0, 0.9, out hv_Row, out hv_Column, out hv_Angle,
                                            out hv_Score);
                if ((int)(new HTuple((new HTuple(hv_Score.TupleLength())).TupleGreaterEqual(1))) != 0)
                {
                    HOperatorSet.TupleGenConst(new HTuple(hv_Score.TupleLength()), 100, out hv_Newtuple);

                    HOperatorSet.GenCircle(out region, hv_Row, hv_Column, hv_Newtuple);
                }
                this.result = new HTuple();
                if (region.IsInitialized())
                {
                    HOperatorSet.CountObj(region, out hv_Number);
                    if ((int)(new HTuple(hv_Number.TupleGreaterEqual(1))) != 0)
                    {
                        this.Result = this.Result.TupleConcat("数量");
                        this.Result = this.Result.TupleConcat(hv_Number);
                    }


                    RegionToDisp.Dispose();
                    if (RegionToDisp.IsInitialized())
                    {
                        HOperatorSet.ConcatObj(region, RegionToDisp, out RegionToDisp);
                    }
                    else
                    {
                        //HOperatorSet.GenRegionContourXld(region, out RegionToDisp, "filled");
                        HOperatorSet.Union1(region, out RegionToDisp);
                    }
                }
            }
            catch (Exception e)
            {
                this.Result = new HTuple();
                this.Result = this.Result.TupleConcat("数量");
                this.Result = this.Result.TupleConcat(0);
            }
            finally
            {
                //algorithm.Region.Dispose();
                region.Dispose();
                ho_ImageReduced.Dispose();
            }
        }
Ejemplo n.º 18
0
 public heipiwaiquan()
 {
     //RegionToDisp = Image;
     HOperatorSet.GenEmptyObj(out RegionToDisp);
     RegionToDisp.Dispose();
 }
Ejemplo n.º 19
0
 public xuanxianggao()
 {
     //RegionToDisp = Image;
     HOperatorSet.GenEmptyObj(out RegionToDisp);
     RegionToDisp.Dispose();
 }
 public dipanhuokou()
 {
     //RegionToDisp = Image;
     HOperatorSet.GenEmptyObj(out RegionToDisp);
     RegionToDisp.Dispose();
 }
Ejemplo n.º 21
0
        // Main procedure
        private void action()
        {
            // Local iconic variables

            HObject ho_Rectangle, ho_ImageReduced;
            HObject ho_RegionToDetect, ho_RegionOpening, ho_RegionDifference;
            HObject ho_Cross = null;
            // Local control variables
            HObject ho_Region;
            HTuple  hv_vOrh;
            HTuple  hv_maxDist = new HTuple(), hv_minDist = new HTuple();
            HTuple  hv_meanDist = new HTuple(), hv_Exception;

            // Initialize local and output iconic variables

            HOperatorSet.GenEmptyObj(out ho_Region);
            HOperatorSet.GenEmptyObj(out ho_Rectangle);
            HOperatorSet.GenEmptyObj(out ho_ImageReduced);
            HOperatorSet.GenEmptyObj(out ho_RegionToDetect);
            HOperatorSet.GenEmptyObj(out ho_RegionOpening);
            HOperatorSet.GenEmptyObj(out ho_RegionDifference);
            HOperatorSet.GenEmptyObj(out ho_Cross);

            try
            {
                //HOperatorSet.SetDraw(this.LWindowHandle, "margin");
                //disp_message(this.LWindowHandle, "选中一个牙", "window", 12, 12, "black",
                //    "true");
                //HOperatorSet.DrawRectangle1(this.LWindowHandle, out hv_Row1, out hv_Column1,
                //    out hv_Row2, out hv_Column2);
                //ho_Rectangle.Dispose();
                //HOperatorSet.GenRectangle1(out ho_Rectangle, hv_Row1, hv_Column1, hv_Row2,
                //    hv_Column2);
                //disp_message(this.LWindowHandle, "选中检测区域", "window", 12, 12, "black",
                //    "true");
                //HOperatorSet.DrawRectangle1(this.LWindowHandle, out hv_Row11, out hv_Column11,
                //    out hv_Row21, out hv_Column21);
                ho_Rectangle.Dispose();
                HOperatorSet.GenRectangle1(out ho_Rectangle, this.rr1, this.rc1, this.rr2,
                                           this.rc2);
                ho_Region.Dispose();
                HOperatorSet.Intersection(ho_Rectangle, this.algorithm.Region, out ho_Region);
                //ho_ImageReduced.Dispose();
                //HOperatorSet.ReduceDomain(ho_Image, ho_Rectangle, out ho_ImageReduced);
                //ho_RegionToDetect.Dispose();
                //HOperatorSet.Threshold(ho_ImageReduced, out ho_RegionToDetect, 0, 128);
                ho_RegionOpening.Dispose();
                HOperatorSet.OpeningRectangle1(ho_Region, out ho_RegionOpening, tc2 - tc1,
                                               tr2 - tr1);
                ho_RegionDifference.Dispose();
                HOperatorSet.Difference(ho_Region, ho_RegionOpening, out ho_RegionDifference
                                        );
                hv_vOrh = "h";
                try
                {
                    ho_Cross.Dispose();
                    TeethDist(ho_RegionDifference, out ho_Cross, hv_vOrh, out hv_maxDist, out hv_minDist,
                              out hv_meanDist);
                    if (ho_Cross.IsInitialized())
                    {
                        if (RegionToDisp.IsInitialized())
                        {
                            HOperatorSet.ConcatObj(ho_Cross, RegionToDisp, out RegionToDisp);
                            HOperatorSet.GenRegionContourXld(ho_Cross, out RegionToDisp, "filled");
                            HOperatorSet.Union1(RegionToDisp, out RegionToDisp);
                        }
                        else
                        {
                            HOperatorSet.GenRegionContourXld(ho_Cross, out RegionToDisp, "filled");
                            HOperatorSet.Union1(RegionToDisp, out RegionToDisp);
                        }
                    }
                }
                // catch (Exception)
                catch (HalconException HDevExpDefaultException1)
                {
                    HDevExpDefaultException1.ToHTuple(out hv_Exception);
                    hv_maxDist  = 0;
                    hv_minDist  = 0;
                    hv_meanDist = 0;
                }
                finally
                {
                    HTuple hv_result = new HTuple();
                    hv_result = hv_result.TupleConcat("最大间距");
                    hv_result = hv_result.TupleConcat(hv_maxDist * pixeldist);

                    hv_result = hv_result.TupleConcat("最小间距");
                    hv_result = hv_result.TupleConcat(hv_minDist * pixeldist);

                    hv_result = hv_result.TupleConcat("平均间距");
                    hv_result = hv_result.TupleConcat(hv_meanDist * pixeldist);

                    result = hv_result.Clone();
                }
            }
            catch (HalconException HDevExpDefaultException)
            {
                ho_Rectangle.Dispose();
                ho_ImageReduced.Dispose();
                ho_RegionToDetect.Dispose();
                ho_RegionOpening.Dispose();
                ho_RegionDifference.Dispose();
                ho_Cross.Dispose();

                throw HDevExpDefaultException;
            }

            ho_Rectangle.Dispose();
            ho_ImageReduced.Dispose();
            ho_RegionToDetect.Dispose();
            ho_RegionOpening.Dispose();
            ho_RegionDifference.Dispose();
            ho_Cross.Dispose();
        }
 public shangcengbm()
 {
     //RegionToDisp = Image;
     HOperatorSet.GenEmptyObj(out RegionToDisp);
     RegionToDisp.Dispose();
 }
Ejemplo n.º 23
0
 public gaodu11()
 {
     //RegionToDisp = Image;
     HOperatorSet.GenEmptyObj(out RegionToDisp);
     RegionToDisp.Dispose();
 }
        private void action()
        {
            HObject ho_RegionOpening1;
            HObject ho_RegionDifference, ho_Rectangle, ho_RegionIntersection;
            HObject ho_ObjectsConcat;


            // Local control variables

            HTuple hv_Width, hv_Height, hv_Row1, hv_Column1;
            HTuple hv_Row2, hv_Column2, hv_length;

            // Initialize local and output iconic variables


            HOperatorSet.GenEmptyObj(out ho_RegionOpening1);
            HOperatorSet.GenEmptyObj(out ho_RegionDifference);
            HOperatorSet.GenEmptyObj(out ho_Rectangle);
            HOperatorSet.GenEmptyObj(out ho_RegionIntersection);
            HOperatorSet.GenEmptyObj(out ho_ObjectsConcat);

            try
            {
                HOperatorSet.GetImageSize(this.algorithm.Image, out hv_Width, out hv_Height);
                ho_RegionOpening1.Dispose();
                HOperatorSet.OpeningRectangle1(algorithm.Region, out ho_RegionOpening1, 2, hv_Height);
                ho_RegionDifference.Dispose();
                HOperatorSet.Difference(algorithm.Region, ho_RegionOpening1, out ho_RegionDifference
                                        );

                ho_Rectangle.Dispose();
                HOperatorSet.GenRectangle1(out ho_Rectangle, R1, C1, R2,
                                           C2);

                ho_RegionIntersection.Dispose();
                HOperatorSet.Intersection(ho_RegionDifference, ho_Rectangle, out ho_RegionIntersection
                                          );
                ho_ObjectsConcat.Dispose();
                length1(ho_RegionIntersection, ho_RegionDifference, out ho_ObjectsConcat, out hv_length);
                hv_length *= pixeldist;
                HTuple hv_result = new HTuple();
                this.Result = new HTuple();
                hv_result   = hv_result.TupleConcat("PartLenght");
                hv_result   = hv_result.TupleConcat(hv_length);
                result      = hv_result.Clone();
                if (ho_ObjectsConcat.IsInitialized())
                {
                    if (RegionToDisp.IsInitialized())
                    {
                        HOperatorSet.ConcatObj(ho_ObjectsConcat, RegionToDisp, out RegionToDisp);
                        //HOperatorSet.GenRegionContourXld(ho_ObjectsConcat, out RegionToDisp, "filled");
                        HOperatorSet.Union1(RegionToDisp, out RegionToDisp);
                    }
                    else
                    {
                        HOperatorSet.GenRegionContourXld(ho_ObjectsConcat, out RegionToDisp, "filled");
                        HOperatorSet.Union1(RegionToDisp, out RegionToDisp);
                    }
                }
            }
            catch (HalconException HDevExpDefaultException)
            {
                hv_length = 0;
                HTuple hv_result = new HTuple();
                this.Result = new HTuple();
                hv_result   = hv_result.TupleConcat("PartLenght");
                hv_result   = hv_result.TupleConcat(0);
                result      = hv_result.Clone();


                ho_RegionOpening1.Dispose();
                ho_RegionDifference.Dispose();
                ho_Rectangle.Dispose();
                ho_RegionIntersection.Dispose();
                ho_ObjectsConcat.Dispose();

                throw HDevExpDefaultException;
            }


            ho_RegionOpening1.Dispose();
            ho_RegionDifference.Dispose();
            ho_Rectangle.Dispose();
            ho_RegionIntersection.Dispose();
            ho_ObjectsConcat.Dispose();
        }
Ejemplo n.º 25
0
        private void action()
        {
            // Stack for temporary objects
            HObject[] OTemp = new HObject[20];
            long      SP_O  = 0;
            // Local iconic variables
            HObject ho_Circle, region;
            HObject ho_SelectedRegions, ho_outCircle;
            // Local control variables

            //HTuple hv_blackOrwhite, hv_threshold_value;
            //HTuple hv_method, hv_andOror, hv_method_min_value, hv_method_max_value;
            HTuple hv_outer_Row, hv_outer_Column;
            HTuple hv_outer_Radius, hv_Circularity;
            HTuple hv_Number = new HTuple(), hv_result = new HTuple();

            // Initialize local and output iconic variables
            //HOperatorSet.GenEmptyObj(out ho_Image);
            HOperatorSet.GenEmptyObj(out ho_Circle);
            HOperatorSet.GenEmptyObj(out ho_SelectedRegions);
            HOperatorSet.GenEmptyObj(out ho_outCircle);
            HOperatorSet.GenEmptyObj(out region);
            try
            {
                //HOperatorSet.SetColor(this.LWindowHandle, "green");
                //    out hv_Radius);
                ho_Circle.Dispose();
                HOperatorSet.GenCircle(out ho_Circle, DCenterRow, DCenterColumn, DRadius);
                HOperatorSet.Intersection(ho_Circle, algorithm.Region, out region);
                region_outer_circle(region, out ho_outCircle, out hv_outer_Row,
                                    out hv_outer_Column, out hv_outer_Radius, out hv_Circularity);

                //HOperatorSet.DispObj(ho_outCircle, this.LWindowHandle);
                RegionToDisp.Dispose();
                if (!RegionToDisp.IsInitialized())
                {
                    HOperatorSet.CopyObj(ho_outCircle, out RegionToDisp, 1, 1);
                }
                else
                {
                    HOperatorSet.ConcatObj(ho_outCircle, RegionToDisp, out RegionToDisp);
                }
                //RegionToDisp
                HOperatorSet.CountObj(ho_outCircle, out hv_Number);
                if ((int)(new HTuple(hv_Number.TupleEqual(1))) != 0)
                {
                    hv_result = hv_result.TupleConcat("center_row");
                    hv_result = hv_result.TupleConcat(hv_outer_Row * pixeldist);
                    hv_result = hv_result.TupleConcat("center_column");
                    hv_result = hv_result.TupleConcat(hv_outer_Column * pixeldist);
                    hv_result = hv_result.TupleConcat("diameter");
                    hv_result = hv_result.TupleConcat(2 * hv_outer_Radius * pixeldist);
                    hv_result = hv_result.TupleConcat("circularity");
                    hv_result = hv_result.TupleConcat(hv_Circularity);
                    result    = hv_result.Clone();
                }
                else
                {
                    hv_result = hv_result.TupleConcat("center_row");
                    hv_result = hv_result.TupleConcat(0);
                    hv_result = hv_result.TupleConcat("center_column");
                    hv_result = hv_result.TupleConcat(0);
                    hv_result = hv_result.TupleConcat("diameter");
                    hv_result = hv_result.TupleConcat(0);
                    hv_result = hv_result.TupleConcat("circularity");
                    hv_result = hv_result.TupleConcat(0);
                    result    = hv_result.Clone();
                }
            }
            catch (HalconException HDevExpDefaultException)
            {
                this.Result = new HTuple();
                MyDebug.ShowMessage("CircleToolsError:=" + HDevExpDefaultException);
                hv_result = hv_result.TupleConcat("center_row");
                hv_result = hv_result.TupleConcat(0);
                hv_result = hv_result.TupleConcat("center_column");
                hv_result = hv_result.TupleConcat(0);
                hv_result = hv_result.TupleConcat("diameter");
                hv_result = hv_result.TupleConcat(0);
                hv_result = hv_result.TupleConcat("circularity");
                hv_result = hv_result.TupleConcat(0);
                result    = hv_result.Clone();
            }
            finally
            {
                ho_Circle.Dispose();
                region.Dispose();
                ho_SelectedRegions.Dispose();
                ho_outCircle.Dispose();
                algorithm.Region.Dispose();
            }
        }
 public PartHeight()
 {
     HOperatorSet.GenEmptyObj(out RegionToDisp);
     RegionToDisp.Dispose();
 }
Ejemplo n.º 27
0
 public waiguan2()
 {
     //RegionToDisp = Image;
     HOperatorSet.GenEmptyObj(out RegionToDisp);
     RegionToDisp.Dispose();
 }
 public ShapeMatch()
 {
     HOperatorSet.GenEmptyObj(out RegionToDisp);
     RegionToDisp.Dispose();
 }
Ejemplo n.º 29
0
 public kongxinju()
 {
     //RegionToDisp = Image;
     HOperatorSet.GenEmptyObj(out RegionToDisp);
     RegionToDisp.Dispose();
 }
        private void action()
        {
            HObject ho_Rectangle;
            HObject ho_Region, ho_Arrow;
            HTuple  hv_result = new HTuple();
            HTuple  hv_big_diameter, hv_small_diameter;

            HOperatorSet.GenEmptyObj(out ho_Rectangle);
            HOperatorSet.GenEmptyObj(out ho_Region);
            HOperatorSet.GenEmptyObj(out ho_Arrow);
            try
            {
                ho_Rectangle.Dispose();
                HOperatorSet.GenRectangle1(out ho_Rectangle, this.R1, this.C1, this.R2, this.C2);
                if (algorithm.Region.IsInitialized())
                {
                    HOperatorSet.Intersection(ho_Rectangle, algorithm.Region, out ho_Region);
                }
                else
                {
                    //MyDebug.ShowMessage("BigSmallDiameter RegionToDisp=NULL");
                }
                ho_Arrow.Dispose();
                hv_big_diameter   = 0;
                hv_small_diameter = 0;
                big_small_screwteeth(ho_Region, out ho_Arrow, "black", "h", out hv_big_diameter,
                                     out hv_small_diameter);



                if ((int)(new HTuple(hv_big_diameter.Length)) == 1)
                {
                    hv_result = hv_result.TupleConcat("big_diameter");
                    hv_result = hv_result.TupleConcat(hv_big_diameter * pixeldist);
                    hv_result = hv_result.TupleConcat("small_diameter");
                    hv_result = hv_result.TupleConcat(hv_small_diameter * pixeldist);

                    result = hv_result.Clone();
                }
                else
                {
                    hv_result = hv_result.TupleConcat("big_diameter");
                    hv_result = hv_result.TupleConcat(0);
                    hv_result = hv_result.TupleConcat("small_diameter");
                    hv_result = hv_result.TupleConcat(0);
                    result    = hv_result.Clone();
                }
                if (ho_Arrow.IsInitialized())
                {
                    if (RegionToDisp.IsInitialized())
                    {
                        HOperatorSet.ConcatObj(ho_Arrow, RegionToDisp, out RegionToDisp);
                        HOperatorSet.GenRegionContourXld(ho_Arrow, out RegionToDisp, "filled");
                        HOperatorSet.Union1(RegionToDisp, out RegionToDisp);
                    }
                    else
                    {
                        HOperatorSet.GenRegionContourXld(ho_Arrow, out RegionToDisp, "filled");
                        HOperatorSet.Union1(RegionToDisp, out RegionToDisp);
                    }
                }
            }
            catch (Exception e)
            {
                this.Result = new HTuple();
                hv_result   = hv_result.TupleConcat("big_diameter");
                hv_result   = hv_result.TupleConcat(0);
                hv_result   = hv_result.TupleConcat("small_diameter");
                hv_result   = hv_result.TupleConcat(0);
                result      = hv_result.Clone();
            }
            finally
            {
                ho_Rectangle.Dispose();
                ho_Region.Dispose();
                ho_Arrow.Dispose();
            }
        }