I need to draw two types of histogram, namely monodimensional and tridimensional. I\'m a newbie to EMGU and all of the samples I found on the net are in C++ or C. Are there
Tridimensional histogram
Image[] inp = new Image("fileName.jpg");
int nBins = 256;
DenseHistogram hist = new DenseHistogram(new int[] { nBins, nBins, nBins }, new RangeF[] { new RangeF(0, 255), new RangeF(0, 255), new RangeF(0, 255) });
hist.Calculate(inp.Split(), false, null);
// To get value of single bin
int b = 255; int g = 0; int r = 0; //blue
int count = Convert.ToInt32(hist.MatND.ManagedArray.GetValue(b, g, r)); //count = no of pixels in color Bgr(b,g,r)
//To get all values in a single array
List> histVal = new List>(nBins * nBins * nBins);
for (int i = 0; i < nBins; i++)
for (int j = 0; j < nBins; j++)
for (int k = 0; k < nBins; k++)
histVal.Add(new Tuple(new Bgr(i, j, k), Convert.ToInt32(hist.MatND.ManagedArray.GetValue(i, j, k))));
Monodimensional histogram
int nBins = 256;
float[] valHist = new float[nBins];
Image[] inp = new Image("fileName.jpg");
DenseHistogram hist = new DenseHistogram(nBins, new RangeF(0, 255));
hist.Calculate(new Image[] { inp }, true, null);
hist.MatND.ManagedArray.CopyTo(valHist,0);