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 static string ToHalconString(this LightDark lightDark)
        {
            switch (lightDark)
            {
            case LightDark.Dark:
                return("dark");

            case LightDark.Light:
                return("light");

            case LightDark.Equal:
                return("equal");

            case LightDark.NotEqual:
                return("not_equal");

            default:
                throw new InvalidOperationException("LightDark cannot convert to string");
            }
        }
示例#10
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);
        }
示例#11
0
    // Use this for initialization
    void Start()
    {
        Cursor.visible = false;
        playerScale    = transform.localScale;
        // sets our default values for isLight and isRight;
        isLight = true;
        isRight = true;
        // get our rigid body component
        rb = GetComponent <Rigidbody2D>();
        //Find the camera
        camera = FindObjectOfType <LightDark>();
        // get our audio source
        AudioSource = GetComponent <AudioSource>();

        direction = 1;
        //get our sprite renderer
        playerSprite = gameObject.GetComponent <SpriteRenderer>();


        if (FindSkin = GameObject.Find("WhatSkin"))
        {
            Skin       = FindSkin.GetComponent <WhatSkin>();
            ChosenSkin = Skin.getSkin();
        }
        sprites = Resources.LoadAll <Sprite>(spriteNames);

        switch (ChosenSkin)
        {
        case 1:
            playerSprite.sprite = sprites[2];
            break;

        case 2:
            playerSprite.sprite = sprites[1];
            break;

        case 3:
            playerSprite.sprite = sprites[0];
            break;
        }
    }
        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);
        }