public new void Dispose() { IsLoaded = false; HistogramPanel.Dispose(); foreach (var ctrlImageBox in ImageBoxs) { ctrlImageBox.ImageBox.Dispose(); ctrlImageBox.Dispose(); } base.Dispose(); }
/// <summary> /// Constructor /// </summary> /// <param name="filePath">Image filepath to open</param> public CtrlTabPage(string filePath) { InitializeComponent(); if (string.IsNullOrEmpty(filePath)) { throw new ArgumentNullException(nameof(filePath)); } FilePath = filePath; HistogramPanel.Dock = DockStyle.Fill; HistogramPanel.ZedGraphControl.IsShowPointValues = true; scDataHistogram.Panel2.Controls.Add(HistogramPanel); HistogramPanel.Refresh(); }
public void ShowHistogramForm() { try { BackUpImage(); HistogramPanel histogramPanel = new HistogramPanel(); histogramPanel.ImageForm = this; histogramPanel.Init(_imageBox.Image as Image <Bgr, Byte>); Form form = new Form(); form.Text = "直方图"; histogramPanel.Dock = DockStyle.Fill; form.Controls.Add(histogramPanel); form.Size = new System.Drawing.Size(500, 300); form.StartPosition = FormStartPosition.WindowsDefaultLocation; form.ShowDialog(); } catch (System.Exception ex) { logger.Error(ex.Message); } }
/// <summary> /// Start processing the image /// </summary> public void ProcessImage() { //Load the image from file and resize it for display ImgOriginal = new Image <Bgr, byte>(FilePath); //.Resize(400, 400, Emgu.CV.CvEnum.Inter.Linear, true); HistogramPanel.ClearHistogram(); HistogramPanel.GenerateHistograms(ImgOriginal, 256); HistogramPanel.Refresh(); //Convert the image to grayscale and filter out the noise ImgGray = ImgOriginal.Convert <Gray, Byte>().SmoothGaussian(5, 5, 0, 0) /*.PyrDown().PyrUp()*/; PopulateImageProperties(ImgOriginal); foreach (CtrlImageBox.FilterAlgorithm name in Enum.GetValues(typeof(CtrlImageBox.FilterAlgorithm))) { AddImageBox(name); } IsLoaded = true; }