private void processImageOneIteration4(FImage image) { final float[][] tmp = image.clone().pixels; for (int y = 0; y < image.height; y++) { final int ym = Math.max(y - 1, 0); final int yp = Math.min(y + 1, image.height - 1); for (int x = 0; x < image.width; x++) { final int xm = Math.max(x - 1, 0); final int xp = Math.min(x + 1, image.width - 1); final float dN = tmp[ym][x] - tmp[y][x]; final float dS = tmp[yp][x] - tmp[y][x]; final float dE = tmp[y][xm] - tmp[y][x]; final float dW = tmp[y][xp] - tmp[y][x]; final float cN = function.apply(Math.abs(dN), x, y); final float cS = function.apply(Math.abs(dS), x, y); final float cE = function.apply(Math.abs(dE), x, y); final float cW = function.apply(Math.abs(dW), x, y); image.pixels[y][x] += lambda * (cN * dN + cS * dS + cE * dE + cW * dW); } } }
private void processImageOneIteration8(FImage image) { final float[][] tmp = image.clone().pixels; final float wt = 0.5f; for (int y = 0; y < image.height; y++) { final int ym = Math.max(y - 1, 0); final int yp = Math.min(y + 1, image.height - 1); for (int x = 0; x < image.width; x++) { final int xm = Math.max(x - 1, 0); final int xp = Math.min(x + 1, image.width - 1); final float dN = tmp[ym][x] - tmp[y][x]; final float dS = tmp[yp][x] - tmp[y][x]; final float dE = tmp[y][xm] - tmp[y][x]; final float dW = tmp[y][xp] - tmp[y][x]; final float dNE = tmp[ym][xm] - tmp[y][x]; final float dSE = tmp[yp][xm] - tmp[y][x]; final float dSW = tmp[ym][xp] - tmp[y][x]; final float dNW = tmp[ym][xp] - tmp[y][x]; final float cN = function.apply(Math.abs(dN), x, y); final float cS = function.apply(Math.abs(dS), x, y); final float cE = function.apply(Math.abs(dE), x, y); final float cW = function.apply(Math.abs(dW), x, y); final float cNE = function.apply(Math.abs(dNE), x, y); final float cSE = function.apply(Math.abs(dSE), x, y); final float cSW = function.apply(Math.abs(dSW), x, y); final float cNW = function.apply(Math.abs(dNW), x, y); image.pixels[y][x] += lambda * (cN * dN + cS * dS + cE * dE + cW * dW + wt * (cNE * dNE + cSE * dSE + cSW * dSW + cNW * dNW)); } } }
private void processImageOneIteration8(FImage image) { final float[][] tmp = image.clone().pixels; final float wt = 0.5f; for (int y = 0; y < image.height; y++) { final int ym = Math.max(y - 1, 0); final int yp = Math.min(y + 1, image.height - 1); for (int x = 0; x < image.width; x++) { final int xm = Math.max(x - 1, 0); final int xp = Math.min(x + 1, image.width - 1); final float dN = tmp[ym][x] - tmp[y][x]; final float dS = tmp[yp][x] - tmp[y][x]; final float dE = tmp[y][xm] - tmp[y][x]; final float dW = tmp[y][xp] - tmp[y][x]; final float dNE = tmp[ym][xm] - tmp[y][x]; final float dSE = tmp[yp][xm] - tmp[y][x]; final float dSW = tmp[ym][xp] - tmp[y][x]; final float dNW = tmp[ym][xp] - tmp[y][x]; final float cN = function.apply(Math.abs(dN), x, y); final float cS = function.apply(Math.abs(dS), x, y); final float cE = function.apply(Math.abs(dE), x, y); final float cW = function.apply(Math.abs(dW), x, y); final float cNE = function.apply(Math.abs(dNE), x, y); final float cSE = function.apply(Math.abs(dSE), x, y); final float cSW = function.apply(Math.abs(dSW), x, y); final float cNW = function.apply(Math.abs(dNW), x, y); image.pixels[y][x] += lambda * (cN * dN + cS * dS + cE * dE + cW * dW + wt * (cNE * dNE + cSE * dSE + cSW * dSW + cNW * dNW)); } } }
private void processImageOneIteration4(FImage image) { final float[][] tmp = image.clone().pixels; for (int y = 0; y < image.height; y++) { final int ym = Math.max(y - 1, 0); final int yp = Math.min(y + 1, image.height - 1); for (int x = 0; x < image.width; x++) { final int xm = Math.max(x - 1, 0); final int xp = Math.min(x + 1, image.width - 1); final float dN = tmp[ym][x] - tmp[y][x]; final float dS = tmp[yp][x] - tmp[y][x]; final float dE = tmp[y][xm] - tmp[y][x]; final float dW = tmp[y][xp] - tmp[y][x]; final float cN = function.apply(Math.abs(dN), x, y); final float cS = function.apply(Math.abs(dS), x, y); final float cE = function.apply(Math.abs(dE), x, y); final float cW = function.apply(Math.abs(dW), x, y); image.pixels[y][x] += lambda * (cN * dN + cS * dS + cE * dE + cW * dW); } } }