Ejemplo n.º 1
0
        public void SobelFilter(HDrawingObject dobj, HWindow hwin, string type)
        {
            try
            {
                HObject region = null;

                if (dobj.GetDrawingObjectParams("type") == "line")
                {
                    HTuple a = dobj.GetDrawingObjectParams("row1");
                    HOperatorSet.GenRegionLine(out region, dobj.GetDrawingObjectParams("row1"),
                                               dobj.GetDrawingObjectParams("column1"), dobj.GetDrawingObjectParams("row2"),
                                               dobj.GetDrawingObjectParams("column2"));
                }
                else
                {
                    region = new HRegion(dobj.GetDrawingObjectIconic());
                }

                AddToStack(region);
                DisplayResults();
            }
            catch (HalconException hex)
            {
                MessageBox.Show(hex.GetErrorMessage(), "HALCON error", MessageBoxButtons.OK);
            }
        }
Ejemplo n.º 2
0
        private void getposistion(HDrawingObject img, HWindow hwin, string type)
        {
            HRegion region = new HRegion(img.GetDrawingObjectIconic());

            HOperatorSet.RegionFeatures(region, new HTuple(new string[] { "row", "column", "rect2_len1", "rect2_len2", "phi" }), out HTuple values);
            arr1 = values.ToDArr();
        }
Ejemplo n.º 3
0
 public void SobelFilter(HDrawingObject dobj, HWindow hwin, string type)
 {
     try
     {
         HImage  image  = halcon_dialog.BackgroundImage;
         HRegion region = new HRegion(dobj.GetDrawingObjectIconic());
         hwin.SetWindowParam("flush", "false");
         hwin.ClearWindow();
         hwin.DispObj(image.ReduceDomain(region).SobelAmp("sum_abs", 11));
         hwin.SetWindowParam("flush", "true");
         hwin.FlushBuffer();
     }
     catch (HalconException hex)
     {
         MessageBox.Show(hex.GetErrorMessage(), "HALCON error", MessageBoxButtons.OK);
     }
 }