public Bitmap ToAdaptiveSmoothing(Bitmap Im) { AForge.Imaging.Filters.AdaptiveSmoothing Img = new AdaptiveSmoothing(); Bitmap bmImage = AForge.Imaging.Image.Clone(new Bitmap(Im), PixelFormat.Format24bppRgb); return(Img.Apply(bmImage)); }
public void AdaptiveClickHandler(object sender, EventArgs e) { if (image != null) { Bitmap img = new Bitmap(path); AdaptiveSmoothing filter = new AdaptiveSmoothing(); img = filter.Apply(img); // ImageEView if (mov != null) { this.WorkItem.Workspaces[WorkspaceNames.TabWorkspace].Close(mov); } mov = this.WorkItem.SmartParts.AddNew <ImageEView>(); mov.panAndZoomPictureBox1.Image = img; SmartPartInfo spi = new SmartPartInfo("Adaptive", "MyOwnDescription"); this.WorkItem.Workspaces[WorkspaceNames.TabWorkspace].Show(mov, spi); } }
private void SharpenSmooth(object sender, DoWorkEventArgs e) { Bitmap raw_image = null; if (inRb.Checked) { raw_image = Accord.Imaging.Filters.Grayscale.CommonAlgorithms.BT709.Apply((Bitmap)input_PB.Image.Clone()); } else if (outRb.Checked) { raw_image = (Bitmap)outputImageBox.Image.Clone(); } if (sharpenRB.Checked) { var sharpen = new Sharpen(); sharpen.Threshold = (Byte)threshVal.Value; UnmanagedImage r_img = UnmanagedImage.FromManagedImage(raw_image); outputImageBox.Image.Dispose(); r_img = sharpen.Apply(r_img); outputImageBox.Image = r_img.ToManagedImage(); } else if (smoothingRB.Checked) { var Smoothing = new AdaptiveSmoothing(); Smoothing.Factor = (double)(threshVal.Value); UnmanagedImage r_img = UnmanagedImage.FromManagedImage(raw_image); outputImageBox.Image.Dispose(); r_img = Smoothing.Apply(r_img); outputImageBox.Image = r_img.ToManagedImage(); } else if (radioButton1.Checked) { var Invert = new Invert(); UnmanagedImage r_img = UnmanagedImage.FromManagedImage(raw_image); outputImageBox.Image.Dispose(); r_img = Invert.Apply(r_img); outputImageBox.Image = r_img.ToManagedImage(); } }