Digital Image Analysis and Processing CPE 0907544 CPE 0907544 - - PowerPoint PPT Presentation

digital image analysis and processing cpe 0907544 cpe
SMART_READER_LITE
LIVE PREVIEW

Digital Image Analysis and Processing CPE 0907544 CPE 0907544 - - PowerPoint PPT Presentation

Digital Image Analysis and Processing CPE 0907544 CPE 0907544 Color Image Processing Chapter 6 Sections : 6 1 6 6 Sections : 6.1 6.6 D I Dr. Iyad Jafar d J f Outline Introduction Color Fundamentals Color Models


slide-1
SLIDE 1

Digital Image Analysis and Processing CPE 0907544 CPE 0907544

Color Image Processing

Chapter 6 Sections : 6 1 – 6 6

D I d J f

Sections : 6.1 – 6.6

  • Dr. Iyad Jafar
slide-2
SLIDE 2

Outline

Introduction Color Fundamentals Color Models Pseudocolor Image Processing

F ll C l P

Full Color Processing

S thi d Sh i i C l

Smoothing and Sharpening in Color

Images g

2

slide-3
SLIDE 3

Introduction

Why color image processing?

C l r is

erf l in identif in and e tractin bjects

Color is powerful in identifying and extracting objects Humans can distinguish thousands of color shades and

intensities when compared to only two dozens of shades intensities when compared to only two dozens of shades

  • f gray

T

wo major processing techniques

Full color processing

Full color processing

The image is acquired using full –color sensor (TV camera, color

scanner) Pseudo color processing

Assign colors to monochromatic intensity image

3

slide-4
SLIDE 4

Color Fundamentals

Color perception in humans is not fully understood

Th h i l f l i b d i l

The physical nature of color is based on experimental

and theoretical results Si I N 1666

Smooth

Sir Isaac Newton, 1666

Smooth transition between colors

C l h h d d b h

Colors that humans perceive are determined by the

nature of the light that objects reflect

4

slide-5
SLIDE 5

Color Fundamentals

Achromatic light

Intensity is the only attribute that describes it

y y

Light that is void of color Gray level (shades of gray)

y ( g y)

Chromatic light

Spans the electromagnetic spectrum from approximately

p g p pp y 400 to 700 nm

Quantities that describe a chromatic light source:

radiance, illumination, and brightness

Cones in the eye are responsible for color vision

Can be divided based on their sensitivity/absorption of light into

three types: Red, Green, and Blue cones

Based on this experimental classification of the cones, these

Based on this experimental classification of the cones, these colors are called the primary colors

5

slide-6
SLIDE 6

Color Fundamentals

Chromatic light

There is no single frequency that describe these primary

colors

Standard values set by

h CIE i 1931 the CIE in 1931

700 nm for Red 546 1 nm for Green 546.1 nm for Green 435.8 nm for Blue Primary does not mean we can generate all colors by mixing

these frequencies. Instead, we have to vary the frequencies of these primary colors these primary colors

6

slide-7
SLIDE 7

Color Fundamentals

Chromatic light

Additive Primaries (primary colors of light)

(p y g )

Primary colors (R,G,B) can be added to produce secondary

colors; magenta (M), cyan (C) , and yellow (Y)

Mixing the three primaries in the right intensities produce white Mixing the three primaries, in the right intensities, produce white

Subtractive Primaries (primary colors of pigment)

Secondary colors (RGB) can be added to produce primary colors;

Secondary colors (RGB) can be added to produce primary colors; red, green, and blue

Mixing the three secondary colors, in the right intensities,

d bl k produce black

7

slide-8
SLIDE 8

Color Fundamentals

Three attributes are used to distinguish one color

from another from another

Hue: a measure of the dominant wavelength in a mixture

  • f light waves
  • f light waves

Saturation: refers to the relative purity or the amount of

white light mixed with the hue. The pure spectrum g p p colors (red) are fully saturated. Colors such as pink (red and white) and lavender (white and violet) are less d saturated

Brightness: embodies the achromatic notion of intensity

H d k h ll d

Hue

and saturation taken together are called chromaticity . Thus, any color can be characterized by it b i ht d h ti it its brightness and chromaticity.

8

slide-9
SLIDE 9

Color Fundamentals

The amount of red, green, and blue required to

form any particular light are called the tristimulus form any particular light are called the tristimulus values, X,Y, and Z, respectively.

W

if l b it t i h ti

We can specify any color by its trichromatic

coefficients

X Y Z x y z X Y Z X Y Z X Y Z

  • In order to determine the appropriate tristimulus

1 x y z

  • In order to determine the appropriate tristimulus

values for any color, we use experimental tables or curves, e.g. the chromaticity diagram curves, e.g. the chromaticity diagram

9

slide-10
SLIDE 10

Color Fundamentals

The CIE Chromaticity

Diagram Diagram

Very useful in color mixing It shows the color composition

It shows the color composition as a function of x (red) and y(green)

T

  • determine z (blue) value for

any color, use z = 1 – (x+y)

Colors on the boundary are Colors on the boundary are

fully saturated

Any point not on the boundary

y p y is a mix of colors

