【发布时间】:2011-06-21 19:27:42
【问题描述】:
我想在使用 EMGU 的 C# 程序中创建直方图。 EMGU里面有一个叫MCvHistogram的类,但是我不知道怎么用。
【问题讨论】:
-
这篇文章展示了如何在RGB中创建直方图stackoverflow.com/questions/8204822/…
我想在使用 EMGU 的 C# 程序中创建直方图。 EMGU里面有一个叫MCvHistogram的类,但是我不知道怎么用。
【问题讨论】:
如果你想使用 EmguCV,你应该使用 DenseHistogram 类。 我将向您展示基本用法:
// 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);
DenseHistogram 类中还有很多其他常用的方法,比如 Back Projection
【讨论】:
你可以使用这个代码sn-p:
histogramBox.GenerateHistograms(image,bin);
histogramBox2.Refresh();
它会自动为您的图片创建直方图。
【讨论】: