public HRegion Extract(HImage image)
        {
            if (!(LightDark == LightDark.Light || LightDark == LightDark.Dark))
            {
                throw new InvalidOperationException("BinaryThresholdRegionExtractor.LightDark must be Light or Dark. Now is " + LightDark);
            }

            HObject foundRegionObject;

            HDevelopExport.Singletone.GetRegionByBinaryThresholdRect2(image,
                                                                      out foundRegionObject,
                                                                      MeanMaskWidth,
                                                                      MeanMaskHeight,
                                                                      ScaleAdd,
                                                                      LightDark.ToHalconString(),
                                                                      AreaMin,
                                                                      AreaMax,
                                                                      OpeningWidth,
                                                                      OpeningHeight,
                                                                      ClosingWidth,
                                                                      ClosingHeight,
                                                                      ErosionWidth,
                                                                      ErosionHeight,
                                                                      DilationWidth,
                                                                      DilationHeight);

            var hRegion = new HRegion(foundRegionObject);

            return(hRegion);
        }
示例#2
0
        public HRegion Extract(HImage image)
        {
            int usedThreshold;
            var region = image.BinaryThreshold("max_separability", LightDark.ToHalconString(), out usedThreshold);

            return(region);
        }
示例#3
0
        public HRegion Extract(HImage image)
        {
            var domain        = image.GetDomain();
            var offsetRow1    = domain.GetRow1();
            var offsetColumn1 = domain.GetColumn1();
            var croppedImage  = image.CropDomain();

            var    swThresholdImageFilter = new NotifyStopwatch("DynThresholdCroppedRegionExtractor.ThresholdImageFilter");
            HImage thresholdImage         = ThresholdImageFilter.Process(croppedImage);

            swThresholdImageFilter.Dispose();

            var     swDynThreshold = new NotifyStopwatch("DynThresholdCroppedRegionExtractor.DynThreshold");
            HRegion region         = croppedImage.DynThreshold(
                thresholdImage,
                Offset,
                LightDark.ToHalconString());

            swDynThreshold.Dispose();

            var movedRegion = region.MoveRegion(offsetRow1, offsetColumn1);

            croppedImage.Dispose();
            thresholdImage.Dispose();
            region.Dispose();

            return(movedRegion);
        }
示例#4
0
        public HRegion Extract(HImage image)
        {
            if (!(LightDark == LightDark.Light || LightDark == LightDark.Dark))
            {
                throw new InvalidOperationException("BinaryThresholdRectangle2RegionExtractor.LightDark must be Light or Dark. Now is " + LightDark);
            }

            HObject foundRegionObject;

            HDevelopExport.Singletone.GetRegionByBinaryThreshold(image,
                                                                 out foundRegionObject,
                                                                 MedianRadius,
                                                                 EmpWidth,
                                                                 EmpHeight,
                                                                 EmpFactor,
                                                                 LightDark.ToHalconString(),
                                                                 AreaMin,
                                                                 AreaMax,
                                                                 ClosingRadius,
                                                                 DilationRadius);

            var hRegion = new HRegion(foundRegionObject);

            return(hRegion);
        }
示例#5
0
        public HImage Process(HImage image)
        {
//            image.WriteImage("tiff", 0, @"B:\Test_Ori");

            var preprocessImage = PreprocessFilter.Process(image);
//            preprocessImage.WriteImage("tiff", 0, @"B:\Test_preprocessImage");

            var thresholdImage = ThresholdImageFilter.Process(preprocessImage);
//            thresholdImage.WriteImage("tiff", 0, @"B:\Test_thresholdImage");

            HRegion region = preprocessImage.DynThreshold(
                thresholdImage,
                Offset,
                LightDark.ToHalconString());
            var complement = region.Complement();

            thresholdImage.OverpaintRegion(region, (double)ForegroundGray, "fill");
            thresholdImage.OverpaintRegion(complement, (double)BackgroundGray, "fill");
//            thresholdImage.WriteImage("tiff", 0, @"B:\Test_OverpaintRegion");

            region.Dispose();
            complement.Dispose();
            preprocessImage.Dispose();

            return(thresholdImage);
        }
        public HRegion Extract(HImage image)
        {
            HObject regionHObject;

            HDevelopExport.Singletone.GetRegionOfAntennaAroundOfS1423A(image, out regionHObject,
                                                                       LightDark.ToHalconString(), WidthMin, WidthMax, HeightMin, HeightMax, DilationWidth, DilationHeight);
            return(new HRegion(regionHObject));
        }
        public HRegion Extract(HImage image)
        {
            HObject regionHObject;

            HDevelopExport.Singletone.GetRegionOfLightOrDarkRect2(image, out regionHObject,
                                                                  LightDark.ToHalconString(), WidthMin, WidthMax, HeightMin, HeightMax, Rect2Len1, Rect2Len2);
            return(new HRegion(regionHObject));
        }
示例#8
0
        public HRegion Extract(HImage image)
        {
            HObject regionHObject;

            HDevelopExport.Singletone.GetRegionOfAntennaOfS1423(image, out regionHObject,
                                                                GrayOpeningMaskHeight, GrayOpeningMaskWidth,
                                                                GrayDilationMaskHeight, GrayDilationMaskWidth,
                                                                LightDark.ToHalconString(),
                                                                AreaMin, AreaMax, OpeningWidth, OpeningHeight, ClosingWidth, ClosingHeight);
            return(new HRegion(regionHObject));
        }
示例#9
0
        public HRegion Extract(HImage image)
        {
            HImage preprocessImage;

            if (PreprocessFilter != null)
            {
                preprocessImage = PreprocessFilter.Process(image);
            }
            else
            {
                preprocessImage = image;
            }

            HImage thresholdImage;

            if (SeparateFilter)
            {
                var swThresholdImageFilter = new NotifyStopwatch("DynThresholdRegionExtractor.ThresholdImageFilter");
                thresholdImage = ThresholdImageFilter.Process(image);
                swThresholdImageFilter.Dispose();
            }
            else
            {
                var swThresholdImageFilter = new NotifyStopwatch("DynThresholdRegionExtractor.ThresholdImageFilter");
                thresholdImage = ThresholdImageFilter.Process(preprocessImage);
                swThresholdImageFilter.Dispose();
            }

            var     swDynThreshold = new NotifyStopwatch("DynThresholdRegionExtractor.DynThreshold");
            HRegion region         = preprocessImage.DynThreshold(
                thresholdImage,
                Offset,
                LightDark.ToHalconString());

            swDynThreshold.Dispose();

            preprocessImage.Dispose();
            thresholdImage.Dispose();

            return(region);
        }
        public HRegion Extract(HImage image)
        {
            if (!(LightDark == LightDark.Light || LightDark == LightDark.Dark))
            {
                throw new InvalidOperationException("BinaryThresholdRegionExtractor.LightDark must be Light or Dark. Now is " + LightDark);
            }

            HObject foundRegionObject;

            HDevelopExport.Singletone.GetRegionOfRoiByBinaryThreshold(image,
                                                                      out foundRegionObject,
                                                                      LightDark.ToHalconString(),
                                                                      AreaMin,
                                                                      AreaMax,
                                                                      MoveRow,
                                                                      MoveColumn);

            var hRegion = new HRegion(foundRegionObject);

            return(hRegion);
        }