Color Image Processing: Preview

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 19

18-11-2015

Preview

COLOR IMAGE PROCESSING

Digital Image Processing


Chapter 8

Preview
Light

Light is fundamental for color vision

Unless there is a source of light, there is nothing to see!

What do we see?

We do not see objects, but the light that has been

reflected by or transmitted through the objects

Light and EM waves


Physical properties of light
Light is an electromagnetic wave This distribution may indicate:

If its wavelength is comprised between    400 and 700 nm 1) a dominant wavelength (or frequency) which is the color

(visible spectrum), the wave    can be detected by the human of the light (hue),

eye and is called monochromatic light 2) brightness (luminance), intensity of the light (value ),

3) purity (saturation),    which describes the degree of


vividness.

1
18-11-2015

Spectrum of White Light Electromagnetic Spectrum

Visible light wavelength: from around 400 to 700 nm

1. For an achromatic (monochrome) light source,


there is only 1 attribute to describe the quality: intensity
1666 Sir Isaac Newton, 24 year old, discovered white light spectrum.
2. For a chromatic light source, there are 3 attributes to describe
the quality:
Radiance = total amount of energy flow from a light source (Watts)
Luminance = amount of energy received by an observer (lumens)
Brightness = intensity
(Images from Rafael C. Gonzalez and Richard E. (Images from Rafael C. Gonzalez and Richard E.
nd nd
Wood, Digital Image Processing, 2 Edition. Wood, Digital Image Processing, 2 Edition.

Sensitivity of Cones in the Human Eye

6-7 millions cones


in a human eye
- 65% sensitive to Red light
• The color that human perceive in an - 33% sensitive to Green light
- 2 % sensitive to Blue light
object = the light reflected from the
object
scene Primary colors:
Illumination source Defined CIE in 1931
Red = 700 nm
Green = 546.1nm
Blue = 435.8 nm

reflection CIE = Commission Internationale de l’Eclairage


eye (The International Commission on Illumination) (Images from Rafael C. Gonzalez and Richard E.
nd
Wood, Digital Image Processing, 2 Edition.

Primary and Secondary Colors Primary and Secondary Colors (cont.)

Additive primary colors: RGB


Primary use in the case of light sources
color such as color monitors
Secondary
colors RGB add together to get white

Primary Primary
color color Subtractive primary colors: CMY
use in the case of pigments in
printing devices
White subtracted by CMY to get
Black

(Images from Rafael C. Gonzalez and Richard E.


nd
Wood, Digital Image Processing, 2 Edition.

2
18-11-2015

Light and Color


The frequency ( or mix of frequencies ) of the light determines the color.
The amount of light(sheer quantity of photons ) is the intensity.
Three independent quantities are used to describe any particular color. :
hue, saturation, and lightness or brightness or intensity.
The hue is determined by the dominant wavelength.(the apparent color
of the light)

W hen we call an object


"red," we are referring to
its hue. Hue is
determined by the
dominant wavelength.

Light and Color Light and Color


The saturation of
a color ranges
Lightness or
from neutral to
brightness
brilliant. The circle
refers to the
on the right is a
amount of
more vivid red
light the
than the circle on
color
the left although
reflects or
both have the
transmits.
same hue.

The saturation is determined by the excitation purity , and depends


on the amount of white light mixed with the hue. A pure hue is fully
Finally, the intensity is determined by the actual amount of
saturated, i.e. no white light mixed in. Hue and saturation together
determine the chromaticity for a given color. light, with more light corresponding to more intense colors
( the total light across all frequencies).

Color Characterization CIE Chromaticity Diagram

Hue: dominant color corresponding to a dominant Trichromatic coefficients:


wavelength of mixture light wave
Saturation: Relative purity or amount of white light mixed
with a hue (inversely proportional to amount of white
light added)
Brightness: Intensity
y
Hue
Chromaticity
Saturation

amount of red (X), green (Y) and blue (Z) to form any particular
color is called tristimulus.
Points on the boundary are
fully saturated colors
x
(Images from Rafael C. Gonzalez and Richard E.
nd
Wood, Digital Image Processing, 2 Edition.

3
18-11-2015

Color Gamut of Color Monitors and Printing Devices


Color Gamut of Color Monitors and Printing Devices

Color Monitors

Printing devices

(Images from Rafael C. Gonzalez and Richard E.


nd
Wood, Digital Image Processing, 2 Edition.

Color Fundamentals (con’t) Color Models

 The purpose of a color model (also called color space or color system)
 Tri-stimulus values: The amount of Red, Green and
Blue needed to form any particular color is to facilitate the specification of colors in some standard, generally
Denoted by: X, Y and Z accept way.
 RGB (red, green, blue) : monitor, video camera.
 Tri-chromatic coefficient:
 CMY(cyan, magenta, yellow),CMYK (CMY, black) model for color
printing.

 and HSI model, which corresponds closely with the way humans
describe and interpret color.

RGB (red, green, blue)


The RGB colour space is related to human vision through the
tristimulus theory of colour vision.

The RGB is an additive colour model. The primary colours red,


green    and blue are combined to reproduce other colours.

In the RGB colour space, a colour is represented by a triplet (r,g,b)

r gives the intensity of the red component


g gives the intensity of the green component
b gives the intensity of the blue component

Here we assume that r,g,b are real numbers in the interval [0,1].
You will often see the values of r,g,b as integers in the interval
[0,255].

4
18-11-2015

The RGB Color Spaces


RGB Color model Purpose of color models: to facilitate the specification of colors in
some standard

RGB color models:


- based on Cartesian
coordinate system

Source: www.mitsubishi.com

Active displays, such as computer monitors and television sets, emit


combinations of red, green and blue light. This is an additive color model
25 (Images from Rafael C. Gonzalez and Richard E.
nd
Wood, Digital Image Processing, 2 Edition.

RGB Color Cube RGB Color Model

R = 8 bits
Color depth 24 bits Red fixed at 127
G = 8 bits = 16777216 colors
B = 8 bits

Hidden faces
of the cube

(Images from Rafael C. Gonzalez and Richard E. (Images from Rafael C. Gonzalez and Richard E.
nd nd
Wood, Digital Image Processing, 2 Edition. Wood, Digital Image Processing, 2 Edition.

RGB Color Model (cont.) RGB Color Model (cont.)

• Eight-bit color also exists, 256 colors total.


• These are called “web-safe” colors, because they are sure to render
accurately on anyone’s monitor.
• • Nowadays we don’t have to worry about that as much.
Most modern computer monitors can transmit “true color,” or 24-bit
– (Below: 8-bit vs. 24-bit color.)
color. This means each “channel” (R, G, or B) contains 8 bits per
channel that can transmit color.

• Eight bits means the channel can make eight combinations of on or off
of the color, per pixel, 256 colors total. You have three channels. How
many colors can be generated?

• 256 x 256 x 256=16,777,216 possible colors.

5
18-11-2015

Safe RGB Colors RGB Safe-color Cube


Safe RGB colors: a subset of RGB colors.
There are 216 colors common in most operating systems.

The RGB Cube is divided into


6 intervals on each axis to achieve
the total 63 = 216 common colors.
However, for 8 bit color
representation, there are the total
256 colors. Therefore, the remaining
40 colors are left to OS.

(Images from Rafael C. Gonzalez and Richard E. (Images from Rafael C. Gonzalez and Richard E.
nd nd
Wood, Digital Image Processing, 2 Edition. Wood, Digital Image Processing, 2 Edition.

CMY Color model

• Additive color won’t work for printing because we can’t begin


with black.
• W e must begin with a piece of paper, and that’s usually
white.
• W hite, as we know, is all colors. So we can’t add to all colors.
W e must subtract.
• Furthermore, an offset printing press can’t generate the
enormous number of colors available on a computer screen.
• W e need to run a piece of paper through the press for each
ink.

CMY Color model CMY Color model


• The press below has four heads, one for each ink in • Printed color, therefore, is based on the subtractive system.
the CMYK system.
• W hile the additive primaries (used to generate all colors )
are RGB, beginning with black…

• …the subtractive primaries are Cyan, Magenta, Yellow and


Black (CMYK), and begin with white.

• Cyan=blue-green. Magenta=red-blue. Yellow=red-green.

• Note the relationship between the additive and subtractive


primaries.

6
18-11-2015

CMY Color model CMY Color model


• You can actually project the additive colors to produce the C = Cyan
subtractive. M = Magenta
Y = Yellow
K = Black

CMY Color model CMY Color model

• Why?
Pigments absorb light

• Thinking: Source: www.hp.com

the Color Filters


• Question:
Yellow + Cyan=? Passive displays, such as color inkjet printers, absorb light instead of
emitting it. Combinations of cyan, magenta and yellow inks are used. This
is a subtractive color model. 40

The CMY and CMYK Color Spaces


CMY
CMY cartridges for colour printers.

7
18-11-2015

The CMY and CMYK Color Models


The conversion from RGB to CMY is given by the formula

 Cyan, Magenta and Yellow are the secondary colors


of light
 Most devices that deposit colored pigments on
Example 11.2: The red colour is written in RGB as (1,0,0). In CMY it is
paper, such as color printers and copiers, require written as
CMY data input.

that is, magenta and yellow.

CMYK Color model


Example 11.3: The magenta is written in CMY as (0,1,0). In RGB it is
written as

giving,

The image on the left was printed with only CMY inks
that is, red and blue. Black inks add contrast and depth to image on the image on
the right

CMYK Color model


CMYK Color model
• Subtractive primaries are based on ink colors of CMYK.
• Black is abbreviated “K” by tradition, perhaps because it is the “key” color.
• In color printing, you need black to make the other colors vibrant and For printing and graphics art industry, CMY is not enough; a
snappy. fourth primary, K which stands for black, is added.
• This is why the subtractive process is also called the four-color process,
producing color separations, or “seps.” Conversions between RGB and CMYK are possible, although
• Colors used are called the process colors.
they require some extra processing.

8
18-11-2015

Relationship Between RGB and HSI Color Models Relationship Between RGB and HSI Color Models

HSI color model HSI Color Model

• Will you describe a color using its R, G, B components? RGB, CMY models are not good for human interpreting
• Human describe a color by its hue, saturation, and
brightness HSI Color model:
Hue: Dominant color
– Hue : color attribute
Color carrying
– Saturation : purity of color (white->0, primary color->1) Saturation: Relative purity (inversely proportional information
– Brightness : achromatic notion of intensity to amount of white light added)

Intensity: Brightness

(Images from Rafael C. Gonzalez and Richard E.


nd
Wood, Digital Image Processing, 2 Edition.

Relationship Between RGB and HSI Color Models

HSI Color Model

H
dominant
wavelength

S
purity
% white

I
Intensity
RGB HSI
Source: http://www.cs.cornell. edu/courses/cs631/1999sp/
53 (Images from Rafael C. Gonzalez and Richard E.
nd
Wood, Digital Image Processing, 2 Edition.

9
18-11-2015

Hue and Saturation on Color Planes


HSI Color Model
• Hueis defined as an angle
– 0 degrees is RED
– 120 degrees is GREEN
– 240 degrees is BLUE

• Saturation is defined as the percentage of distance from


the center of the HSI triangle to the pyramid surface.
– Values range from 0 to 1.

• Intensity is denoted as the distance “up” the axis from


1. A dot is the plane is an arbitrary color
black.
2. Hue is an angle from a red axis.
– Values range from 0 to 1
3. Saturation is a distance to the point.
56

HSI Color Model (cont.) HSI Color Model

Intensity is given by a position on the vertical axis. Intensity is given by a position on the vertical axis.

Example: HSI Components of RGB Cube Converting Colors from RGB to HSI

RGB Cube

Hue Saturation Intensity


(Images from Rafael C. Gonzalez and Richard E.
nd
Wood, Digital Image Processing, 2 Edition.

10
18-11-2015

Converting Colors from HSI to RGB Example: HSI Components of RGB Colors
RG sector: GB sector:

RGB
Image Hue

BR sector:

Saturation Intensity

(Images from Rafael C. Gonzalez and Richard E.


nd
Wood, Digital Image Processing, 2 Edition.

Example: Manipulating HSI Components Color Image Processing


RGB There are 2 types of color image processes
Image Hue Hue Saturation
1. Pseudocolor image process: Assigning colors to gray
values based on a specific criterion. Gray scale images to be processed
may be a single image or multiple images such as multispectral images

2. Full color image process: The process to manipulate real


color images such as color photographs.

Saturation Intensity Intensity RGB


Image
(Images from Rafael C. Gonzalez and Richard E.
nd
Wood, Digital Image Processing, 2 Edition.

Pseudocolor Image Processing Intensity Slicing or Density Slicing


Formula:
Pseudo color = false color : In some case there is no “color” concept C1 = Color No. 1
for a gray scale image but we can assign “false” colors to an image. C2 = Color No. 2

Why we need to assign colors to gray scale image?

Answer: Human can distinguish different colors better than different


shades of gray.
Color

T C2

C1

0 T L-1
Intensity
A gray scale image viewed as a 3D surface.
(Images from Rafael C. Gonzalez and Richard E.
nd
Wood, Digital Image Processing, 2 Edition.

11
18-11-2015

Intensity Slicing Example Multi Level Intensity Slicing

Ck = Color No. k
An X-ray image of a weld with cracks l k = Threshold level k

Color
Ck

Ck-1

C3

After assigning a yellow color to pixels with C2


value 255 and a blue color to all other pixels. C
1
0 l1 l2 l3 lk-1 lk
L-1
Intensity
(Images from Rafael C. Gonzalez and Richard E.
nd
Wood, Digital Image Processing, 2 Edition.

Multi Level Intensity Slicing Example Color Coding Example


Ck = Color No. k A unique color is assigned to
l k = Threshold level k each intensity value.

Gray-scale image of average


monthly rainfall.

Color
map

An X-ray image of the Picker After density slicing into 8 colors


Thyroid Phantom. Color coded image South America region
(Images from Rafael C. Gonzalez and Richard E. (Images from Rafael C. Gonzalez and Richard E.
nd nd
Wood, Digital Image Processing, 2 Edition. Wood, Digital Image Processing, 2 Edition.

Gray Level to Color Transformation Gray Level to Color Transformation Example

An X-ray image An X-ray image of a


Assigning colors to gray levels based on specific mapping functions
of a garment bag garment bag with a
simulated explosive
Red component device

Gray scale image


(Images from Rafael C.
Green component Gonzalez and Richard
E. Wood, Digital Image
nd
Processing, 2 Edition. Transformations

Blue component
Color
coded
images

(Images from Rafael C. Gonzalez and Richard E.


nd
Wood, Digital Image Processing, 2 Edition.

12
18-11-2015

Gray Level to Color Transformation Example Pseudocolor Coding

An X-ray image An X-ray image of a Used in the case where there are many monochrome images such as multispectral
of a garment bag garment bag with a satellite images.
simulated explosive
device

Transformations (Images from Rafael C.


Gonzalez and Richard
E. Wood, Digital Image
nd
Processing, 2 Edition.

Color
coded
images

(Images from Rafael C. Gonzalez and Richard E.


nd
Wood, Digital Image Processing, 2 Edition.

Pseudocolor Coding Example


Visible blue Visible green
= 0.45-0.52 mm = 0.52-0.60 mm
Color theory Max water penetration Measuring plant Color composite images
1 2
Some general guidelines for choosing color:
• Differences will be emphasized. For example, yellow
surrounded by green will tend to appear more yellow;
green surrounded by yellow will tend to appear more
green. This is the rule of simultaneous contrast.
3 4 Red = 1 Red = 1
Green = 2 Green = 2
Blue = 3 Blue = 4

Visible red Near infrared Washington D.C. area


= 0.63-0.69 mm = 0.76-0.90 mm
(Images from Rafael C. Gonzalez and Richard E.
Plant discrimination Biomass and shoreline mapping nd
Wood, Digital Image Processing, 2 Edition.

Pseudocolor Coding Example Basics of Full-Color Image Processing


2 Methods:
1. Per-color-component processing: process each component separately.
2. Vector processing: treat each pixel as a vector to be processed.
Psuedocolor rendition
Example of per-color-component processing: smoothing an image
of Jupiter moon Io
By smoothing each RGB component separately.

Yellow areas = older sulfur deposits.


Red areas = material ejected from
active volcanoes.

A close-up

(Images from Rafael C. Gonzalez and Richard E. (Images from Rafael C. Gonzalez and Richard E.
nd nd
Wood, Digital Image Processing, 2 Edition. Wood, Digital Image Processing, 2 Edition.

13
18-11-2015

Example: Full-Color Image and Variouis Color Space Components     Color Transformation
Use to transform colors to colors.
Color image
Formulation:

CMYK components f(x,y) = input color image, g(x,y) = output color image
T = operation on f over a spatial neighborhood of (x,y)

When only data at one pixel is used in the transformation, we


RGB components can express the transformation as:

i= 1, 2, …, n

HSI components
Where r i = color component of f(x,y) For RGB images, n = 3
(Images from Rafael C. Gonzalez and Richard E.
si = color component of g(x,y)
nd
Wood, Digital Image Processing, 2 Edition.

Example: Color Transformation Color Complements


Formula for RGB: Color complement replaces each color with its opposite color in the
color circle of the Hue component. This operation is analogous to
image negative in a gray scale image.

Formula for HSI: k = 0.7

Color circle
Formula for CMY: I H,S

These 3 transformations give


the same results.
(Images from Rafael C. Gonzalez and Richard E. (Images from Rafael C. Gonzalez and Richard E.
nd nd
Wood, Digital Image Processing, 2 Edition. Wood, Digital Image Processing, 2 Edition.

Color Complement Transformation Example Color Slicing Transformation

We can perform “slicing” in color space: if the color of each pixel


is far from a desired color more than threshold distance, we set that
color to some specific color such as gray, otherwise we keep the
original color unchanged.

Set to gray

Keep the original


i= 1, 2, …, n color
or

Set to gray

Keep the original


color
i= 1, 2, …, n
(Images from Rafael C. Gonzalez and Richard E.
nd
Wood, Digital Image Processing, 2 Edition.

14
18-11-2015

Color Slicing Transformation Example Tonal Correction Examples


In these examples, only
After color slicing brightness and contrast are
adjusted while keeping color
unchanged.
This can be done by
using the same transformation
for all RGB components.

Original image
Contrast enhancement

Power law transformations

(Images from Rafael C. Gonzalez and Richard E. (Images from Rafael C. Gonzalez and Richard E.
nd nd
Wood, Digital Image Processing, 2 Edition. Wood, Digital Image Processing, 2 Edition.

Color Balancing Correction Examples Histogram Equalization of a Full-Color Image

 Histogram equalization of a color image can be performed by


Color imbalance: primary color components in white area
adjusting color intensity uniformly while leaving color unchanged.
are not balance. We can measure these components by
using a color spectrometer.
 The HSI model is suitable for histogram equalization where only
Color balancing can be Intensity (I) component is equalized.
performed by adjusting
color components separately
as seen in this slide.

where r and s are intensity components of input and output color image.
(Images from Rafael C. Gonzalez and Richard E.
nd
Wood, Digital Image Processing, 2 Edition.

Histogram Equalization of a Full-Color Image Color Image Smoothing


Original image 2 Methods:
1. Per-color-plane method: for RGB, CMY color models
Smooth each color plane using moving averaging and
the combine back to RGB

After histogram After increasing


equalization saturation component

2. Smooth only Intensity component of a HSI image while leaving


(Images from Rafael C.
H and S unmodified.
Gonzalez and Richard E.
Wood, Digital Image
nd
Processing, 2 Edition. Note: 2 methods are not equivalent.

15
18-11-2015

Color Image Smoothing Example (cont.) Color Image Smoothing Example (cont.)

Color image Red Color image

HSI Components

Hue Saturation Intensity

Green Blue

(Images from Rafael C. Gonzalez and Richard E. (Images from Rafael C. Gonzalez and Richard E.
nd nd
Wood, Digital Image Processing, 2 Edition. Wood, Digital Image Processing, 2 Edition.

Color Image Smoothing Example (cont.) Color Image Smoothing Example (cont.)

Difference between
smoothed results from 2
methods in the previous
slide.

Smooth all RGB components Smooth only I component of HSI


(faster)

(Images from Rafael C. Gonzalez and Richard E. (Images from Rafael C. Gonzalez and Richard E.
nd nd
Wood, Digital Image Processing, 2 Edition. Wood, Digital Image Processing, 2 Edition.

Color Image Sharpening Color Image Sharpening Example (cont.)


We can do in the same manner as color image smoothing:
1. Per-color-plane method for RGB,CMY images
2. Sharpening only I component of a HSI image Difference between
sharpened results from 2
methods in the previous
slide.

Sharpening all RGB components Sharpening only I component of HSI


(Images from Rafael C. Gonzalez and Richard E.
nd
Wood, Digital Image Processing, 2 Edition.

16
18-11-2015

Color Segmentation Color Segmentation in HSI Color Space

2 Methods: Color image Hue


1. Segmented in HSI color space:
A thresholding function based on color information in H and S
Components. We rarely use I component for color image
segmentation.

2. Segmentation in RGB vector space: 1 2


A thresholding function based on distance in a color vector space.

3 4

Saturation Intensity (Images from Rafael C.


Gonzalez and Richard E.
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image
nd nd
Wood, Digital Image Processing, 2 Edition. Processing, 2 Edition.

Color Segmentation in HSI Color Space (cont.) Color Segmentation in HSI Color Space (cont.)
Binary thresholding of S component
Product of 2 and 5
with T = 10%

5 6

Color image Segmented results of red pixels


Red pixels

7 8
(Images from Rafael C. (Images from Rafael C.
Gonzalez and Richard E. Gonzalez and Richard E.
Wood, Digital Image
nd
Histogram of 6 Segmentation of red color pixels Wood, Digital Image
nd
Processing, 2 Edition. Processing, 2 Edition.

Color Segmentation in RGB Vector Space Example: Segmentation in RGB Vector Space

Color image

(Images from Rafael C. Gonzalez and Richard E.


nd
Wood, Digital Image Processing, 2 Edition.
Reference color cT to be segmented
1. Each point with (R,G,B) coordinate in the vector space represents
one color.
2. Segmentation is based on distance thresholding in a vector space
Results of segmentation in
RGB vector space with Threshold
value
T = 1.25 times the SD of R,G,B values
c T= color to be segmented. In the box
D(u,v) = distance function
c(x,y) = RGB vector at pixel (x,y). (Images from Rafael C. Gonzalez and Richard E.
nd
Wood, Digital Image Processing, 2 Edition.

17
18-11-2015

Gradient of a Color Image Gradient of a Color Image (cont.)


Since gradient is define only for a scalar image, there is no concept One way to compute the maximum rate of change of a color image
of gradient for a color image. We can’t compute gradient of each which is close to the meaning of gradient is to use the following
color component and combine the results to get the gradient of a color formula: Gradient computed in RGB color space:
image.
Red Green Blue We see
2 objects.

We see
4 objects.

Edges

(Images from Rafael C. Gonzalez and Richard E.


nd
Wood, Digital Image Processing, 2 Edition.

Gradient of a Color Image Example Gradient of a Color Image Example


2
Red Green Blue
Original Obtained using
image the formula
in the previous
slide

Sum of Gradients of each color component


gradients of Difference
each color between
component 22 and 33

(Images from Rafael C. Gonzalez and Richard E. (Images from Rafael C. Gonzalez and Richard E.
nd nd
Wood, Digital Image Processing, 2 Edition. Wood, Digital Image Processing, 2 Edition.

Noise in Color Images Noise in Color Images


Noise can corrupt each color component independently.
Hue Saturation Intensity
AWGN sh2=800 AWGN s h2=800

AWGN sh2=800
Noise is less
noticeable
in a color
image

(Images from Rafael C.


Gonzalez and Richard E.
Wood, Digital Image (Images from Rafael C. Gonzalez and Richard E.
nd nd
Processing, 2 Edition. Wood, Digital Image Processing, 2 Edition.

18
18-11-2015

Noise in Color Images Color Image Compression


Salt & pepper noise Hue Original image
in Green component

Saturation Intensity

JPEG2000 File

(Images from Rafael C. Gonzalez and Richard E.


nd
After lossy compression with ratio 230:1 (Images from Rafael C. Gonzalez and Richard E.
nd
Wood, Digital Image Processing, 2 Edition. Wood, Digital Image Processing, 2 Edition.

19

You might also like