public void doMedianBlur() {

		for (int i = 0; i < pixels.length; i++) {
			for (int j = 0; j < pixels[i].length; j++) {

				List<Integer> values = new ArrayList<>();

				for (int k = -1; k <= 1; k++) {
					for (int l = -1; l <= 1; l++) {

						if (i + k < 0 || i + k >= pixels.length)
							values.add(pixels[i][j]);
						else if (j + l < 0 || j + l >= pixels[i].length)
							values.add(pixels[i][j]);
						else
							values.add(pixels[i + k][j + l]);
					}
				}

				Collections.sort(values);
				temp[i][j] = values.get(values.size() / 2);
			}
		}

		for (int i = 0; i < pixels.length; i++) {
			for (int j = 0; j < pixels[i].length; j++) {
				pixels[i][j] = temp[i][j];
			}
		}
	}