Color Models

advertisement
Computer Graphics
&
Image Processing
Chapter # 6
Color Image Processing
ALI JAVED
Lecturer
SOFTWARE ENGINEERING DEPARTMENT
U.E.T TAXILA
Email:: ali.javed@uettaxila.edu.pk
Office Room #:: 7
Color Image Processing
 The use of color Image Processing is motivated
by two principal factors:
 Color is a powerful descriptor
 Humans can distinguish between thousands of color
shades and intensities compared to about only two
dozen shades of gray
Full Color Processing vs Pseudo-Color Processing
 In Full Color Processing the image in question typically
are acquired with a Full-Color sensor e.g. Color TV
camera or Color Scanner
 In Pseudo-color Processing the problem is of assigning a
color to a particular monochrome intensity or a range of
intensities
Color Spectrum
Electromagnetic Spectrum
Physical Background
• Visible light: a narrow band of
electromagnetic radiation →
380nm (blue)
- 780nm
(red)
• Wavelength: Each physically
distinct colour corresponds to
at least one wavelength in this
band.
Color Fundamentals
 The
colors that humans and some
animals perceive in an object are
determined by the nature of light
reflected from the object
Achromatic vs Chromatic Light
 Achromatic
(void of color) Light: Its only
contribute is its ‘Intensity’ or amount
 Chromatic Light: spans the electromagnetic
spectrum from approximately 400 to 700nm
Quantities for description of quantity of Chromatic
Source of Light
 Three basic quantities are used to describe the quantity of a
chromatic source of light:
 Radiance
 Luminance
 Brightness
Radiance
 The total amount of Energy that flows from a Light
Source
 It is measured in Watts
Luminance
 Luminance gives a measure of amount of energy an
observer perceives from a light source (measured in
Lumens(lm) )
 For example light emitted from a source operating in
Infrared region of Spectrum could have significant
energy (Radiance) but a human observer will hardly
perceive it so luminance is zero.
Brightness
 It is a subjective measure
 It embodies the achromatic notion of intensity and is one of
the key factors in describing color sensation
Human Perception
 Detailed experimental evidences has established that the 6
to 7 million cones in the human eye can be divided into
three principal sensing categories, corresponding roughly to
red, green and blue
 Approximately 65% of all cones are sensitive to Red Light,
33% are sensitive to Green Light and about 2% are
sensitive to Blue Light (most sensitive)
Human Perception
 Due to these absorption characteristic of Human Eye
colors are seen as variable combinations of the so-called
‘Primary Colors’ Red, Green and Blue
 The primary colors can be added to produce secondary
colors of Light
 Magenta (Red+Blue)
 Cyan (Green+Blue)
 Yellow (Red+Green)
Absorption of Light by red, green and blue
cones in Human Eye
 Mixing the three primaries or a secondary with its opposite
primary colors in the right intensities produces white light
Primary Color of Light vs Primary Color of Pigments
 Red, Green and Blue Colors are Primary Colors of Light
 In Primary Color of Pigments a primary color is defined as
the one that subtracts or absorbs a primary color of Light
and reflects or transmits the other two
 Therefore the Primary Colors of Pigments are Magenta,
Cyan and Yellow and secondary colors are Red, Green and
Blue
 A proper combination of three pigment primaries or a
secondary with its opposite primary produces Black
 Color Television Reception is an example of the additive
nature of Light Colors
Tri-Stimulus Values
 The amount of Red, Green and Blue needed to form a
particular color (denoted by X, Y and Z)
 A color is then specified by its “Tri-chromatic Coefficients”
• Thus x+y+z=1
Chromaticity Diagram
 Another
approach for
chromaticity diagram
specifying
colors
is
to
use
 Shows color compositions as a function of x(red) and
y(green)
 For any x and y the corresponding value of z(blue) can
be obtained as
z=1-x-y
Chromaticity Diagram
Chromaticity Diagram
 To determine the range of
colors that can be obtained
from the 3 given colors in the
CD,
we
simply
draw
connecting lines to each of
the three color points.
 The result is a triangle and
any color inside a triangle is
produced
by
various
combinations of the three
initial colors.
 The triangle shows a typical
range of colors (called the
color gamut) produced by
RGB monitor
Color Models
 The purpose of a color model (also called Color Space or Color
System) is to facilitate the specification of colors in some
standard way
 A color model is a specification of a coordinate system and a
subspace within that system where each color is represented by
a single point
 Color Models
