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 startX is the x pixel of the image to start from * @param startY is the y pixel of the image to start from * @param stopX is the x pixel of the image to stop * @param stopY is the y pixel of the image to stop * @return The peak value of the image */ public static int getPeakValue(int[][][] data) { return getPeakValue(data, 0, 0, data[0].length, data.length); } /** * Returns the peek value in the image * * @param data The image data * @param startX is the x pixel of the image to start from * @param startY is the y pixel of the image to start from * @param stopX is the x pixel of the image to stop * @param stopY is the y pixel of the image to stop * @return The peak value of the image */ public static int getPeakValue(int[][][] data, int startX, int startY, int stopX, int stopY) { int peak = 0; for(int y=startY; 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 startX is the x pixel of the image to start from * @param startY is the y pixel of the image to start from * @param stopX is the x pixel of the image to stop * @param stopY is the y pixel of the image to stop * @param scale The scale to normalize the image by */ public static void normalize(int[][][] data, int startX, int startY, int stopX, int stopY, double scale) { for(int y=startY; y 255) return 255; else return color; } }