0

我有以下代码示例:

    //creating histogram using emgu cv c#
    //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);

计算直方图后,我想在图表控件中显示结果。

有人可以提供实现这一点的想法/示例代码吗?谢谢。

4

1 回答 1

2

HistogramBox 控件让您自动显示图像直方图。

按照emgu 说明获取可以拖放到表单上的整个控件列表。然后它只是几个方法调用。

histogramBox.GenerateHistograms(img,bin); //bin = 256 in your example

histogramBox2.Refresh();
于 2012-10-05T07:22:56.500 回答