Beispiel #1
0
 public new void Dispose()
 {
     IsLoaded = false;
     HistogramPanel.Dispose();
     foreach (var ctrlImageBox in ImageBoxs)
     {
         ctrlImageBox.ImageBox.Dispose();
         ctrlImageBox.Dispose();
     }
     base.Dispose();
 }
Beispiel #2
0
        /// <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();
        }
Beispiel #3
0
 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);
     }
 }
Beispiel #4
0
        /// <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;
        }