Exemplo n.º 1
0
        private void UpdateImage3()
        {
            if (booleanComboBox.EditValue == null)
            {
                return;
            }
            var bmode = (CAPI.BooleanMode)Enum.Parse(typeof(CAPI.BooleanMode), (String)booleanComboBox.EditValue);

            pictureEdit3.Image = _CVMan.ModPicBoolean(pictureEdit1.Image, pictureEdit2.Image, bmode, true);
            sizeLabel3.Text    = getImageText(pictureEdit3.Image);
        }
Exemplo n.º 2
0
        private Image TrimImage1(Image img1, bool maskOnly)
        {
            Image img = _CVMan.ModPicMode(img1, CAPI.ImageMode.Grayscale, CAPI.ColorMap.COLORMAP_AUTUMN);

            img = _CVMan.ModPicMode(img1, CAPI.ImageMode.Histogram, CAPI.ColorMap.COLORMAP_AUTUMN);
            img = _CVMan.ModPicMorph(img, CAPI.MorphMode.THRESHOLD, CAPI.MorphStructureEnum.MORPH_CROSS, 0, 200);
            img = _CVMan.ModPicBlur(img, CAPI.BlurMode.Median, 27);
            img = _CVMan.ModPicMorph(img, CAPI.MorphMode.DILATE, CAPI.MorphStructureEnum.MORPH_ELLIPSE, 17, 0);
            img = _CVMan.ModPicMorph(img, CAPI.MorphMode.ERODE, CAPI.MorphStructureEnum.MORPH_ELLIPSE, 7, 0);
            Image mask = _CVMan.ModPicBoolean(img, img, CAPI.BooleanMode.CONTOURS, false);

            if (mask == null)
            {
                return(null);
            }
            mask = _CVMan.ModPicBlur(mask, CAPI.BlurMode.Median, 27);
            Image result = _CVMan.ModPicBoolean(img1, mask, CAPI.BooleanMode.AND, false);

            return(maskOnly ? mask : result);
        }