/// <summary> /// Filter Implementation /// </summary> protected override IImageAdapter ProcessFilter(IImageAdapter source) { if (source == null) { throw new ArgumentNullException("source", "The value passed in cannot be null"); } if (Radius == 0) { // return((IImageAdapter)source.Clone()); } int width = source.Width; int height = source.Height; ImageAdapter retVal = null; if (Expand) { retVal = new ImageAdapter((int)(width + (Radius + 0.5) * 2), (int)(height + (Radius + 0.5) * 2)); } else { retVal = new ImageAdapter(width, height); } InitializeKernel(); GaussianFilter gaussianFilter = new GaussianFilter(); gaussianFilter.Kernel = _kernel; return(gaussianFilter.Process(source)); }
/// <summary> /// filter implementation /// </summary> protected override IImageAdapter ProcessFilter(IImageAdapter source) { // Check Params if (source == null) { throw new ArgumentNullException("source", "Argument cannot be null"); } if (Width == 0) { Width = source.Width; } if (Height == 0) { Height = source.Height; } if ((Height < source.Height || Width < source.Width) && (LowPassFilterOnSubSampling == true)) { GaussianFilter gf = new GaussianFilter(); int ratio = (int)Math.Max(source.Width / Width, source.Height / Height); if (ratio < 1) { ratio = 2; } gf.Length = ratio; source = gf.Process(source); Console.WriteLine("<<Proceed with GF subsampling>>"); } /* * // * * * */ Image2DTransforms transform = new Image2DTransforms(source); transform.Transform(Matrix); return(transform.ImageTransformed); }