public static int[][] getHistogram(int[][] imagematrix) {
		ArrayList<int[]> histogram = new ArrayList<int[]>(); //dynamic array size
		boolean isNewColor;
		for(int[] imColumn: imagematrix) {
			for(int imCell: imColumn) {
				isNewColor = true;
				for(int[] hgRow : histogram) {
					if(hgRow[0]==imCell) {
						hgRow[1]++;
						isNewColor = false;
					}
				}
				if(isNewColor) {
					histogram.add(new int[]{imCell,1});
				}
			}
		}
		return histogram.toArray(new int[histogram.size()][2]);
	}