Ejemplo n.º 1
0
 private System.Drawing.Bitmap ApplyFilter(System.Drawing.Bitmap sourceImage, AForge.Imaging.Filters.IFilter filter)
 {
     // apply filter
     //System.Drawing.Bitmap tempImage = AForge.Imaging.Image.Clone(sourceImage, PixelFormat.Format24bppRgb);
     System.Drawing.Bitmap filteredImage = filter.Apply(sourceImage);
     // display filtered image
     return(filteredImage);
 }
        // Update filter
        private void UpdateFilter( )
        {
            if (se != null)
            {
                if (filterType == FilterTypes.Simple)
                {
                    switch (this.operatorCombo.SelectedIndex)
                    {
                    case 0:
                        filter = new Erosion(se);
                        break;

                    case 1:
                        filter = new Dilatation(se);
                        break;

                    case 2:
                        filter = new Opening(se);
                        break;

                    case 3:
                        filter = new Closing(se);
                        break;

                    case 4:
                        filter = new TopHat(se);
                        break;

                    case 5:
                        filter = new BottomHat(se);
                        break;
                    }
                }
                else
                {
                    switch (this.operatorCombo.SelectedIndex)
                    {
                    case 0:
                        filter = new HitAndMiss(se, HitAndMiss.Modes.HitAndMiss);
                        break;

                    case 1:
                        filter = new HitAndMiss(se, HitAndMiss.Modes.Thickening);
                        break;

                    case 2:
                        filter = new HitAndMiss(se, HitAndMiss.Modes.Thinning);
                        break;
                    }
                }
            }
            filterPreview.Filter = filter;
        }
        // Update filter
        private void UpdateFilter( )
        {
            if (kernel != null)
            {
                switch (this.operatorCombo.SelectedIndex)
                {
                case 0:
                    filter = new Convolution(kernel);
                    break;

                case 1:
                    filter = new Correlation(kernel);
                    break;
                }
            }
            filterPreview.Filter = filter;
        }
Ejemplo n.º 4
0
 // Update filter
 private void UpdateFilter( )
 {
     if ( kernel != null )
     {
         switch ( this.operatorCombo.SelectedIndex )
         {
             case 0:
                 filter = new Convolution( kernel );
                 break;
             case 1:
                 filter = new Correlation( kernel );
                 break;
         }
     }
     filterPreview.Filter = filter;
 }
Ejemplo n.º 5
0
 // Update filter
 private void UpdateFilter()
 {
     if (se != null)
     {
         if (filterType == FilterTypes.Simple)
         {
             switch (this.operatorCombo.SelectedIndex)
             {
                 case 0:
                     filter = new Erosion(se);
                     break;
                 case 1:
                     filter = new Dilatation(se);
                     break;
                 case 2:
                     filter = new Opening(se);
                     break;
                 case 3:
                     filter = new Closing(se);
                     break;
             }
         }
         else
         {
             switch (this.operatorCombo.SelectedIndex)
             {
                 case 0:
                     filter = new HitAndMiss(se, HitAndMissMode.HitAndMiss);
                     break;
                 case 1:
                     filter = new HitAndMiss(se, HitAndMissMode.Thickening);
                     break;
                 case 2:
                     filter = new HitAndMiss(se, HitAndMissMode.Thinning);
                     break;
             }
         }
     }
     filterPreview.Filter = filter;
 }
Ejemplo n.º 6
0
        private async Task <Bitmap> filterBitmap(AForge.Imaging.Filters.IFilter filter)
        {
            Bitmap newImageBitmap = filter.Apply(currentImage);

            return(await Task.Run(() => filter.Apply(currentImage)));
        }