The

point

  • f

equal energy d fi l hi defines color white

10

slide-11
SLIDE 11

Color Fundamentals

The CIE Chromaticity

Diagram

Color Gamut used by RGB monitors

Diagram

A line connecting two points in

the diagram defines all color g variations that can be produced by combining these color additively additively

Three points in the diagram

define a triangle. The points g p inside the triangle represent all possible colors that can be bt i d b i i diff t

  • btained by mixing different

intensities of the three colors

Color Gamut

11

Color Gamut used by color printers

slide-12
SLIDE 12

Color Models

Color

models/spaces/systems facilitate the specification of colors following some standard way p g y

A color model specifies a subspace within some

coordinate system in which each color is coordinate system in which each color is represented as a point

Classification of color models Classification of color models Hardware-oriented

Generate colors in hardware Generate colors in hardware RGB, CMY, and CMYK

Software oriented Software-oriented

The ultimate use is manipulation and processing of

color images color images

HSI

12

slide-13
SLIDE 13

The RGB Color Model

The RGB color model is based on the Cartesian

coordinate system. Each color is represented by its y p y primary spectral components (R,G,B)

The subspace of interest is the unit cube. Colors are

The subspace of interest is the unit cube. Colors are represented by points on or inside the cube

13

slide-14
SLIDE 14

The RGB Color Model

Images represented in the RGB color model consist of

three component images. p g

When fed into the RGB monitor, they combine to

produce the composite color image p p g

14

slide-15
SLIDE 15

The RGB Color Model

Full RGB Colors

Each of the R,G, and B images are 8-bit,

Each of the R,G, and B images are 8 bit,

The number of bits per pixel in the color image (pixel

depth) is 24-bit p )

Total number of colors is 224 = 16 M

15

slide-16
SLIDE 16

The RGB Color Model

Safe RGB Colors

Uses 256 colors

Uses 256 colors

Colors are chosen such that

they can be reproduced y p faithfully independent

  • f

hardware

Actually,

40 colors are processed differently by different operating systems different operating systems

A safe color is formed by

three RGB values However, three RGB values. However, the values can be any of the following six values:: 0,

Valid colors are on the surface only

51,102,153,204, or 255.

16

y

slide-17
SLIDE 17

The CMY Color Model

Uses secondary colors, or the primary colors of

pigments, cyan, magenta, and yellow to represent colors

Used commonly in color printers Conversion between RGB and CMY 1 C R ⎡ ⎤ ⎡ ⎤ ⎡ ⎤ 1 1 1 C R M G Y B ⎡ ⎤ ⎡ ⎤ ⎡ ⎤ ⎢ ⎥ ⎢ ⎥ ⎢ ⎥

⎥ ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ ⎣ ⎦ ⎣ ⎦ ⎣ ⎦

Combining the three secondary colors should produce

black.

⎣ ⎦ ⎣ ⎦ ⎣ ⎦

black.

In practice, they produce muddy black. To produce black, a

fourth color, black, is added. , ,

This is known as the CMYK, or four-color printing system

17

slide-18
SLIDE 18

The CMY Color Model

18

slide-19
SLIDE 19

The HSI Color Model

The RGB and CMY models are well suited for hardware

implementation

It is often hard to use them in describing colors the way

humans do

Humans describe color by its hue (H), saturation (S), and

intensity (I) Th d i h b i f h HSI l d l

These descriptors are the basis of the HSI color model

19

slide-20
SLIDE 20

The HSI Color Model

Converting RGB colors into HSI

Given an image in RGB format, with normalized R, G, and B values, we can compute the HSI components by

The Hue Component

360 θ , if B G H θ if B>G

⎨ ⎩

  • 12

1 2 1 2

( R G ) ( R B ) θ cos ( R G ) ( R B )( R G )

⎬ ⎡ ⎤

⎪ ⎣ ⎦

θ is measured with respect to the red axis

360 θ , if B>G

2

( R G ) ( R B )( R G ) ⎡ ⎤

⎪ ⎣ ⎦ ⎩ ⎭

The Saturation Component

3 1 S min( R,G,B )

The Intensity Component

( , , ) R G B

  • R

G B

  • 20

3 R G B I

slide-21
SLIDE 21

The HSI Color Model

Converting HSI colors into RGB

Given an image in HSI format , we have three different cases based on the value of H

S cos H ⎡ ⎤

RG sector (0o≤H<120o)

1 60 1 3

  • S cos H

R I cos( H ) B ( S ) I G I ( R B ) ⎡ ⎤

  • GB sector

(120 H 240 )

( ) 120 1 1

  • H

H , R ( S ) I S cos H G = I

(120o≤H<240o)

240 1

  • H

H G ( S ) I

1 60 3

  • G

I cos( H ) B I ( R G )

  • BR Sector

(240o≤H ≤ 360o)

240 1 1 60

  • H

H , G ( S ) I S cos H B = I cos( H )

21

3 R I ( B G )

slide-22
SLIDE 22

The HSI Color Model

Manipulating HSI Component Images

Hue Saturation Intensity

22

Hue Saturation Intensity Pure colors

slide-23
SLIDE 23

