Ejemplo n.º 1
0
        public HRegion Extract(HImage image)
        {
            int usedThreshold;
            var region = image.BinaryThreshold("max_separability", LightDark.ToHalconString(), out usedThreshold);

            return(region);
        }
        public HRegion Extract(HImage image)
        {
            int usedThreshold;
            var region1      = image.BinaryThreshold("max_separability", LightDark1.ToHalconString(), out usedThreshold);
            var reducedImage = image.ReduceDomain(region1);

            int usedThreshold2;
            var region2 = reducedImage.BinaryThreshold("max_separability", LightDark2.ToHalconString(), out usedThreshold2);

            reducedImage.Dispose();

            return(region2);
        }
Ejemplo n.º 3
0
        private static bool CalculateEdgeGradientEx(HImage image, ref HTuple mean)
        {
            bool ret = false;

            try
            {
                if (image == null)
                {
                    return(ret);
                }
                HTuple  usedThreshold   = 0;
                HRegion thresholdRegion = image.BinaryThreshold("max_separability", "dark", out usedThreshold);
                HImage  imageReduced    = image.ReduceDomain(thresholdRegion);
                //imageReduced.WriteImage("bmp", 0, "C:\\Users\\nuc\\Desktop\\FocusImage\\BinaryThreshold.bmp"); save image for verify
                ret = CalculateEdgeGradient(imageReduced, ref mean);
            }
            catch (HalconException hex)
            {
                Trace.WriteLine(hex.GetErrorMessage(), "HALCON error");
            }
            return(ret);
        }