syde 575: introduction to image processing · mixture of pigment primaries subtractive source:...

40
SYDE 575: Introduction to Image Processing Color Image Processing

Upload: others

Post on 10-Aug-2020

15 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: SYDE 575: Introduction to Image Processing · Mixture of pigment primaries subtractive Source: Gonzalez and Woods. CIE Chromaticity Diagram A method for specifying colors Specifies

SYDE 575: Introduction to Image Processing

Color Image Processing

Page 2: SYDE 575: Introduction to Image Processing · Mixture of pigment primaries subtractive Source: Gonzalez and Woods. CIE Chromaticity Diagram A method for specifying colors Specifies

Visible Light

● Visible light composed of relatively narrow band of frequencies in electromagnetic spectrum

● Chromatic light spans EM spectrum from around 400 to 700 nm

Source: Gonzalez and Woods

Page 3: SYDE 575: Introduction to Image Processing · Mixture of pigment primaries subtractive Source: Gonzalez and Woods. CIE Chromaticity Diagram A method for specifying colors Specifies

Color Perception

● Perceived color of an object based on nature of light reflected from object

● Examples:– If object reflects light that's balanced

from all visible wavelengths, object is perceived as white

– If object reflects light with wavelengths mainly in the 575 to 625nm range, object is perceived as red

Page 4: SYDE 575: Introduction to Image Processing · Mixture of pigment primaries subtractive Source: Gonzalez and Woods. CIE Chromaticity Diagram A method for specifying colors Specifies

Cones Revisited

● 6 to 7 million cones in the human eye● Divided into three main types:

– L cones (65%)● Maximally sensitive to long wavelengths (e.g., red)

– M cones (33%)● Maximally sensitive to medium wavelengths (e.g., green)

– S cones (2%)● Maximally sensitive to short wavelengths (e.g., blue)

Page 5: SYDE 575: Introduction to Image Processing · Mixture of pigment primaries subtractive Source: Gonzalez and Woods. CIE Chromaticity Diagram A method for specifying colors Specifies

Light Absorption of Cones

● Visible colors can be visualized as weighted combination of primary colors red, green, and blue

Source: Gonzalez and Woods

Page 6: SYDE 575: Introduction to Image Processing · Mixture of pigment primaries subtractive Source: Gonzalez and Woods. CIE Chromaticity Diagram A method for specifying colors Specifies

Mixtures of Light vs. Mixtures of Pigments

● Mixture of light primaries additive● Mixture of pigment primaries subtractive

Source: Gonzalez and Woods

Page 7: SYDE 575: Introduction to Image Processing · Mixture of pigment primaries subtractive Source: Gonzalez and Woods. CIE Chromaticity Diagram A method for specifying colors Specifies

CIE Chromaticity Diagram

● A method for specifying colors● Specifies color composition as function of x

(red) and y (green)● For any value of x and y, value of z (blue)

can be found as

● The (x,y,z) values of a color specifies percentage of red, green, and blue needed to form the color (Trichromatic Coefficients)

1 ( )z x y= − +

Page 8: SYDE 575: Introduction to Image Processing · Mixture of pigment primaries subtractive Source: Gonzalez and Woods. CIE Chromaticity Diagram A method for specifying colors Specifies

CIE Chromaticity Diagram

Source: Gonzalez and Woods

Page 9: SYDE 575: Introduction to Image Processing · Mixture of pigment primaries subtractive Source: Gonzalez and Woods. CIE Chromaticity Diagram A method for specifying colors Specifies

CIE Chromaticity DiagramInterpretation

● Pure spectrum colors located around boundary

● All non-boundary colors are mixture of spectrum colors

● Point of equal energy corresponds to equal fractions of the three primary colors– CIE standard for white light

● Straight line segment joining to points define all colors that can be created by mixing these two colors additively

Page 10: SYDE 575: Introduction to Image Processing · Mixture of pigment primaries subtractive Source: Gonzalez and Woods. CIE Chromaticity Diagram A method for specifying colors Specifies

