List of utility methods to do RGB Color Create
Image | newRGBImage(int[] rgb, int width, int height, boolean processAlpha) new RGB Image if (rgb == null) { throw new NullPointerException(); if (width <= 0 || height <= 0) { throw new IllegalArgumentException(); BufferedImage img = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); if (!processAlpha) { ... |
String | RGB(float R, float G, float B) Constructs a color given 3 RGB values. byte r = (byte) (255 * R); byte g = (byte) (255 * G); byte b = (byte) (255 * B); return "#" + hd[r >> 4] + hd[r & 15] + hd[g >> 4] + hd[g & 15] + hd[b >> 4] + hd[b & 15]; |
int | rgb(float rIn, float gIn, float bIn) Makes an integer color from the given red, green, and blue float values return rgb(floor(rIn * 255.0F), floor(gIn * 255.0F), floor(bIn * 255.0F));
|
int | rgb(int a, int r, int g, int b) rgb int ret = 0; ret |= (a & 0xff) << 24; ret |= (r & 0xff) << 16; ret |= (g & 0xff) << 8; ret |= (b & 0xff) << 0; return ret; |
int[] | rgb(int argb) rgb return new int[] { (argb >> 16) & 0xFF, (argb >> 8) & 0xFF, argb & 0xFF }; |
int[] | rgb(int pixel) rgb int r = (pixel & 0xff0000) >> 16; int g = (pixel & 0xff00) >> 8; int b = (pixel & 0xff); int[] m = { r, g, b }; return m; |
int | rgb(int r, int g, int b) rgb return (r << 16) + (g << 8) + b;
|
int | rgb(int red, int green, int blue) rgb int color = 0; color |= 0xFF000000; color |= (red & 0xFF) << 16; color |= (green & 0xFF) << 8; color |= blue & 0xFF; return color; |
int | RGB_GREEN(int rgb) RGGREEN return (((rgb) >> 8) & 0xff);
|
double | RGB_MSE(int[] rgb1, int[] rgb2) Calculate the mean square error of the two RGB data if (rgb1.length != rgb2.length) throw new RuntimeException("The images need to have the same number of pixels"); double mse = 0; for (int i = 0; i < rgb1.length; i++) { int a = rgb1[i]; int b = rgb2[i]; mse += sqr((a & 0xff) - (b & 0xff)); mse += sqr(((a >> 8) & 0xff) - ((b >> 8) & 0xff)); ... |