private BufferedImage getImage() {
		if(colorMap != null) {
			color = new Color[K];
			float[] numbers = new float[K];
			float[] R = new float[K];
			float[] G = new float[K];
			float[] B = new float[K];
			for(int i = 0; i < K; ++i) {
				numbers[i] = 0;
				R[i] = 0;
				G[i] = 0;
				B[i] = 0;
			}
			for(int i = 0; i < height; ++i)
				for(int j = 0; j < width; ++j) {
					int k = groups[i][j];
					numbers[k] = numbers[k] + 1;
					R[k] = R[k] + colorMap[i][j].getRed();
					G[k] = G[k] + colorMap[i][j].getGreen();
					B[k] = B[k] + colorMap[i][j].getBlue();
				}
			for(int i = 0; i < K; ++i)
				if(numbers[i] > 0) {
					int r = (int) (R[i] / numbers[i]);
					int g = (int) (G[i] / numbers[i]);
					color[i] = new Color(r, g, (int) (B[i] / numbers[i]));
				}
		}
		BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
		for(int i = 0; i < height; ++i) {
			for(int j = 0; j < width; ++j) {
				image.setRGB(j, i, color[groups[i][j]].getRGB());
			}
		}
		return image;
	}