RGB Color Model

● Primarily used for displays and cameras● Based on Cartesian coordinate system● Three axis represents intensities of red,

green, and blue● Gray scale (points of equal RGB values)

extends from black (0,0,0) to white (1,1,1)● Example: 24-bit color (Truecolor)

– 8-bits (256 levels) are used to represent each channel

– Gives a total of (256)3=16,777,216 possible colors!

Page 11: SYDE 575: Introduction to Image Processing · Mixture of pigment primaries subtractive Source: Gonzalez and Woods. CIE Chromaticity Diagram A method for specifying colors Specifies

RGB Color Model Visualization

Source: Gonzalez and Woods

Page 12: SYDE 575: Introduction to Image Processing · Mixture of pigment primaries subtractive Source: Gonzalez and Woods. CIE Chromaticity Diagram A method for specifying colors Specifies

CMY/CMYK Color Models

● Primarily used for printing● Based on primary colors of pigments● For CMY, the three axis represent the

amount of cyan, magenta, and yellow pigments to put in to produce a certain color

111

C RM GY B

= −

Page 13: SYDE 575: Introduction to Image Processing · Mixture of pigment primaries subtractive Source: Gonzalez and Woods. CIE Chromaticity Diagram A method for specifying colors Specifies

Why K?

● In theory, equal amounts of cyan, magenta, and yellow produces black

● In practice, combining them results in muddy-looking black

● To produce true black in printing, a fourth color (black) is added to produce the CYMK color model

Page 14: SYDE 575: Introduction to Image Processing · Mixture of pigment primaries subtractive Source: Gonzalez and Woods. CIE Chromaticity Diagram A method for specifying colors Specifies

Pros and Cons of RGB

● Advantages of RGB model:– Straightforward (great for hardware

implementation)– Matches well with human vision system's

strong response to red, green, and blue● Disadvantage of RGB model:

