at.ac.sbg.cosy.soccerbot.recognition
Class RGBColor

java.lang.Object
  extended by at.ac.sbg.cosy.soccerbot.recognition.RGBColor

public class RGBColor
extends java.lang.Object

Library for RGB Color conversion / information extraction

Author:
Peter Wild

Constructor Summary
RGBColor()
           
 
Method Summary
static int get_B(int color)
          Extracts the blue channel value out of an rgb int value
static int get_G(int color)
          Extracts the green channel value out of an rgb int value
static int get_R(int color)
          Extracts the red channel value out of an rgb int value
static int rgb(int r, int g, int b)
          Creates an argb format representation of four alpha, red, green, blue channel values within 0x00 - 0xFF.
static int rgb2hsv(int rgb)
          Converts rgb values into hsv values (lossy transformation) usually hsv values are displayed as h = [0,360], s = [0,100], v = [0,100], so simply transform the used space h = [0,65535], s= [0,255], v= [0,255] to your needs.
static void rgb2lab(int rgb, double[] lab)
          Converts rgb values into lab values (lossy transformation) usually lab values are displayed as L = [0,100], a = [0,100], b = [0,100], so simply transform the used space L = [0,255], a= [0,255], b= [0,255] to your needs.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RGBColor

public RGBColor()
Method Detail

get_R

public static int get_R(int color)
Extracts the red channel value out of an rgb int value

Parameters:
color - int-color value in 32-bit rgb format (0x00RRGGBB)
Returns:
red channel value

get_G

public static int get_G(int color)
Extracts the green channel value out of an rgb int value

Parameters:
color - int-color value in 32-bit rgb format (0x00RRGGBB)
Returns:
green channel value

get_B

public static int get_B(int color)
Extracts the blue channel value out of an rgb int value

Parameters:
color - int-color value in 32-bit rgb format (0x00RRGGBB)
Returns:
blue channel value

rgb

public static int rgb(int r,
                      int g,
                      int b)
Creates an argb format representation of four alpha, red, green, blue channel values within 0x00 - 0xFF. Converts (r 0xFF, g 0xFF, b 0xFF -> rgb 0x00FFFFFF).

Parameters:
r - red color value in 0x00 - 0xFF
g - green color value in 0x00 - 0xFF
b - blue color value in 0x00 - 0xFF
Returns:
argb 32-bit format (0xAARRGGBB) representation

rgb2hsv

public static int rgb2hsv(int rgb)
Converts rgb values into hsv values (lossy transformation) usually hsv values are displayed as h = [0,360], s = [0,100], v = [0,100], so simply transform the used space h = [0,65535], s= [0,255], v= [0,255] to your needs.

Parameters:
rgb - argb 32-bit format (0xAARRGGBB) representation
Returns:
hsv 32-bit format (0xHHHHSSVV) representation of according rgb

rgb2lab

public static void rgb2lab(int rgb,
                           double[] lab)
Converts rgb values into lab values (lossy transformation) usually lab values are displayed as L = [0,100], a = [0,100], b = [0,100], so simply transform the used space L = [0,255], a= [0,255], b= [0,255] to your needs.

Parameters:
rgb - argb 32-bit format (0xAARRGGBB) representation
lab - initialized array of length 3 containing lab representation of according rgb after call