public static Mask buildGaussianMask(int size, double sigma) {
		if (size % 2 == 0) {
			size++;
		}
		Mask mask = new Mask(size);
		double total = 0;
		for (int i = -mask.getWidth() / 2; i <= mask.getWidth() / 2; i++) {
			for (int j = -mask.getHeight() / 2; j <= mask.getHeight() / 2; j++) {
				double gaussian = Math.exp(-(i * i + j * j) / (sigma * sigma))
						/ (2 * Math.PI * sigma * sigma);
				mask.setPixel(i, j, gaussian);
				total += gaussian;
			}
		}
		for (int i = -mask.getWidth() / 2; i <= mask.getWidth() / 2; i++) {
			for (int j = -mask.getHeight() / 2; j <= mask.getHeight() / 2; j++) {
				mask.setPixel(i, j, mask.getValue(i, j) / total);
			}
		}

		return mask;
	}