private static void computeDerivatives(Image image, Mask gaussian, double[][] lx2, double[][] ly2, double[][] lxy) {
		int w = image.getWidth(), h = image.getHeight();
		Image gx = MaskUtils.applyMask(image,
				MaskFactory.buildSobelMask(Direction.HORIZONTAL));
		Image gy = MaskUtils.applyMask(image,
				MaskFactory.buildSobelMask(Direction.VERTICAL));
		for (int x = 0; x < w; x++) {
			for (int y = 0; y < h; y++) {
				for (int dx = -gaussian.getHeight() / 2; dx <= gaussian.getWidth()/2 ; dx++) {
					for (int dy = -gaussian.getHeight() / 2; dy <= gaussian.getHeight()/2; dy++) {
						int xk = x + dx;
						int yk = y + dy;
						if (xk >= 0 && xk < w && yk >= 0 && yk < h) {
							double f = gaussian.getValue(dx, dy);
							double gxp = gx.getPixel(xk, yk, RED), gyp = gy
									.getPixel(xk, yk, RED);
							lx2[x][y] += f * gxp * gxp;
							ly2[x][y] += f * gyp * gyp;
							lxy[x][y] += f * gxp * gyp;
						}
					}
				}
			}
		}
	}