<<

Color Constancy

Perceived color is highly context dependent Allowing color recognition with variable lighting conditions

Is the gray level in A different or the same as in B? Simultaneous Contrast Simultaneous Contrast

The XYZ color system, the basic color system, was adopted by CIE in 1931 but this system does not have the properties of a uniform .

x = , y= z = 1 - (x+y) = Boundaries have fully saturated colors Point of equal energy => x=y=z => CIE standard for light Any color inside a triangle can be produced by various combinations of the 3 initial colors x = red, y= green z = 1 - (x+y) = blue Boundaries have fully saturated colors Point of equal energy => x=y=z => CIE standard for white light Any color inside a triangle can be produced by various combinations of the 3 initial colors e2  L*2 a*2 b*2

Actual size of ellipses is 10 times smaller ∆e=3 visually indistinguishable ∆e=5 acceptable error (most printers) ∆e=10 bad ∆e=15 unacceptable - Light Mixing

• Additive mix of colored lights • Primary: RGB • Secondary: CMY • White = R + G + B • Show demonstration of optical mixing Weber’s Law

In general, I needed for just noticeable difference (JND) over background I was found to satisfy:

I = constant I

(I is intensity, I is change in intensity)

Weber’s Law: PerceivedBrightness Perceived = log (I) Intensity

14

RGB Color Space

Color Spaces

 Linear (RGB, CMYK)

 Artistic View (Munsell, HSV, HLS)

 Standard (CIE-XYZ)

 Perceptual (LUV, Lab)

 Opponent (YIQ, YUV) – used in TV

18 The Artist Point of View

 Hue - The color we see (red, green, )

 Saturation - How far is the color from gray ( is less saturated than red, is less saturated than )

 Brightness/ () - How bright is the color

white

19 • The CIE Luv color space is designed to be perceptually uniform, meaning that a given change in value corresponds roughly to the same perceptual difference over any part of the space.

• Using such a space for quantizing color values decreases the chance that any given step in color value will be noticeable on a display or hardcopy.

• The Luv space was designed specifically for emissive colors, which correspond to images captured by a camera or rendering program. Luv and Lab color spaces

L*u*v* color system and L*a*b* color system are both uniform color spaces that were adopted in 1976 by Commission Internationale de l'Eclairage (CIE) and are also referred to as the CIE LUV color space.

Uniform color space refers to a color space with a sensuously uniform scale property, a color space in which the sensuous differences of uniform luminance colors in all areas of the diagram lie in more or less geometric distances.

The XYZ color system, the basic color system, was adopted by CIE in 1931 but this system does not have the properties of a uniform color space. L*a*b* (L*u*v*) color spaces CIELAB (L*a*b*) color space Approximately uniform color space L = lightness a* = relative redness-greenness b* = relative yellowness-blueness

Color difference in L*a*b* coordinates

Conversion to and from CIE (u',v') is accomplished with the following transformation: u' = 4*x / (-2*x + 12*y + 3) v' = 9*y / (-2*x + 12*y + 3) x = 9*u' / (6*u' - 16*v' + 12) y = 4*v' / (6*u' - 16*v' + 12)

CIE (x,y) coordinates plus luminance (Y) may then be converted to XYZ values using:

X = x/y * Y Z = (1-x-y)/y * Y

To get (x,y) from XYZ: x = X/(X+Y+Z) y = Y/(X+Y+Z) 9.Color Space – YUV

 YUV

 Used for: encoding for some standard such as NTSC, PAL, SECAM

 Axes:

 Y:

 U: blue chroma

 V: red chroma

28 9.Color Space – YUV

 Conversion from RGB:

 Y=0.299R+0.587G+0.114B

 U=0.436(B-Y)/(1-0.114)

 V=0.615(R-Y)/(1-0.299)

 The Matrix form: YR  0.299 0.587 0.114        UG   0.14713  0.28886 0.436        VB  0.615 0.51499 0.10001   29 The YUV color system

The basic idea in the YUV is to separate the color information apart from the brightness information. The components of YUV are:

Y  0.3 R  0.6G  0.1 B U  B  Y V  R  Y

(1.3)

Y represents the luminance of the image, while U,V consists of the color information, i.e. . The luminance component can be considered as a gray-scale version of the RGB image The YUV color space

R = Y + 1.4075 * (V - 128) G = Y - 0.3455 * (U - 128) - (0.7169 * (V - 128)) B = Y + 1.7790 * (U - 128)

Y = R * .299000 + G * .587000 + B * .114000 U = R * -.168736 + G * -.331264 + B * .500000 + 128 V = R * .500000 + G * -.418688 + B * -.081312 + 128 The YUV color system

The advantages of YUV compared to RGB are:

 The brightness information is separated from the color information  The correlations between the color components are reduced.  Most of the information is collected to the Y component, while the information content in the U and V is less.

The latter two properties are beneficial in image compression. This is because the correlations between the different color components are reduced, thus each of the components can be compressed separately. Besides that, more bits can be allocated to the Y component than to U and V. The YUV color system is adopted in the JPEG image compression standard. RGB image

