You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

73 lines
2.1 KiB

  1. //----------------------------------------------------------------------------
  2. // Copyright (C) 2004-2019 by EMGU Corporation. All rights reserved.
  3. //----------------------------------------------------------------------------
  4. using System;
  5. using System.Drawing;
  6. using System.Windows.Forms;
  7. namespace Emgu.CV.UI
  8. {
  9. /// <summary>
  10. /// A view for histogram
  11. /// </summary>
  12. public partial class HistogramViewer : Form
  13. {
  14. /// <summary>
  15. /// A histogram viewer
  16. /// </summary>
  17. public HistogramViewer()
  18. {
  19. InitializeComponent();
  20. }
  21. /// <summary>
  22. /// Display the histograms of the specific image
  23. /// </summary>
  24. /// <param name="image">The image to retrieve histogram from</param>
  25. public static void Show(IInputArray image)
  26. {
  27. Show(image, 256);
  28. }
  29. /// <summary>
  30. /// Display the histograms of the specific image
  31. /// </summary>
  32. /// <param name="image">The image to retrieve histogram from</param>
  33. /// <param name="numberOfBins">The number of bins in the histogram</param>
  34. public static void Show(IInputArray image, int numberOfBins)
  35. {
  36. HistogramViewer viewer = new HistogramViewer();
  37. viewer.HistogramCtrl.GenerateHistograms(image, numberOfBins);
  38. viewer.HistogramCtrl.Refresh();
  39. viewer.ShowDialog();
  40. }
  41. /*
  42. /// <summary>
  43. /// Display the specific histogram
  44. /// </summary>
  45. /// <param name="hist">The 1 dimension histogram to be displayed</param>
  46. /// <param name="title">The name of the histogram</param>
  47. public static void Show(DenseHistogram hist, string title)
  48. {
  49. HistogramViewer viewer = new HistogramViewer();
  50. if (hist.Dimension == 1)
  51. viewer.HistogramCtrl.AddHistogram(title, Color.Black, hist);
  52. viewer.HistogramCtrl.Refresh();
  53. viewer.Show();
  54. }*/
  55. /// <summary>
  56. /// Get the histogram control of this viewer
  57. /// </summary>
  58. public HistogramBox HistogramCtrl
  59. {
  60. get
  61. {
  62. return histogramCtrl1;
  63. }
  64. }
  65. }
  66. }