RGB (Red, Green, Blue)
CMY (Cyan, Magenta, Yellow)
HSI (Hue, Saturation, Intensity)
YIQ (Luminance,In phase, Quadrature)
YUV (Y' stands for the luma component (the brightness)
are the chrominance (color) components )
and U and V
RGB Model
 Each color is represented
in
its
primary
color
components Red, Green
and Blue
 This model is based on
Cartesian
System
Coordinate
RGB Model
 In this model, the primary colors are red, green, and blue. It is
an additive model, in which colors are produced by adding
components, with white having all colors present and black
being the absence of any color.
 This is the model used for active displays such as television
and computer screens.
 The RGB model is usually represented by a unit cube with one
corner located at the origin of a three-dimensional color
coordinate system, the axes being labeled R, G, B, and having
a range of values [0, 1]. The origin (0, 0, 0) is considered
black and the diagonally opposite corner (1, 1, 1) is called
white. The line joining black to white represents a gray scale
and has equal components of R, G, B.
RGB Color Cube
 The total number of colors in a 24 Bit image is
(28)3 =16,777,216 (> 16 million)
Generating RGB image
CMY and CMYK Color Model

Cyan, magenta, and yellow are the secondary colors with respect to the
primary colors of red, green, and blue. However, in this subtractive model,
they are the primary colors and red, green, and blue, are the secondaries.
In this model, colors are formed by subtraction, where adding different
pigments causes various colors not to be reflected and thus not to be seen.
Here, white is the absence of colors, and black is the sum of all of them.
This is generally the model used for printing.

Most devices that deposit color pigments on paper (such as Color Printers
and Copiers) requires CMY data input or perform RGB to CMY conversion
internally
C
M
Y
R
1.00
=
1.00
1.00
-
G
B
CMY and CMYK Color Model
 CMY is a Subtractive Color Model
 Equal amounts of Pigment primaries (Cyan, Magenta and
Yellow) should produce Black
 In practice combining these colors for printing produces
a “Muddy-Black” color
 So in order to produce “True-Black” a fourth color
“Black” is added giving rise to CMYK model
CMY Color Model
CMY Color Model
HSI Color Model
 Hue (dominant colour seen)
 Wavelength of the pure colour observed in the signal.
 Distinguishes red, yellow, green, etc.
 More the 400 hues can be seen by the human eye.
 Saturation (degree of dilution)
 Inverse of the quantity of “white” present in the signal. A
pure colour has 100% saturation, the white and grey
have 0% saturation.
 Distinguishes red from pink, marine blue from royal blue,
etc.
 About 20 saturation levels are visible per hue.
 Intensity
 Distinguishes the gray levels.
HSI Color Model
 Separates out intensity I from the coding
 Two values (Hue & Saturation) encode chromaticity
 Intensity encode monochrome part.

Hue and saturation of colors respond closely to the way
humans perceive color, and thus this model is suited for
interactive manipulation of color images .
Properties of HSI (HSV)
 Hue H is defined by an angle
 Saturation S models the purity of the color

I=(R+G+B)/3
Conversion from RGB to HSI
 Given an image in RGB color format, the H component of each
RGB pixel is obtained using the equation:
Conversion from HSI to RGB
Conversion from HSI to RGB
Pseudo-Color (False Color) Image
Processing
 Pseudo-color Image Processing consists of assigning colors
to gray levels based on specific criterion
 Generally, the eye cannot distinguish more than about 50
gray levels in an image. Thus subtle detail can easily be lost
in looking at gray scale images. To enhance variations in
gray level and make them more obvious, gray scale images
are frequently pseudo-colored, where each gray scale
(generally at least 256 levels for most displays) are mapped
to a color level through a LUT. The eye is extremely
sensitive to color and can distinguish thousands of color
values in a picture.
Pseudo-Coloring using LUT
 CLUT(Color lookup table):: A mapping of a pixel value to a
