/*Scales the given image by {scaleFactor} in each direction. Uses a bicubic * filter ??? only in expansion, or also in reduction? ???*/ public static BufferedImage scale_image (BufferedImage image, double scaleValue) { AffineTransform tx = new AffineTransform(); tx.scale(scaleValue, scaleValue); AffineTransformOp op = new AffineTransformOp(tx, AffineTransformOp.TYPE_BICUBIC); return op.filter(image, op.createCompatibleDestImage(image, null)); } /*Computing weights {x_weight, y_weight} to normalize the resized image.*/ int x_weight_rad = -1, y_weight_rad = -1; double x_weight[] = null, y_weight[] = null; if (image_normalization_weight.compareTo("Gauss") == 0) { /*Gaussian weights*/ x_weight_rad = choose_gaussian_weight_size (image_normalization_weight_radius * rheight); y_weight_rad = choose_gaussian_weight_size (image_normalization_weight_radius * rheight); x_weight = new double [2 * x_weight_rad + 1]; y_weight = new double [2 * y_weight_rad + 1]; compute_gaussian_weights (x_weight, x_weight_rad); compute_gaussian_weights (y_weight, y_weight_rad); } else if (image_normalization_weight.compareTo("Binomial") == 0) { /*Binomial weights*/ x_weight_rad = y_weight_rad = (int) image_normalization_weight_radius; x_weight = new double [2 * x_weight_rad + 1]; y_weight = new double [2 * y_weight_rad + 1]; compute_binomial_weights (x_weight, x_weight_rad); compute_binomial_weights (y_weight, y_weight_rad); } else { System.err.printf("error: choose a valid weight image normalization\n"); System.exit(1); }