Red Green Blue

Y U V Original image

Y

U

V 9.Color Space – YIQ

 YIQ  Used for: video encoding for some standard such as NTSC  Axes:  Y: luma  I: blue chroma  Q: red chroma  I-Q channels are rotated from the U-V channels in YUV

35 9.Color Space – YIQ

 Conversion from RGB:

YR  0.299 0.587 0.114        IG  0.595716  0.274453  0.321263        QB  0.211456 0.522591 0.311135  

36 9.Color Space – CMYK

 Used for: printer printing

 Use the mixing

 Axes:

 K:

37 9.Color Space – CMYK

 Conversion from RGB:

 C = 255 -Y - 1.4021(Cr-128)

 M = 255 - Y + 0.3441(Cb-128) + 0.7142(Cr-128)

 Y = 255 - Y - 1.7718(Cb -128)

 K = min (C, M, Y)

38 9.Color Space – Comparison

Color Color Primary Used for Pros and space mixing parameters cons RGB Additive Red, Easy but wasting Green, Blue bandwidth CMYK Subtractive Cyan, Magenta, Printer Works in pigment Yellow, Black mixing YCbCr additive Y(luminance), Video encoding, Bandwidth efficient YPbPr Cb(blue chroma), digital camera Cr(red chroma) YUV additive Y(luminance), Video encoding Bandwidth efficient U(blue chroma), for NTSC, PAL, V(red chroma) SECAM

YIQ additive Y(luminance), Video encoding Bandwidth efficient I(rotated from U), for NTSC Q(rotated from V) 39

HSV/HSB Color Space

HSV = Hue Saturation Value HSB = Hue Saturation Brightness

Saturation Scale

Brightness Scale

41 HSV Value Saturation

Hue

42 HLS Color Space

HLS = Hue Lightness Saturation V

green 120° yellow

cyan 0.5 red 0°

Blue 240° magenta

H 0.0 S black

43 HSI color space

• Humans decribe color by • hue, • saturation • brightness

• HSI is ideal tool for developing image processing algorithms based on color descriptions that are natural and intuitive to humans HSI color space HSI color space • HSL and HSV are the two most common cylindrical-coordinate representations of points in an RGB color model

• HSV and HSL rearrange the geometry of RGB in an attempt to be more perceptually relevant than the cartesian representation.

• They were developed in the 1970s for computer graphics applications, and are used for color pickers, in color-modification tools in software, and less commonly for and . • HSL stands for hue, saturation, and lightness, and is often also called HLS.

• HSV stands for hue, saturation, and value, and is also often called HSB (B for brightness).

• A third model, common in computer vision applications, is HSI, for hue, saturation, and intensity

HSI color separation

Hue (H) – värisävy

Saturation (S) – värikylläisyys

Intensity (I) – voimakkuus

Conversion to and from CIE (u',v') is accomplished with the following transformation: u' = 4*x / (-2*x + 12*y + 3) v' = 9*y / (-2*x + 12*y + 3) x = 9*u' / (6*u' - 16*v' + 12) y = 4*v' / (6*u' - 16*v' + 12)

CIE (x,y) coordinates plus luminance (Y) may then be converted to XYZ values using:

X = x/y * Y Z = (1-x-y)/y * Y

To get (x,y) from XYZ: x = X/(X+Y+Z) y = Y/(X+Y+Z)

The RGB to HSI conversion can be summarized as follows:

1 1   R  G   R  B  H  cos1  2 , if B  G 360  2    R  G   R  BG  B  1 1   R  G   R  B  H  1 cos1  2 , otherwise 360  2    R  G   R  BG  B 

3 S = 1-  min R,G, B  R  G  B 1 I    R  G  B 3 HSI color separation

Hue (H) – värisävy

Saturation (S) – värikylläisyys

Intensity (I) – voimakkuus

RGB to HSV Conversion Java Code HSV to RGB Code

RGB to HLS Conversion Code

JPEG/JFIF - RGB Conversion

JPEG/JFIF files store compressed images in a YUV-like colorspace that uses slightly different coefficients to convert to RGB. These formulas are:

R = Y + 1.40200 * (U - 128) G = Y - 0.34414 * (V - 128) - 0.71414 * (U - 128) B = Y + 1.77200 * (V - 128) Examples of Color Distribution of Natural Images in 3 Color Spaces

Natural scenes HSV

RGB YUV Conversion to

 Simplest way to convert color to grayscale

 Resulting image will be too dark in red and green areas  Alternative approach is use a weighted sum of RGB

 Original weights for analog TV

 Newer ITU weights for digital color encoding Organization of Color Images

 True color: Uses all colors in color space  Indexed color: Uses only some colors  Which subset of colors to use? Depends on application  True color:  used in applications that contain many colors with subtle differences  E.g. digital photography or photorealistic rendering  Two main ways to organize true color  Component ordering  Packed ordering True Color: Component Ordering

 Colors in 3 separate arrays of similar length  Retrieve same location (u,v) in each R, G and B array True Color: Packed Ordering

 Component (RGB) values representing a pixel’s color is packed together into single element

The End