How to create a histogram

后端 未结 2 571
死守一世寂寞
死守一世寂寞 2020-12-19 08:35

I want to create a histogram within a C# program that uses EMGU. EMGU contains a class called MCvHistogram in it, but I don\'t know how to use it.

相关标签:
2条回答
  • 2020-12-19 09:08

    You should use DenseHistogram class if you want to use EmguCV. I'll show you basic usage:

      // Create a grayscale image
      Image<Gray, Byte> img = new Image<Gray, byte>(400, 400);
      // Fill image with random values
      img.SetRandUniform(new MCvScalar(), new MCvScalar(255));
      // Create and initialize histogram
      DenseHistogram hist = new DenseHistogram(256, new RangeF(0.0f, 255.0f));
      // Histogram Computing
      hist.Calculate<Byte>(new Image<Gray, byte>[] { img }, true, null);
    

    There are a lot of other common methods inside DenseHistogram class such as Back Projection

    0 讨论(0)
  • 2020-12-19 09:16

    You can use this code snippet:

    histogramBox.GenerateHistograms(image,bin);               
    histogramBox2.Refresh();
    

    It will create a histogram of your picture automatically.

    0 讨论(0)
提交回复
热议问题