private static Bitmap Denoiseimage(Bitmap image) { // create filter ConservativeSmoothing filter = new ConservativeSmoothing(); // apply the filter filter.ApplyInPlace(image); return(image); }
/* * 3- noise elimination to delete isolated pixel and improve the next step. * (median filter technique seems to be the best way); * */ public void RemoveNoise(ref Bitmap image) { /* * FiltersSequence filterSquence = new FiltersSequence(Grayscale.CommonAlgorithms.BT709, * new Threshold(100), new FillHoles()); * image = filterSquence.Apply(image); */ // create filter ConservativeSmoothing filterSmoothing = new ConservativeSmoothing(); // apply the filter filterSmoothing.ApplyInPlace(image); }
public static Bitmap GetOrcImage(Bitmap bmp) { try { // from AForge's sample code if (bmp.PixelFormat == PixelFormat.Format16bppGrayScale || Bitmap.GetPixelFormatSize(bmp.PixelFormat) > 32) { throw new NotSupportedException("Unsupported image format"); } var img = AForge.Imaging.Image.Clone(bmp, PixelFormat.Format24bppRgb); img = new Grayscale(0.2125, 0.7154, 0.0721).Apply(img); img = new Threshold(50).Apply(img); ConservativeSmoothing filter = new ConservativeSmoothing(); // apply the filter filter.ApplyInPlace(img); //BilateralSmoothing filter = new BilateralSmoothing(); //filter.KernelSize = 3; //filter.SpatialFactor = 10; //filter.ColorFactor = 60; //filter.ColorPower = 0.5; //// apply the filter //img = filter.Apply(img); //img = new BlobsFiltering(1, 1, img.Width, img.Height).Apply(img); //// create filter //Median filter = new Median(); //// apply the filter //filter.ApplyInPlace(image) return(img); } finally { bmp.Dispose(); } }