package zutil.image; /** * Some util methods for image processing * @author Ziver * */ public class ImageUtil { /** * Returns the peek value in the image * * @param data The image data * @param cols The number of columns * @param rows The number of rows * @return The peak value of the image */ public static int peakValue(int[][][] data, int cols, int rows) { int peak = 0; for(int y=0; y peak) peak = data[y][x][1]; if(data[y][x][2] > peak) peak = data[y][x][2]; if(data[y][x][3] > peak) peak = data[y][x][3]; } } return peak; } /** * Normalizes the image data by the given scale * * @param data The image data * @param cols The number of columns * @param rows The number of rows * @param scale The scale to normalize the image by */ public static void normalize(int[][][] data, int cols, int rows, double scale) { for(int y=0; y 255) return 255; else return color; } }