Beispiel #1
1
        // ==========================================================================================================
        // Functions compatible with lists:
        // ==========================================================================================================
        // Note, that each function needs to keep the image in RGB, otherwise drawing fill fail
        // =========================================================
        private void NoiseReduction_Funct(ref Bitmap frame, int par_int, double par_d, int par_R, int par_G, int par_B)
        {
            frame = Grayscale.CommonAlgorithms.RMY.Apply(frame);	// Make gray
            switch (par_int)
            {
                case 1:
                    BilateralSmoothing Bil_filter = new BilateralSmoothing();
                    Bil_filter.KernelSize =7;
                    Bil_filter.SpatialFactor = 10;
                    Bil_filter.ColorFactor = 30;
                    Bil_filter.ColorPower = 0.5;
                    Bil_filter.ApplyInPlace(frame);
                    break;

                case 2:
                    Median M_filter = new Median();
                    M_filter.ApplyInPlace(frame);
                    break;

                case 3:
                    Mean Meanfilter = new Mean();
                    // apply the MirrFilter
                    Meanfilter.ApplyInPlace(frame);
                    break;

                default:
                    Median Median_filter = new Median();
                    Median_filter.ApplyInPlace(frame);
                    break;
            }
            GrayscaleToRGB RGBfilter = new GrayscaleToRGB();	// back to color format
            frame = RGBfilter.Apply(frame);
        }
 private Bitmap smoothing(Bitmap image)
 {
     // create filter
     BilateralSmoothing filter = new BilateralSmoothing();
     filter.KernelSize = 7;
     filter.SpatialFactor = 10;
     filter.ColorFactor = 60;
     filter.ColorPower = 0.5;
     // apply the filter
     filter.ApplyInPlace(image);
     return image;
 }
        public static Bitmap Bilateral(Bitmap image, Rectangle region, int kernelSize, int spatialFactor, int colorFactor)
        {
            BilateralSmoothing filter = new BilateralSmoothing
            {
                KernelSize = kernelSize,
                SpatialFactor = spatialFactor,
                ColorFactor = colorFactor,
                EnableParallelProcessing = true
            };

            Bitmap bitmap = new Bitmap(image);
            filter.ApplyInPlace(bitmap, region);
            return bitmap;
        }
 public void EdgePreservingSmooth()
 {
     BilateralSmoothing filter = new BilateralSmoothing();
     filter.KernelSize = 7;
     filter.SpatialFactor = 10;
     filter.ColorFactor = 60;
     filter.ColorPower = 0.5;
     filter.ApplyInPlace(Image);
 }