我有以下代码示例:
//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);
最佳答案
HistogramBox控件可让您自动显示图像直方图。
按照emgu instructions获取可在窗体上拖放的控件的完整列表。然后,这只是几个方法调用。
histogramBox.GenerateHistograms(img,bin); //bin = 256 in your example
histogramBox2.Refresh();
https://stackoverflow.com/questions/12734824/