protected int getPixelBilinear(int pixels[], double x, double y, int width, int height, int edgeMode) { int xi = (int) Math.floor(x); int yi = (int) Math.floor(y); double xd = x - xi; double yd = y - yi; int nw = getPixel(pixels, xi, yi, width, height, edgeMode); int ne = getPixel(pixels, xi + 1, yi, width, height, edgeMode); int sw = getPixel(pixels, xi, yi + 1, width, height, edgeMode); int se = getPixel(pixels, xi + 1, yi + 1, width, height, edgeMode); return bilinear(nw, ne, sw, se, xd, yd); }
public BufferedImage filter(BufferedImage src, BufferedImage dest) { if (dest == null) { dest = createCompatibleDestImage(src, null); } int width = src.getWidth(); int height = src.getHeight(); int[] inPixels = new int[width * height]; int[] outPixels = new int[width * height]; src.getRaster().getDataElements(0, 0, width, height, inPixels); filter(inPixels, outPixels, width, height); dest.getRaster().setDataElements(0, 0, width, height, outPixels); return dest; }
protected int limitByte(int v) { return limit(v, 0, 255); }
private int linear(int from, int to, double d) { int c = 0; for (int i = 0; i < 4; i++) { c += linear(from, to, i * 8, d); } return c; }
protected int getPixelBilinear(int pixels[], double x, double y, int width, int height, int edgeMode) { int xi = (int) Math.floor(x); int yi = (int) Math.floor(y); double xd = x - xi; double yd = y - yi; int nw = getPixel(pixels, xi, yi, width, height, edgeMode); int ne = getPixel(pixels, xi + 1, yi, width, height, edgeMode); int sw = getPixel(pixels, xi, yi + 1, width, height, edgeMode); int se = getPixel(pixels, xi + 1, yi + 1, width, height, edgeMode); return bilinear(nw, ne, sw, se, xd, yd); }
public BufferedImage filter(BufferedImage src, BufferedImage dest) { if (dest == null) { dest = createCompatibleDestImage(src, null); } int width = src.getWidth(); int height = src.getHeight(); int[] inPixels = new int[width * height]; int[] outPixels = new int[width * height]; src.getRaster().getDataElements(0, 0, width, height, inPixels); filter(inPixels, outPixels, width, height); dest.getRaster().setDataElements(0, 0, width, height, outPixels); return dest; }
private int linear(int from, int to, double d) { int c = 0; for (int i = 0; i < 4; i++) { c += linear(from, to, i * 8, d); } return c; }
protected int limitByte(int v) { return limit(v, 0, 255); }