public static Image applyMedianMask(Image original, int maskWidth,
			int maskHeight) {
		if (original == null) {
			return null;
		}
		Image image = original.shallowClone();
		for (int x = 0; x < image.getWidth(); x++) {
			for (int y = 0; y < image.getHeight(); y++) {
				image.setPixel(
						x,
						y,
						RED,
						getMedianPixel(original, RED, x, y, maskWidth,
								maskHeight));
				image.setPixel(
						x,
						y,
						GREEN,
						getMedianPixel(original, GREEN, x, y, maskWidth,
								maskHeight));
				image.setPixel(
						x,
						y,
						BLUE,
						getMedianPixel(original, BLUE, x, y, maskWidth,
								maskHeight));
			}
		}
		return image;
	}