Java examples for 2D Graphics:Image
Function to up sample the image
public class Main{ /**//from ww w .j a v a 2s.c o m * * Function to upsample the image * **/ public static void zoom_in(final float[] I, // input image float[] Iout, // output image int nx, // width of the original image int ny, // height of the original image int nxx, // width of the zoomed image int nyy // height of the zoomed image ) { // compute the zoom factor final float factorx = ((float) nxx / nx); final float factory = ((float) nyy / ny); // re-sample the image using bicubic interpolation for (int i1 = 0; i1 < nyy; i1++) for (int j1 = 0; j1 < nxx; j1++) { float i2 = (float) i1 / factory; float j2 = (float) j1 / factorx; float g = IpolBicubicInterpolation .bicubic_interpolation_at(I, j2, i2, nx, ny, false); try { Iout[i1 * nxx + j1] = g; } catch (RuntimeException e) { System.out.println(); } } } }