Chapter 6 Color Image Processing - Concordia...

55
© 2002 R. C. Gonzalez & R. E. Woods Chapter 6 Color Image Processing Color Spectrum: six broad regions – violet, blue, green, yellow, orange and red

Transcript of Chapter 6 Color Image Processing - Concordia...

Page 1: Chapter 6 Color Image Processing - Concordia Universityusers.encs.concordia.ca/~weiping/ELEC6641-W14/Chapter 6.pdf · Chapter 6 Color Image Processing . Color Spectrum: six broad

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 6 Color Image Processing

Color Spectrum: six broad regions – violet, blue, green, yellow, orange and red

Page 2: Chapter 6 Color Image Processing - Concordia Universityusers.encs.concordia.ca/~weiping/ELEC6641-W14/Chapter 6.pdf · Chapter 6 Color Image Processing . Color Spectrum: six broad

© 2002 R. C. Gonzalez & R. E. Woods

Color Spectrum

Each color blends smoothly into the next.

Visible light is composed of a relatively narrow band of frequencies in the electromagnetic spectrum.

Page 3: Chapter 6 Color Image Processing - Concordia Universityusers.encs.concordia.ca/~weiping/ELEC6641-W14/Chapter 6.pdf · Chapter 6 Color Image Processing . Color Spectrum: six broad

© 2002 R. C. Gonzalez & R. E. Woods

Absorption of Light by Cones in the Human Eye

Cones are the sensors in the eye responsible for color vision.

Page 4: Chapter 6 Color Image Processing - Concordia Universityusers.encs.concordia.ca/~weiping/ELEC6641-W14/Chapter 6.pdf · Chapter 6 Color Image Processing . Color Spectrum: six broad

© 2002 R. C. Gonzalez & R. E. Woods

Primary and Secondary Colors of Light and Pigments

Three primary colors and their combinations to produce the secondary colors. Example: Color TV

Three pigment primaries and their combinations

Page 5: Chapter 6 Color Image Processing - Concordia Universityusers.encs.concordia.ca/~weiping/ELEC6641-W14/Chapter 6.pdf · Chapter 6 Color Image Processing . Color Spectrum: six broad

© 2002 R. C. Gonzalez & R. E. Woods

Characteristics Used to Distinguish One Color from Another

Brightness: chromatic notion of intensity Hue: dominant wavelength Saturation: relative purity or amount of white light mixed with a hue. Hue and saturation taken together are called chromaticity.

Page 6: Chapter 6 Color Image Processing - Concordia Universityusers.encs.concordia.ca/~weiping/ELEC6641-W14/Chapter 6.pdf · Chapter 6 Color Image Processing . Color Spectrum: six broad

© 2002 R. C. Gonzalez & R. E. Woods

Tristimulus Values and Trichromatic Coefficients

tristimulus values: X - red, Y- green, Z – blue trichromatic coefficients:

ZYXZz

ZYXYy

ZYXXx

++=

++=

++=

Page 7: Chapter 6 Color Image Processing - Concordia Universityusers.encs.concordia.ca/~weiping/ELEC6641-W14/Chapter 6.pdf · Chapter 6 Color Image Processing . Color Spectrum: six broad

© 2002 R. C. Gonzalez & R. E. Woods

CIE Chromaticity Diagram

Color composition as a function of x and y: z = 1-(x+y) Also shows the wave- length: from 380nm (violet) to 780 nm (red).

Green point: x=62% y=25%, therefore, z=13%.

Page 8: Chapter 6 Color Image Processing - Concordia Universityusers.encs.concordia.ca/~weiping/ELEC6641-W14/Chapter 6.pdf · Chapter 6 Color Image Processing . Color Spectrum: six broad

© 2002 R. C. Gonzalez & R. E. Woods

Typical Color Gamut of Color Monitors and Color Printing Devices

triangle: color monitors irregular region: color printing devices

Page 9: Chapter 6 Color Image Processing - Concordia Universityusers.encs.concordia.ca/~weiping/ELEC6641-W14/Chapter 6.pdf · Chapter 6 Color Image Processing . Color Spectrum: six broad

© 2002 R. C. Gonzalez & R. E. Woods

RGB (red, green, blue) model: Ideal for image color generation. It’s used for color monitors and color video cameras.