Color Image Red Channel Green Channel Blue Channel Red Channel Green Channel Blue Channel Hue Channel Saturation Channel Intensity Channel

23

slide-24
SLIDE 24

The HSI Color Model

Manipulating HSI Component Images

Once the components are decoupled, we can operate on one or

more of these components to change the image appearance

Hue in the blue and green regions is set to g g zero I t it f th Original Image Intensity of the white region multiplied by 0.5 24 Saturation of cyan region is multiplied by 0.5

slide-25
SLIDE 25

Pseudo Color Processing

Pseudo or false color processing refers to the

process of assigning color to gray values based on p g g g y some criterion

The idea is to take advantage of the capability of the

human eye to distinguish thousands of colors when human eye to distinguish thousands of colors when compared to about two dozens of shades of gray

Two principle approaches

I i Sli i

Intensity Slicing Intensity to Color Transformation

25

slide-26
SLIDE 26

Pseudo Color Processing

Intensity Slicing

This technique is similar to graylevel slicing discussed in

This technique is similar to graylevel slicing discussed in Chapter 3. However, in this technique, a single graylevel value or set of graylevel values are mapped to some color values

26

slide-27
SLIDE 27

Pseudo Color Processing

Intensity Slicing

Example 6.1 – arbitrary intensity slicing using 8 colors

Note how regions that appear of constant intensity have mapped to variable regions

Intensity Slicing Using Slicing Using Eight Colors

Example – intensity slicing based on some physical meaning

Cracks in a weld a weld Intensity with T wo colors 27

slide-28
SLIDE 28

Pseudo Color Processing

Intensity to Color Transformation

The basic idea is to transform the monochrome image

into three composite images (RGB) using different transformation functions

It is a generalization of intensity slicing where we can

achieve a wider range of pseudo color enhancement

28

slide-29
SLIDE 29

Pseudo Color Processing

Intensity to Color Transformation

Explosive 29

slide-30
SLIDE 30

Full-Color Processing

Color processing can be performed by

Operating on each color channel separately then compose the color

image image

Operating on color pixels directly

ColorTransformations

We can model color transformation as

  • g( x,y )

T f ( x,y )

  • Note that f(x,y) here represents a triplet or quartets (three or four

values)

In general, color transformations are of the form

In general, color transformations are of the form n is the number of color components

1 2 3 i i n

s T ( r ,r ,r ,...,r ) , i = 1,2,3,..., n

  • p

Each transformation function Ti operates on different channel ri

to produce si Th l i bi d i i l i

The result is combined into a single image

30

slide-31
SLIDE 31

Full-Color Processing

Example 6.2. Modify the intensity component using g(x,y)

= k*f(x,y) where 0<k<1

This can be done in any color space

In HSI, multiply the intensity component by k only In RGB, use si = k*ri, i = 1,2,3 In CMY, use si = k*ri +(1-k), i = 1,2,3

Wh h ?

Which one to use ?

31

slide-32
SLIDE 32

Full-Color Processing

Color Complements

Analogous to gray-scale negatives Useful in enhancing small dark details embedded in bright

regions or the opposite

Use the Hue color circle Use the Hue color circle

32

slide-33
SLIDE 33

Full-Color Processing

Color Slicing

Analogous to gray-scale slicing

Analogous to gray scale slicing

Approach: map the colors outside the range of interest

to some neutral non-prominent color p

To define the colors that fall in the range of interest we

may use a hypersphere with radius Ro

2 2

0 5

n i i

  • . ,

( r a ) R s i=1 2 3 n ⎧

1 j i i

s i=1,2,3...,n r , otherwise

⎪ ⎩

ai represents the color components at the center of

sphere (prototypical color)

33

slide-34
SLIDE 34

Full-Color Processing

Example 6.3. Color Slicing highlight the strawberries in the image

Prototypical color = (0.6863,0.1608,0.1922) Radius = 0.1765

34

slide-35
SLIDE 35

Full-Color Processing

Color Correction

35

slide-36
SLIDE 36

Full-Color Processing

Histogram Processing

Techniques developed for graylevels can be applied to color images

but with caution

It is unwise to apply histogram equalization to the color channels

independently as this results in erroneous color independently as this results in erroneous color

Instead, operate on the color intensities and leave their hues

unchanged

36

Equalization of the intensity channel only Equalization of the intensity channel followed by increasing the saturation values

slide-37
SLIDE 37

Full-Color Processing

Smoothing in Color Images We can perform smoothing on each color channel in the

p g RGB model or on the intensity channel in the HSI model

Using HSI might be more suitable as it doesn’t affect the

colors

37 Original Result of Smoothing R, G, and B channels Separately Result of Smoothing I in the HSI Image

slide-38
SLIDE 38

Full-Color Processing

Sharpening in Color Images

Original Result of Sharpening R, G, and B channels Separately Result of Sharpening I in the HSI Image 38

slide-39
SLIDE 39

Related Matlab Functions

rgbTohsi

rgbTohsi

hsiTorgb rgbTocmy cmyTorgb Example_Color_Smoothing Example Color Sharpening Example_Color_Sharpening

39