public ColorHistogram(int[][] image) { width = image.Length; height = image[0].Length; byte[][] r = new byte[width][]; byte[][] g = new byte[width][]; byte[][] b = new byte[width][]; for(int i = 0; i < width; i++) { byte[] rLine = new byte[height]; byte[] gLine = new byte[height]; byte[] bLine = new byte[height]; int[] line = image[i]; for(int j = 0; j < height; j++) { Color c = Color.FromArgb(line[j]); rLine[j] = (byte)c.R; gLine[j] = (byte)c.G; bLine[j] = (byte)c.B; } r[i] = rLine; g[i] = gLine; b[i] = bLine; } red = new Histogram(r); green = new Histogram(g); blue = new Histogram(b); }
public ColorHistogram(int width, int height) { this.width = width; this.height = height; red = new Histogram(width, height); blue = new Histogram(width, height); green = new Histogram(width, height); }
private static double Compute(int largestValue, int j, Histogram z) { double total = 0.0; double[] pk = z.PK; for(int i = 0; i < j; i++) total += pk[i]; return total * largestValue; }
private static double Compute(int j, Histogram z) { return Compute(255, j, z); }