CMY(cyan, magenta, yellow) and CMYK (cyan, magenta,

yellow and black) model: It is used for color printing. HSI (hue, saturation, intensity) model: Ideal for color

description.

Color Models

Page 10: Chapter 6 Color Image Processing - Concordia Universityusers.encs.concordia.ca/~weiping/ELEC6641-W14/Chapter 6.pdf · Chapter 6 Color Image Processing . Color Spectrum: six broad

© 2002 R. C. Gonzalez & R. E. Woods

Schematic of the RGB Color Tube

R,G,B: normalized, i.e. in the region of [0,1]. The different colors are points on or inside the cube, and are defined by vectors extending from the origin.

Page 11: Chapter 6 Color Image Processing - Concordia Universityusers.encs.concordia.ca/~weiping/ELEC6641-W14/Chapter 6.pdf · Chapter 6 Color Image Processing . Color Spectrum: six broad

© 2002 R. C. Gonzalez & R. E. Woods

RGB 24-bit Color Cube

Each image consists of 3 component images, one for each primary color. Pixel depth: # of bits used to represent each pixel in RGB space.

The total number of colors in this 24-bit RGB image is 224 = 16777216

Page 12: Chapter 6 Color Image Processing - Concordia Universityusers.encs.concordia.ca/~weiping/ELEC6641-W14/Chapter 6.pdf · Chapter 6 Color Image Processing . Color Spectrum: six broad

© 2002 R. C. Gonzalez & R. E. Woods

Process of Acquiring a Color Image filters

Page 13: Chapter 6 Color Image Processing - Concordia Universityusers.encs.concordia.ca/~weiping/ELEC6641-W14/Chapter 6.pdf · Chapter 6 Color Image Processing . Color Spectrum: six broad

© 2002 R. C. Gonzalez & R. E. Woods

Safe RGB Colors

Safe RGB colors are a subset of colors that are likely to be reproduced faithfully, reasonably, independently of viewer hardware capability. In 256 colors, 216 colors are common to most system (safe colors).

Page 14: Chapter 6 Color Image Processing - Concordia Universityusers.encs.concordia.ca/~weiping/ELEC6641-W14/Chapter 6.pdf · Chapter 6 Color Image Processing . Color Spectrum: six broad

© 2002 R. C. Gonzalez & R. E. Woods

Safe RGB Colors

Page 15: Chapter 6 Color Image Processing - Concordia Universityusers.encs.concordia.ca/~weiping/ELEC6641-W14/Chapter 6.pdf · Chapter 6 Color Image Processing . Color Spectrum: six broad

© 2002 R. C. Gonzalez & R. E. Woods

The RGB Safe-Color Cube

It has valid colors only on the surface planes.

Page 16: Chapter 6 Color Image Processing - Concordia Universityusers.encs.concordia.ca/~weiping/ELEC6641-W14/Chapter 6.pdf · Chapter 6 Color Image Processing . Color Spectrum: six broad

© 2002 R. C. Gonzalez & R. E. Woods

The CMY and CMYK Color Models

Conversion from RGB to CMY

=

BGR

YMC

111

Page 17: Chapter 6 Color Image Processing - Concordia Universityusers.encs.concordia.ca/~weiping/ELEC6641-W14/Chapter 6.pdf · Chapter 6 Color Image Processing . Color Spectrum: six broad

© 2002 R. C. Gonzalez & R. E. Woods

Conceptual Relationships Between the RGB and HSI Models

Hue, saturation and intensity can be obtained from the RGB color cube.

intensity axis: line joining the black and white vertices. saturation: increases as a function of distance from the intensity axis

shaded plane: same hue (cyan)

Page 18: Chapter 6 Color Image Processing - Concordia Universityusers.encs.concordia.ca/~weiping/ELEC6641-W14/Chapter 6.pdf · Chapter 6 Color Image Processing . Color Spectrum: six broad

© 2002 R. C. Gonzalez & R. E. Woods

Hue and Saturation in the HSI Color Model

Primary colors: separated by 120º Secondary color: 60º from the primaries

Hue: angle from the red axis (0º means 0 hue) Saturation: length of the vector

hexagonal color circular color triangular color plane plane plane