color value shown on a display device.
• For example, in a grayscale image with levels 0, 1, 2, 3,
and 4, pseudocoloring is a color lookup table that maps 0
to black, 1 to red, 2 to green, 3 to blue, and 4 to white.
Intensity Slicing
• The technique of intensity slicing or density slicing or color
coding is one of the simplest example of Pseudo-color image
processing
Intensity Slicing
• The Gray Scale [0,L-1] is divided into L levels; where l0
represents Black (f(x,y)=0) and lL-1 represents white
(f(x,y)=L-1)
• Suppose that P planes perpendicular to the intensity axis
are defined at levels l1,l2…..,lp
• Then assuming that 0<P<L-1 the P planes partition the
gray scale into P+1 intervals, V1,V2…….Vp+1
Intensity Slicing
• Gray level to color assignments are made
according to the relation:
f(x,y)= ck
if f(x,y)€vk
• Where ck is the color associated with the kth
intensity interval vk defined by the partition
planes at l=k-1 and l=k
An Alternative View of Intensity Slicing
Basics of Full Color Image Processing
• Full color image processing fall into 2 categories.
• In 1st category we process each component image
individually and then form a composite processed color
image from the individually processed component.
• In 2nd category we work with color pixels directly.
Because full color images have at least three
components, color pixels are really vectors.
• Let c represent an arbitrary vector in RGB color space:
Basics of Full Color Image Processing
• Color components are the function of co-ordinates(x,y) so
we can write it as:
• For an image of size MxN there are MN such vectors,
c(x,y), for x=0,1,2,…,M-1; y=0,1,2,…,N-1
Basics of Full Color Image Processing
Color Transformations
• Color transformation can
expression ::
g(x,y)=T[f(x,y)]
be
represented
by
the
f(x,y):
input image
g(x,y):
processed (output) image
T[*]: an operator on f defined over neighborhood of (x,y).
The pixel values here are triplets or quartets (i.e group of 3
or 4 values)
Color Transformations
•
Si=Ti(r1,r2,…,rn) i=1,2,3,….n
ri and Si are variables denoting the color components of f(x,y) and
g(x,y) at any point (x,y).
n is the no of color components
{T1,T2,…..,Tn} is a set of transformation or color mapping functions.
•
Note that n transformations combine to produce a single
transformation T
Color Transformations
• The color space chosen determine the value of n.
• If RGB color space is selected then n=3 & r1,r2,r3 denotes the red,
blue and green components of the image.
• If CMYK color space is selected then n=4 & r1,r2,r3,r4 denotes the
cyan, hue, magenta and black components of the image.
• Suppose we want to modify the intensity of the given image
using g(x,y)=k*f(x,y) where 0<k<1
Color Transformations
• In HSI color space this can be done with the simple transformation
s3=k*r3
where s1=r1 and s2=r2
Only intensity component r3 is modified.
• In RGB color space 3 components must be transformed:
si=k*ri
i=1,2,3.
• Using k=0.7 the intensity of an image is decreased by 30%
Color Transformations
Color Complements
• The hues opposite to one another on the Color Circle are called
Complements.
• Color Complement transformation is equivalent to image negative
in Grayscale images
Color Complements
Color Slicing
•Highlighting a specific range of colors in an image is useful for
separating objects from their surroundings.
•Display the colors of interest so that they are distinguished from
background.
•One way to slice a color image is to map the color outside some
range of interest to a non prominent neutral color.
Histogram Processing
•Color images are composed
of
multiple
components,
however it is not suitable to
process
each
plane
independently in case of
histogram equalization. This
results in erroneous color.
•A more logical approach is
to
spread
the
color
intensities uniformly, leaving
the colors themselves( hue,
saturation) unchanged.
•HSI approach is ideally
suited to this type of
approach.
Color Image Smoothing
•Color images can be smoothed in the same way as gray scale
images, the difference is that instead of scalar gray level values we
must deal with component vectors of the following form:
•The average of the RGB component vector in this neighborhood
is:
Color Image Smoothing
•We recognize the components of this vector as the scalar
images that would be obtained by independently smoothing
each plane of the starting RGB image using conventional gray
scale neighborhood processing.
•Thus we conclude that smoothing by neighborhood averaging
can be carried out on a per color plane basis.
Color Image Smoothing
Color Image Smoothing
Color Image Sharpening
Noise in Color Images
•Noise in color images can be removed through various noise
models which we use in Image Restoration in case the noise
content of a color image has the same characteristics in each
color channel.
•But it is possible for color channels to be affected differently by
noise so in this case noise are removed from the image by
independently processing each plane
•Remove noise by applying smoothing filters (e.g gaussian,
average, median) to each plane individually and then combine
the result.
Noise in Color Images
Color Image Compression
• Compression is the process of
reducing or eliminating redundant
and/or irrelevant information
• A compressed image is not
directly displayable it must be
decompressed before input to a
color monitor.
•In case if in a compressed image 1
bit of data represents 230 bits of
data in the original image, then
compressed image could
be
transmitted over internet in 1
minute as compared to original
image which will take 4 hours to
transmit.
Any
question
Download