– Difficult for human description of color (e.g., humans don't describe color as RGB percentages)

– Highly redundant and correlated (e.g., all channels hold luminance information, reduces coding efficiency)

Page 15: SYDE 575: Introduction to Image Processing · Mixture of pigment primaries subtractive Source: Gonzalez and Woods. CIE Chromaticity Diagram A method for specifying colors Specifies

HSI Color Model

● Useful for human color interpretation● Three axis represent:

– Hue● Describes pure/dominate color perceived by

observer (e.g., pure yellow, orange, red)– Saturation (Purity of color)

● Amount of white light mixed with hue ● High saturation = high purity = little white

light mixed with hue– Intensity

● Brightness

Page 16: SYDE 575: Introduction to Image Processing · Mixture of pigment primaries subtractive Source: Gonzalez and Woods. CIE Chromaticity Diagram A method for specifying colors Specifies

Relationship between RGB and HSI

Source: Gonzalez and Woods

● Hue: all colors on plane defined by white, black, and a pure color corner point have same hue

● Saturation: distance from associated pure color● Intensity: projection to gray scale line

Page 17: SYDE 575: Introduction to Image Processing · Mixture of pigment primaries subtractive Source: Gonzalez and Woods. CIE Chromaticity Diagram A method for specifying colors Specifies

HSI Color Model Visualization

Source: Gonzalez and Woods

Page 18: SYDE 575: Introduction to Image Processing · Mixture of pigment primaries subtractive Source: Gonzalez and Woods. CIE Chromaticity Diagram A method for specifying colors Specifies

Example: Decomposing image into HSI components

Source: Gonzalez and Woods

Page 19: SYDE 575: Introduction to Image Processing · Mixture of pigment primaries subtractive Source: Gonzalez and Woods. CIE Chromaticity Diagram A method for specifying colors Specifies

YCbCr Color Model

● Useful for image and video compression (e.g, JPEG, MPEG)

● Three axis represent:– Y: Luma– Cb: Blue difference (Blue – Luma)– Cr: Red difference (Red-Luma)

● Separates luma from chroma channels so they can be treated separately

● More closely related to human vision system– Recall: Luminance vs. Chroma sensitivity

● More perceptually uniform (i.e., color differences among hues perceived uniformly)

Page 20: SYDE 575: Introduction to Image Processing · Mixture of pigment primaries subtractive Source: Gonzalez and Woods. CIE Chromaticity Diagram A method for specifying colors Specifies

Pseudocolor Image Processing

● Goal– Assign color to gray levels to convert

grayscale image into color image● Why?

– Improve visualization of image information

● Motivation– Humans can discern thousands of color

shades but only two dozen or so gray shades

Page 21: SYDE 575: Introduction to Image Processing · Mixture of pigment primaries subtractive Source: Gonzalez and Woods. CIE Chromaticity Diagram A method for specifying colors Specifies

Intensity Slicing

● One of the simplest methods for pseudocolor image processing

● Grayscale image can be viewed as 3D function (x,y, and intensity)

● Suppose we define P planes perpendicular to intensity axis

● Each plane i is associated with a color Ci

● Pixels with intensities lying along a particular plane i is assigned the color C

i

corresponding to the plane

Page 22: SYDE 575: Introduction to Image Processing · Mixture of pigment primaries subtractive Source: Gonzalez and Woods. CIE Chromaticity Diagram A method for specifying colors Specifies

Visualization of Intensity Slicing

Source: Gonzalez and Woods

Page 23: SYDE 575: Introduction to Image Processing · Mixture of pigment primaries subtractive Source: Gonzalez and Woods. CIE Chromaticity Diagram A method for specifying colors Specifies

Example: Rainfall Monitoring

Source: Gonzalez and Woods

Page 24: SYDE 575: Introduction to Image Processing · Mixture of pigment primaries subtractive Source: Gonzalez and Woods. CIE Chromaticity Diagram A method for specifying colors Specifies

Gray Level to Color Transformations

● Intensity slicing limits range of pseudocolor enhancement results– Fixed one-to-one relationship between

intensity and specified colors● Alternative solution:

– Process grayscale image using independent transformations

– The results of the transformations are combined to create one composite color image

Page 25: SYDE 575: Introduction to Image Processing · Mixture of pigment primaries subtractive Source: Gonzalez and Woods. CIE Chromaticity Diagram A method for specifying colors Specifies

Example using Three Transformations

Source: Gonzalez and Woods

Page 26: SYDE 575: Introduction to Image Processing · Mixture of pigment primaries subtractive Source: Gonzalez and Woods. CIE Chromaticity Diagram A method for specifying colors Specifies

Example: Security Screening

Source: Gonzalez and Woods

Explosive

Garment bag

Background

Page 27: SYDE 575: Introduction to Image Processing · Mixture of pigment primaries subtractive Source: Gonzalez and Woods. CIE Chromaticity Diagram A method for specifying colors Specifies

Transformation 1

Source: Gonzalez and Woods

● Garment bag mapped differently than explosive

● Easy to spot explosive

Page 28: SYDE 575: Introduction to Image Processing · Mixture of pigment primaries subtractive Source: Gonzalez and Woods. CIE Chromaticity Diagram A method for specifying colors Specifies

Transformation 2

Source: Gonzalez and Woods

● Garment bag mapped similar than explosive

● Hard to spot explosive

Page 29: SYDE 575: Introduction to Image Processing · Mixture of pigment primaries subtractive Source: Gonzalez and Woods. CIE Chromaticity Diagram A method for specifying colors Specifies

Multi-Image Pseudocoloring

Source: Gonzalez and Woods

Page 30: SYDE 575: Introduction to Image Processing · Mixture of pigment primaries subtractive Source: Gonzalez and Woods. CIE Chromaticity Diagram A method for specifying colors Specifies

Example: Multispectral Image Visualization

Source: Gonzalez and Woods

Page 31: SYDE 575: Introduction to Image Processing · Mixture of pigment primaries subtractive Source: Gonzalez and Woods. CIE Chromaticity Diagram A method for specifying colors Specifies

Point Operations in Color Image Processing

● Similar to point processing for grayscale images

1 2( , ,..., ), 1, 2,...,i i ns T z z z i n= =● Example: RGB color model

– n = 3– z

1,z

2,z

3 denotes red, green, blue

components of the input image

Page 32: SYDE 575: Introduction to Image Processing · Mixture of pigment primaries subtractive Source: Gonzalez and Woods. CIE Chromaticity Diagram A method for specifying colors Specifies

What are Color Complements?

● Hues opposite one another on the color circle

● Analogous to grayscale inverses● Useful for enhancing details in dark regions

of image

Source: Gonzalez and Woods

Page 33: SYDE 575: Introduction to Image Processing · Mixture of pigment primaries subtractive Source: Gonzalez and Woods. CIE Chromaticity Diagram A method for specifying colors Specifies

Example

Source: Gonzalez and Woods

Page 34: SYDE 575: Introduction to Image Processing · Mixture of pigment primaries subtractive Source: Gonzalez and Woods. CIE Chromaticity Diagram A method for specifying colors Specifies

Point Operations for Tone Correction

● Tonal range: general distribution of color intensities– Similar to intensity contrast in grayscale

images● High-key images

– Colors concentrated at high intensities● Low-key images

– Colors concentrated at low intensities● As with grayscale images, it is desirable to

distribute color intensities evenly

Page 35: SYDE 575: Introduction to Image Processing · Mixture of pigment primaries subtractive Source: Gonzalez and Woods. CIE Chromaticity Diagram A method for specifying colors Specifies

Point Operations for Tone Correction

● Before correcting color imbalances, tonal imbalances are first corrected

● Since colors are not changed, all color channels are transformed using the same transformation for color models where intensity information is spread across multiple channels (e.g., RGB, CMY)

● For HSI color model, only I channel is modified

● Operations are similar to intensity contrast adjustment for grayscale images

Page 36: SYDE 575: Introduction to Image Processing · Mixture of pigment primaries subtractive Source: Gonzalez and Woods. CIE Chromaticity Diagram A method for specifying colors Specifies

Tone Correction for Common Tonal Imbalances

● Flat images– Use an s-curve transformation to boost

contrast ● lighten highlight areas● darken shadow areas

● Light and dark images– Similar to power-law transformations– Stretch light regions and compress dark

regions for light images (high gamma)– Stretch dark regions and compress light

regions for dark images (low gamma)

Page 37: SYDE 575: Introduction to Image Processing · Mixture of pigment primaries subtractive Source: Gonzalez and Woods. CIE Chromaticity Diagram A method for specifying colors Specifies

Example Tonal Corrections

Source: Gonzalez and Woods

Page 38: SYDE 575: Introduction to Image Processing · Mixture of pigment primaries subtractive Source: Gonzalez and Woods. CIE Chromaticity Diagram A method for specifying colors Specifies

Point Operations for Color Correction

● Various ways to correct color imbalances● Perception of a color affected by

surrounding colors● Proportion of any color (e.g., magenta) can

be reduced by– Increasing its complementary color (e.g.,

green)– Decreasing portion of the two

immediately adjacent colors (e.g., red and blue)

Page 39: SYDE 575: Introduction to Image Processing · Mixture of pigment primaries subtractive Source: Gonzalez and Woods. CIE Chromaticity Diagram A method for specifying colors Specifies

Color Corrections

Source: Gonzalez and Woods

Page 40: SYDE 575: Introduction to Image Processing · Mixture of pigment primaries subtractive Source: Gonzalez and Woods. CIE Chromaticity Diagram A method for specifying colors Specifies

Histogram Equalization

Source: Gonzalez and Woods

● Histogram equalization on individual color channels leads to erroneous colors

● Better approach is to just equalize intensity component and leave colors (i.e., hues) unchanged