Page 19: Chapter 6 Color Image Processing - Concordia Universityusers.encs.concordia.ca/~weiping/ELEC6641-W14/Chapter 6.pdf · Chapter 6 Color Image Processing . Color Spectrum: six broad

© 2002 R. C. Gonzalez & R. E. Woods

HSI Color Model

HSI color model based on triangular color plane.

HSI color model based on circular color plane.

Page 20: Chapter 6 Color Image Processing - Concordia Universityusers.encs.concordia.ca/~weiping/ELEC6641-W14/Chapter 6.pdf · Chapter 6 Color Image Processing . Color Spectrum: six broad

© 2002 R. C. Gonzalez & R. E. Woods

Converting Colors from RGB to HSI

Assume R,G and B are normalized to [0,1]

−=

θ

θ0360

Hif B if B>G

Where

−−+−

−+−= −

21

2

1

)])(()[(

)]()[(21

cos

BGBRGR

BRGRθ

)],,[min()(

31 BGRBGR

S++

−=

)(31 BGRI ++=

≤ G

Page 21: Chapter 6 Color Image Processing - Concordia Universityusers.encs.concordia.ca/~weiping/ELEC6641-W14/Chapter 6.pdf · Chapter 6 Color Image Processing . Color Spectrum: six broad

© 2002 R. C. Gonzalez & R. E. Woods

Converting Colors from HSI to RGB

RG sector ( 00 1200 <≤ H ):

)(1)60cos(

cos1

)1(

0

BRGH

HSIR

SIB

+−=

−+=

−=

GB sector ( 00 240120 <≤θ ):

)(1

])60cos(

cos1[

)1(120

0

0

GRBH

HSIG

SIRHH

+−=−

+=

−=−=

Page 22: Chapter 6 Color Image Processing - Concordia Universityusers.encs.concordia.ca/~weiping/ELEC6641-W14/Chapter 6.pdf · Chapter 6 Color Image Processing . Color Spectrum: six broad

© 2002 R. C. Gonzalez & R. E. Woods

Converting Colors from HSI to RGB

BR sector ( 00 360240 ≤≤ H ):

)(1

])60cos(

cos1[

)1(240

0

0

BGRH

HSIB

SIGHH

+−=−

+=

−=−=

Page 23: Chapter 6 Color Image Processing - Concordia Universityusers.encs.concordia.ca/~weiping/ELEC6641-W14/Chapter 6.pdf · Chapter 6 Color Image Processing . Color Spectrum: six broad

© 2002 R. C. Gonzalez & R. E. Woods

Gray-level display of H, S, I components

Page 24: Chapter 6 Color Image Processing - Concordia Universityusers.encs.concordia.ca/~weiping/ELEC6641-W14/Chapter 6.pdf · Chapter 6 Color Image Processing . Color Spectrum: six broad

© 2002 R. C. Gonzalez & R. E. Woods

RGB image and the components of its corresponding HSI image

RGB image hue

saturation intensity

Page 25: Chapter 6 Color Image Processing - Concordia Universityusers.encs.concordia.ca/~weiping/ELEC6641-W14/Chapter 6.pdf · Chapter 6 Color Image Processing . Color Spectrum: six broad

© 2002 R. C. Gonzalez & R. E. Woods

Manipulating HSI Component images

Change to 0 the pixels corresponding to blue and green regions in Fig.6.16(b)

Reducing by half the saturation of the cyan region in Fig.6.16(c).

Reducing by half the intensity of the central white region in Fig.6.16(d).

Converting the modified HSI image to RGB image. Outer portions: all red Purity of cyan: diminished Central region: gray

Page 26: Chapter 6 Color Image Processing - Concordia Universityusers.encs.concordia.ca/~weiping/ELEC6641-W14/Chapter 6.pdf · Chapter 6 Color Image Processing . Color Spectrum: six broad

© 2002 R. C. Gonzalez & R. E. Woods

Pseudocolor Image Processing

Pseudocolor image processing consists of assigning colors to gray values on a specified criterion.

Page 27: Chapter 6 Color Image Processing - Concordia Universityusers.encs.concordia.ca/~weiping/ELEC6641-W14/Chapter 6.pdf · Chapter 6 Color Image Processing . Color Spectrum: six broad

© 2002 R. C. Gonzalez & R. E. Woods

Intensity Slicing

Using plane at f(x,y)=li to slice the image function into two levels.

Page 28: Chapter 6 Color Image Processing - Concordia Universityusers.encs.concordia.ca/~weiping/ELEC6641-W14/Chapter 6.pdf · Chapter 6 Color Image Processing . Color Spectrum: six broad

© 2002 R. C. Gonzalez & R. E. Woods

Intensity Slicing

Page 29: Chapter 6 Color Image Processing - Concordia Universityusers.encs.concordia.ca/~weiping/ELEC6641-W14/Chapter 6.pdf · Chapter 6 Color Image Processing . Color Spectrum: six broad

© 2002 R. C. Gonzalez & R. E. Woods

Intensity Slicing

In general: Let [0,L-1] be the gray scale. l0: f(x,y)=0, represent black; lL-1: f(x,y)=L-1, represent white. Suppose that P planes perpendicular to the intensity axis are defined at levels l0 , l1,…., lp, 0<P<L-1, the P planes partition the gray scale into P+1 intervals V1, V2, ….., VP+1. Then f(x,y)=Ck , if f(x,y) ∈Vk Ck: color associated with the kth intensity interval Vk

Page 30: Chapter 6 Color Image Processing - Concordia Universityusers.encs.concordia.ca/~weiping/ELEC6641-W14/Chapter 6.pdf · Chapter 6 Color Image Processing . Color Spectrum: six broad

© 2002 R. C. Gonzalez & R. E. Woods

Intensity Slicing into Eight Color Regions

Picking out variations in intensity is easier in (b) than in (a).

Page 31: Chapter 6 Color Image Processing - Concordia Universityusers.encs.concordia.ca/~weiping/ELEC6641-W14/Chapter 6.pdf · Chapter 6 Color Image Processing . Color Spectrum: six broad

© 2002 R. C. Gonzalez & R. E. Woods

Intensity Slicing

Assigning yellow to gray level 255 and blue to all other gray levels.

Page 32: Chapter 6 Color Image Processing - Concordia Universityusers.encs.concordia.ca/~weiping/ELEC6641-W14/Chapter 6.pdf · Chapter 6 Color Image Processing . Color Spectrum: six broad

© 2002 R. C. Gonzalez & R. E. Woods

Use of Color to highlight rainfall levels

intensity corresponding to average monthly rainfall

color assigned to intensity values

color coded image

zoom of south American

Page 33: Chapter 6 Color Image Processing - Concordia Universityusers.encs.concordia.ca/~weiping/ELEC6641-W14/Chapter 6.pdf · Chapter 6 Color Image Processing . Color Spectrum: six broad

© 2002 R. C. Gonzalez & R. E. Woods

Gray Level to Color Transformations

red input of an RGB image

green input

blue input

Page 34: Chapter 6 Color Image Processing - Concordia Universityusers.encs.concordia.ca/~weiping/ELEC6641-W14/Chapter 6.pdf · Chapter 6 Color Image Processing . Color Spectrum: six broad

© 2002 R. C. Gonzalez & R. E. Woods

Use of Pseudocolor for highlighting Explosives Contained in Luggage

monochrome images of luggage

obtained with the non- linear transformation function in Fig.6.25(a)

obtained with the non- linear transformation function in Fig.6.25(b).

Page 35: Chapter 6 Color Image Processing - Concordia Universityusers.encs.concordia.ca/~weiping/ELEC6641-W14/Chapter 6.pdf · Chapter 6 Color Image Processing . Color Spectrum: six broad

© 2002 R. C. Gonzalez & R. E. Woods

Color Coding of Multispectral Images

Page 36: Chapter 6 Color Image Processing - Concordia Universityusers.encs.concordia.ca/~weiping/ELEC6641-W14/Chapter 6.pdf · Chapter 6 Color Image Processing . Color Spectrum: six broad

© 2002 R. C. Gonzalez & R. E. Woods

Example of Color Coding of Multispectral Images

Page 37: Chapter 6 Color Image Processing - Concordia Universityusers.encs.concordia.ca/~weiping/ELEC6641-W14/Chapter 6.pdf · Chapter 6 Color Image Processing . Color Spectrum: six broad

© 2002 R. C. Gonzalez & R. E. Woods

Pseudocolor Rendition of Jupiter Moon Io.

Pseudocolor image of Jupiter Moon Io.

a close-up region

Page 38: Chapter 6 Color Image Processing - Concordia Universityusers.encs.concordia.ca/~weiping/ELEC6641-W14/Chapter 6.pdf · Chapter 6 Color Image Processing . Color Spectrum: six broad

© 2002 R. C. Gonzalez & R. E. Woods

Basics of Full-color Image Processing

Each color pixel is a vector. In RGB color space,

=

=

),(),(),(

),(),(),(

),(yxByxGyxR

yxcyxcyxc

yx

B

G

Rc

(x,y): coordinate of the pixel Two conditions for vector-based processing being equivalent to per-color- component: 1. The process is applicable to both vectors and scalars. 2. The operation on each component of a vector must be independent to the other.

Page 39: Chapter 6 Color Image Processing - Concordia Universityusers.encs.concordia.ca/~weiping/ELEC6641-W14/Chapter 6.pdf · Chapter 6 Color Image Processing . Color Spectrum: six broad

© 2002 R. C. Gonzalez & R. E. Woods

Spatial Masks for gray-scale and RGB Images

Per-color-component and vector-based processing are equivalent.

Page 40: Chapter 6 Color Image Processing - Concordia Universityusers.encs.concordia.ca/~weiping/ELEC6641-W14/Chapter 6.pdf · Chapter 6 Color Image Processing . Color Spectrum: six broad

© 2002 R. C. Gonzalez & R. E. Woods

Formulation for Color Transformation

g(x,y) = T[f(x,y)] where f(x,y) is a color input image T is an operator on f over a spatial neighborhood of (x,y). or , i=1,2,….n. ),.....,,( 21 nii rrrTs =ri, si: variable denoting the color components of f(x,y) and g(x,y) at (x,y) n: # of color components, in RGB, n=3 {T1, T2, …….,Tn}: transformation or color mapping function

Page 41: Chapter 6 Color Image Processing - Concordia Universityusers.encs.concordia.ca/~weiping/ELEC6641-W14/Chapter 6.pdf · Chapter 6 Color Image Processing . Color Spectrum: six broad

© 2002 R. C. Gonzalez & R. E. Woods

A Full-color Image and Its Various Color-space Components

If we want to modify the intensity of this image, in CMYK color space, si=kri+(1-k), i=1,2,3,4 in RGB color space, si=kri, i=1,2,3 in HSI color space, s3=kr3 s1=r1 s2=r2

Page 42: Chapter 6 Color Image Processing - Concordia Universityusers.encs.concordia.ca/~weiping/ELEC6641-W14/Chapter 6.pdf · Chapter 6 Color Image Processing . Color Spectrum: six broad

© 2002 R. C. Gonzalez & R. E. Woods

The Result of Adjusting the Intensity (k=0.7)

I H,S

original image result image

Page 43: Chapter 6 Color Image Processing - Concordia Universityusers.encs.concordia.ca/~weiping/ELEC6641-W14/Chapter 6.pdf · Chapter 6 Color Image Processing . Color Spectrum: six broad

© 2002 R. C. Gonzalez & R. E. Woods

Color Complements Color complements are useful for enhancing detail that is embedded in dark regions of a color image.

Complements of Colors

Page 44: Chapter 6 Color Image Processing - Concordia Universityusers.encs.concordia.ca/~weiping/ELEC6641-W14/Chapter 6.pdf · Chapter 6 Color Image Processing . Color Spectrum: six broad

© 2002 R. C. Gonzalez & R. E. Woods

Color Complement Transformations

Page 45: Chapter 6 Color Image Processing - Concordia Universityusers.encs.concordia.ca/~weiping/ELEC6641-W14/Chapter 6.pdf · Chapter 6 Color Image Processing . Color Spectrum: six broad

© 2002 R. C. Gonzalez & R. E. Woods

Color Slicing

Color slicing is useful for highlighting a specific range of colors.

If the colors of interest are enclosed by a cube of width W and centered at a prototypical color with components (a1,a2,….,an), then,

=i

i rs

5.0 njanyjjWarif ≤≤>− 1]2

[otherwise i=1,2…..,n

If a sphere is used to specify the colors of interest, then

=i

i rs

5.0 ∑ >−=

n

jjj Rarif

1

20

2)(

otherwisei=1,2…..,n

0R : radius of the enclosing sphere

Page 46: Chapter 6 Color Image Processing - Concordia Universityusers.encs.concordia.ca/~weiping/ELEC6641-W14/Chapter 6.pdf · Chapter 6 Color Image Processing . Color Spectrum: six broad

© 2002 R. C. Gonzalez & R. E. Woods

An Illustration of Color Slicing

W=0.2549 R=0.1765

Page 47: Chapter 6 Color Image Processing - Concordia Universityusers.encs.concordia.ca/~weiping/ELEC6641-W14/Chapter 6.pdf · Chapter 6 Color Image Processing . Color Spectrum: six broad

© 2002 R. C. Gonzalez & R. E. Woods

Tonal Transformations

Tonal correction for flat image (boosting contrast) Tonal correction for light image Tonal correction for dark image

Page 48: Chapter 6 Color Image Processing - Concordia Universityusers.encs.concordia.ca/~weiping/ELEC6641-W14/Chapter 6.pdf · Chapter 6 Color Image Processing . Color Spectrum: six broad

© 2002 R. C. Gonzalez & R. E. Woods

Color Balancing

Page 49: Chapter 6 Color Image Processing - Concordia Universityusers.encs.concordia.ca/~weiping/ELEC6641-W14/Chapter 6.pdf · Chapter 6 Color Image Processing . Color Spectrum: six broad

© 2002 R. C. Gonzalez & R. E. Woods

Histogram Processing

Histogram equalization in the HSI color space

original image

after histogram equalization

after saturation adjustment for the left image

Page 50: Chapter 6 Color Image Processing - Concordia Universityusers.encs.concordia.ca/~weiping/ELEC6641-W14/Chapter 6.pdf · Chapter 6 Color Image Processing . Color Spectrum: six broad

© 2002 R. C. Gonzalez & R. E. Woods

Color Image Smoothing

Let Sxy denote the set of coordinates defining a neighborhood centered at (x,y) in an RGB color image. The average of the RGB component vectors in this neighborhood is:

∑=∈

xySyx

yxK

yx),(

),(1),( cc

=

xy

xy

xy

Syx

Syx

Syx

yxBK

yxGK

yxRK

),(

),(

),(

),(1

),(1

),(1

Page 51: Chapter 6 Color Image Processing - Concordia Universityusers.encs.concordia.ca/~weiping/ELEC6641-W14/Chapter 6.pdf · Chapter 6 Color Image Processing . Color Spectrum: six broad

© 2002 R. C. Gonzalez & R. E. Woods

An RGB Color Image and Its Red,Green,Blue Components

Page 52: Chapter 6 Color Image Processing - Concordia Universityusers.encs.concordia.ca/~weiping/ELEC6641-W14/Chapter 6.pdf · Chapter 6 Color Image Processing . Color Spectrum: six broad

© 2002 R. C. Gonzalez & R. E. Woods

HSI Components of the Previous Image

Page 53: Chapter 6 Color Image Processing - Concordia Universityusers.encs.concordia.ca/~weiping/ELEC6641-W14/Chapter 6.pdf · Chapter 6 Color Image Processing . Color Spectrum: six broad

© 2002 R. C. Gonzalez & R. E. Woods

Image Smoothing with a 5x5 Averaging Mask

processing on each RGB component

processing only the I component of HSI image

Page 54: Chapter 6 Color Image Processing - Concordia Universityusers.encs.concordia.ca/~weiping/ELEC6641-W14/Chapter 6.pdf · Chapter 6 Color Image Processing . Color Spectrum: six broad

© 2002 R. C. Gonzalez & R. E. Woods

Color Image Sharpening

Sharpening using the Laplacian in the RGB color system:

=∇

),(

),(

),(

)],([2

2

2

2

yxB

yxG

yxR

yxc

Page 55: Chapter 6 Color Image Processing - Concordia Universityusers.encs.concordia.ca/~weiping/ELEC6641-W14/Chapter 6.pdf · Chapter 6 Color Image Processing . Color Spectrum: six broad

© 2002 R. C. Gonzalez & R. E. Woods

Image Sharpening with the Laplacian

processing on each RGB component

processing on the intensity component of HSI image