CS 450: Introduction to Digital Signal and Image Processing
Color Processing
Light and Wavelengths
• Visible light is in the range 400 nm (blue) to 700 nm (red). Perception of Light
• Cones have three different kinds of color-sensitive pigments, each responding to a different range of wavelengths. • These are roughly “red”, “green”, and “blue” in their peak response but each responds to a wide range of wavelengths. • The combination of the responses of these different receptors gives us our color perception. • This is called the tristimulus model of color vision.
Cones and Wavelengths
(From G&W, individual cone responses normalized) Cones and Wavelengths
• The sensitivity and number of the three types of cones are different • More sensitive overall to green and red than to blue
Relative responses of the three different cones
Luminous Efficiency Function
• The luminous efficiency function combines the responses of all three to measure perceived brightness for different wavelengths RGB Color Model
• Simplest model is just to store red, green, and blue values • Colors can be thought of as points in a RGB cube
RGB Color Channels “Web Safe” Colors
Primaries and Secondaries
• Primary colors: ones mixed to make other colors • Secondary colors: pairwise combinations of primaries • Can be additive or subtractive CMY Model
• Subtractive media absorb rather than emit light – Real-world objects – Paint – Printing ink • The perceived color is what is not absorbed (reflected) • CMY based on subtractive primaries: cyan (C), magenta (M), and yellow (Y)
CMYK Model
• Problem with CMY model: – Because of imperfect primaries, can’t entirely absorb all colored light (i.e., make black) – Usually produces a dark greyish brown • Solution: add black (K) as a fourth primary • CMYK most common model for printers Luminance and Chromaticity
• RGB and CMYK aren’t the most intuitive model of colors. • Artists usually think of dark/light and color as two different things: – Luminance (brightness) – Chromaticity (color)
Luminance
• Technically, – Luminance = incoming light – Brightness = perceived incoming light • Many color models make the luminance or brightness an explicit component of the color model though by varying names: – Luminance – Intensity – Brightness – Lightness – Luma – Value Chromaticity
• Requires two parameters – Usually: • Hue The dominant wavelength • Saturation How pure that color is (ratio of color to white) – Some models use different chromaticity parameters
• Examples: – Red vs. Blue? – Red vs. Pink? – Dark red vs. Bright red?
Tints and Shades
• Lightening or darkening colors: – Tint: adding more white to a color – Shade: adding more black to a color
• Tints and shades are not inverses! – Why not? The CIE RGB Model
• Standardized “red”, “green”, and “blue” to try to match perception: 438.1, 546.1, and 700 mn
R = Km ∫ L(λ)r(λ)dλ
G = Km ∫ L(λ)g(λ)dλ
B = Km ∫ L(λ)b(λ)dλ
Notice negative we€ig ht of red component for wavelengths near 500 nm—can’t physically mix
The CIE XYZ Model (1931)
• Replaces R, G, B with “imaginary” primaries X, Y, Z – Don’t correspond to single wavelengths – Weights are always positive – More saturated than monochromatic light – Can model all physically realizable colors
X = Km ∫ L(λ) x (λ)dλ
Y = Km ∫ L(λ) y (λ)dλ
Z = Km ∫ L(λ)z (λ)dλ
€ Normalizing CIE XYZ Model
• Normalize X, Y, Z so that we can talk about chromaticity: X x = X + Y + Z Y y = X + Y + Z Z z = X + Y + Z
Notice that x + y + z = 1 forms a plane in color space € — can just use x and y (because z = 1 - x - y)
CIE Chromaticity Diagram
Gamut Color Gamuts
• A color gamut is the space of colors spanned by a set of primaries • No three physical primaries can span the entire space of physically realizable colors – Use “negative” weights for some colors, or – Use “imaginary” primaries that lie outside the color space – Both are physically impossible • Better with more primaries, but still not able to span the entire color space – Some color printers use more than just CMYK
Device Primaries and Gamuts
• Different devices have different primaries and different gamuts – Scanners – Monitors – Printers • Two major problems working with color: – Calibration: “talking the same color language” – Out-of-gamut limitations NTSC YIQ Model
• The National Television Standards Committee (NTSC) standard uses a color model called YIQ: – Y luminance – I and Q chromaticity Y 0 .299 0.587 0.114 R I 0 .596 0.275 0.321 G = − − 0.212 0532 0.311 Q − B • Television Signals – Color TV broadcasts are YIQ € – “Black-and-white” (grey) TV uses Y only
HSI Color Model
• One axis is intensity (luminance) • The plane perpendicular to this axis represents chromaticity – Angle = hue – Distance from center = saturation • Can map this plane using a triangle, hexagon, or circle HSI Color Model
HSI Color Model HSI Color Model
Other Color Models
• Hue-Saturation-Value (HSV) – Like HSI but with only one cone • Hue-Lightness-Saturation (HLS) • Hue-Value-Chroma (HVC) • CIE LUV • CIE La*b* – Attempts to be perceptually linear Pseudocolor (Indexed Color)
• For some applications, you may want to store fewer than 24 bits per pixel – Older/less-expensive video buffers – Compression (used in GIF compression) • Use a lookup table to map values in the image buffer to 24-bit color values – Example: 8-bit buffer, 256-color lookup table – The set of displayable colors in the lookup table is often called the palette • Selection of palette from an image is known as color quantization
Pseudocolor (Indexed Color)
• Can use similar method for mapping grey level image to color Color and Visualization
• Color can be used in information visualization to provide an additional dimension
Color and Visualization
• Specific color meanings: keep it limited • Color scales are hard to interpret – Heat scale is one that of the few that partially works • Limits of color reproduction can change the message Color Image Processing
• General approaches – Process RGB color planes separately • Simple • Not always meaningful thinking in RGB – Convert to HSI or other color space with explicit intensity component • Process the intensity component as you normally would • May process the saturation • Generally want to leave the hue alone in this model – Design transformation in intensity/chromaticity space, but implement through direct RGB manipulation
Processing RGB Planes Processing Other Components
Color Transformations Color Transformations
• Can change channels together to transform the intensities
Color Balancing
• Or you can change channels separately – Can emphasize or de-emphasize one or more channels Color Histogram Equalization
• Convert to HSI or similar space • Process – Histogram equalize the intensity plane – Increase the saturation – Leave the hue plane unchanged • Convert back to RGB for display
Color Histogram Equalization Summary
• Pick a color space that makes sense for your application • If the application is interactive, consider using HSI or other color space with explicit intensity/chromaticity • If you want to process intensities but keep hues the same, work (or at least think) in that kind of color space • Keep physical limitations in mind – Primaries, different color gamuts, etc. • There’s a lot more to color than RGB triplets!