0% found this document useful (0 votes)
24 views76 pages

Color Mohi Sir

Uploaded by

fahad1803114
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views76 pages

Color Mohi Sir

Uploaded by

fahad1803114
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 76

COLOR SPACE

Mohiuddin Ahmad
EE 4235
BOOKS

1. Color Image Processing with Biomedical Applications Author(s):


Rangaraj M. Rangayyan; Begoña Acha; Carmen Serrano, SPIE press
2. Color Medical Image Analysis Editors: Celebi, M. Emre, Schaefer, Gerald
(Eds.)
3. Digital Image Processing for Medical Applications - Author: Geoff
Dougherty, California State University, Channel Islands

https://www.mathworks.com/matlabcentral/answers/91036-how-do-i-split-a-color-image-
into-its-3-rgb-channels
3

Contents
• Introduction:
• Electromagnetic Radiation
• Spectral power distribution
• Color Spaces:
• Linear (RGB, CMYK)
• Artistic View (Munsell, HSV, HLS)
• Standard (CIE-XYZ)
• Perceptual (Luv, Lab)
• Opponent (YIQ, YUV) – used in TV
• Color Conversions
4

Electromagnetic Radiation - Spectrum

Ultra- Short- AC
Gamma X rays violet Infrared Radar FM TV wave AM electricity

-12 -8 -4 4 8
10 10 10 1 10 10
Wavelength in meters (m)
Visible light

400 nm 500 nm 600 nm 700 nm


Wavelength in nanometers (nm)
5

Spectral Power Distribution


• The Spectral Power Distribution (SPD) of a
light is a function P() which defines the power in
the light at each wavelength
Relative Power

0.5

0
400 500 600 700
Wavelength (λ)
6

The Interaction of Light and Matter


• Some or all of the light may be absorbed depending on
the pigmentation / color of the object.

A pigment is a material that changes the color of reflected or transmitted light as the
result of wavelength-selective absorption
7

The Physiology of Human Vision


8

The Human Eye


9

3D Color Spaces

 Three types of cones suggests color is a 3D


quantity. How to define 3D color space?
Cubic Color Spaces Polar Color Spaces Opponent Color Spaces

Brightness
black-white

G Hue
blue-yellow
B

R
red-green
10

RGB (additive) & CMYK(subtractive) Color Model

• RGB = Red, Green, Blue


• The mixing of “light”

CMYK Color Model


• Primary: Cyan, Magenta, Yellow, and Key (Represented by black)
• The mixing of “pigment”

A pigment is a material that changes the color of reflected or transmitted light as the result of wavelength-selective absorption
11

RGB (additive) & CMYK(subtractive) Color Model


• Additive color: Magenta = R + B, Yellow = R + G, and
Cyan = G + B

• Subtractive color: Cyan = 1.0 – red


Magenta = 1.0 – green
Yellow = 1.0 – blue
12

Subtractive Color Mixing

• Why?
Pigments absorb light

• Thinking:
the Color Filters
• Question:
Yellow + Cyan=?
13

Why Do Printers Use CMYK Ink Instead of RGB?

• So even though RGB is capable of displaying more colors, CMYK is


essential for representing color on printed media. In fact, the physical
reality of printing requires using CMYK inks. Even though it’s a smaller
color space compared to RGB, it’s the only way we can create a
continuous spectrum of colors with printed media. Mixing red, green and
blue inks together would produce a smaller range of muddy (cloudy,
opaque, unclear), making it indistinct. We also can’t start with black
paper and add light to it until we reach white, because light can’t be
painted on a surface
CIE 1931 Study
The CIE 1931 color spaces are the first defined quantitative links
between distributions of wavelengths in the electromagnetic visible
spectrum, and physiologically perceived colors in human color
vision. The mathematical relationships that define these color
spaces are essential tools for color management, important when
dealing with color inks, illuminated displays, and recording devices
such as digital cameras. The system was designed in 1931 by
the "Commission Internationale de l'éclairage", known in English as
the International Commission on Illumination.

Color Matching Experiment


CIE Color Matching Functions
The CIE 1931 RGB color space and CIE 1931 XYZ color space were
created by the International Commission on Illumination (CIE) in 1931. The
experimental results were combined into the specification of the CIE RGB
color space, from which the CIE XYZ color space was derived.

CIE RGB Matching Functions CIE XYZ Matching Functions


RGB from Spectrum

RGB = x d
XYZ from Spectrum

XYZ = x d
CIE xyY from CIE XYZ
CIE xyY color model is used to catalog colors:

x = X / (X + Y + Z)
y = Y / (X + Y + Z)
Y = luminance
CIE xyY Color Cone
20

CIE-RGB

• Stiles & Burch (1959) Color matching Experiment.


• Primaries are: 444.4 525.3 645.2
• Given the 3 primaries, we can describe any light with 3
values (CIE-RGB):

(85, 38, 10) (21, 45, 72) (65, 54, 73)


21

The CIE System


• CIE-Commission internationale de l'Eclairage
(International commission of illumination)

• CIE 1931 XYZ system


• One of the color spaces
• The first mathematical defined color space
• Three parameter:
• X, Y, Z
• or Y (brightness), x, y (chroma)
22

The CIE System


• CIE Chromaticity
Diagram
• Spectral Locus
• Parameter x, y
23

The CIE System


• How do we get the parameters from a specified
color or object?
• The spectral power distribution of the illuminant:
S(λ)
• Spectral reflectance factor of the object : R(λ)
• Matching function: x ( ), y ( ), and z ( )
24

The CIE System


u
X  k  x ( )S ( ) R( )
l
u
Y  k  y ( )S ( ) R( )
l

u
Z  k  z ( )S ( ) R( )
l

100
k  u

 y ( ) S ( )
l
25

RGB Image and Its components

111 14 126 36 12 36
36 111 36 12 17 111
200 36 1712 11136 200 14 3636 12 36
200 111 1414 36126 1217 36111 14 36
10 128 36126 36200
1711112
11136111
1414 36 17
126 111
17 36 1736 126 14127236 72200
126126 17
36111 12 36
12 17 200126 3617 12111 36200 12 126
14 200 7236 1212 17126 11117 14 36
10 128 126 200 12 111
126 200 111 14 36 72 200 36 12
36
36 14 36
111 14 126 12 36
36 12 17 72 106 155 17 36 36 14 36 72
200 111 14 126 17 111
36 111 36 12 17 111
12 17 126 17 111 200
36 36 111 36 14 36
17 111 200 36 12 36
14 200 36 12 126 17
17 126 72 126 17 111
14 36 12 36 14 36
126 200 111 14 36 72
200 36 12 36 12 126
17 111 14 126 17 111
36 72 12 12 17 17 72 111 106 14 155 36
12 126 200 36 12 36
26

CMYK Color Model


CMYK = Cyan, Magenta, Yellow, Key (i.e. black)
transmit

Cyan – removes Red

B G R
Magenta – removes Green

B G R
Yellow – removes Blue

B G R
Black – removes all
27

Combining Colors

Additive (RGB) Subtractive (CMYK)


28

Example: red = magenta + yellow

B G R

magenta
B G R
+
yellow

B G R
=
red
R
B G R
29

CMY + Black

C + M + Y = K (black)

• Using three inks for black is expensive


• C+M+Y = dark brown not black
• Black instead of C+M+Y is crisper with more contrast

= +
100 50 70 50 50 0 20
C M Y K C M Y
30

Example
31

Example - C

50

100

150

200

50 100 150 200 250


32

Example - M

50

100

150

200

50 100 150 200 250


33

Example - Y

50

100

150

200

50 100 150 200 250


34

Example - K

50

100

150

200

50 100 150 200 250


35

From RGB to CMY

 C  1  R   R  1  C 
           
 M   1   G   G   1   M 
 Y  1  B   B  1  Y 
           
36

Color Spaces
• Linear (RGB, CMYK)
• Artistic View (Munsell, HSV, HLS)
• Standard (CIE-XYZ)
• Perceptual (LUV, Lab)
• Opponent (YIQ, YUV) – used in TV
37

The Artist Point of View

• Hue - The color we see (red, green, purple)


• Saturation - How far is the color from gray
(pink is less saturated than red, sky blue is
less saturated than royal blue)
• Brightness/Lightness (Luminance) - How
bright is the color

white
Artist’s Color

Hue
Saturation
Value
Value
• Luminance
• Dark to Light
• Value range
• High key
• Middle key
• Low key
Hue - Paint Mixing
• Physical mix of
opaque (not
transparent) paints
• Primary: RYB
• Secondary: OGV
• Neutral: R + Y + B
Hue - Ink Mixing
• Subtractive mix of
transparent inks
• Primary: CMY
• Secondary: RGB
• ~Black: C + M + Y
• Actually use CMYK
to get true black
Hue - Ink Mixing
Assumption: ink printed on pure white paper

CMY = White – RGB:


C = 1 – R, M = 1 – G, Y = 1 – B

CMYK from CMY (K is black ink):


K = min(C, M, Y)
C = C – K, M = M – K, Y = Y - K
Hue - Light Mixing
• Additive mix of
colored lights
• Primary: RGB
• Secondary: CMY
• White = R + G + B
• Show demonstration
of optical mixing
Saturation
• Purity of color
HSV color model

RGB cube HSV top view HSV cone

HSV is a projection of the RGB space


46

HSV/HSB Color Space

HSV = Hue Saturation Value


HSB = Hue Saturation Brightness

Saturation Scale

Brightness Scale
47

HSV

Value
Saturation

Hue
48

HLS Color Space


HLS = Hue Lightness Saturation
V

green
120° yellow

cyan 0.5 red


Blue
240° magenta

0.0 H
black S
49

Color Spaces
• Linear (RGB, CMYK)
• Artistic View (Munsell, HSV, HLS)
• Standard (CIE-XYZ)
• Perceptual (Luv, Lab)
• Opponent (YIQ, YUV) – used in TV
50

CIE Color Standard


• Why do we need a standard ?
• RGB differ from one device to another
51

CIE Color Standard


• Why do we need a standard ?
• RGB differ from one device to another
• RGB cannot represent all colors

RGB Color Matching Functions


52

CIE Color Standard - 1931

• CIE - Commision Internationale d’Eclairage


• 1931 - defined a standard system for color
representation.
• XYZ tristimulus coordinate system.

X Y Z

Tristimulus values: three values that together are used to describe a color and are the amounts of
three reference colors that can be mixed to give the same visual sensation as the color considered
53

XYZ Spectral Power Distribution

1.8
• Non negative over the visible
wavelengths.

Tristimulus values
1.4 z()
• The 3 primaries associated
with x y z spectral power y()
distribution are unrealizable 1
(negative power in some of x()
the wavelengths). 0.6
• y was chosen to equal
luminance of monochromatic 0.2
lights.
400 500 600 700
Wavelength (nm)
Tristimulus values: three values that together are used to describe a color and are the amounts of
three reference colors that can be mixed to give the same visual sensation as the color considered
54

RGB to XYZ
• RGB to XYZ is a linear transformation

X 0.490 0.310 0.200 R


= 0.177 0.813 0.011
Y G
Z 0.000 0.010 0.990 B
55

CIE Chromaticity Diagram


y
0.9
520 X =x
530 X
510 540 X+Y+Z
550
505 Y =y
560 Y
570
X+Y+Z
500
0.5 580 Z =z
Z
495 590
600
X+Y+Z
610
490
650 x+y+z = 1
485
480
470
0.0 450 x
0.0 0.5 1.0
56

Color Naming
0.9
520
530
510 540
550
505 560
green
y 500 yellow- 570
0.5 green 580
yellow
495 590
orange 600
white 610
490 cyan
pink red 650
485 magenta
blue
480
purple
470
450
0.0 0.5 1.0
x
57

Blackbody Radiators and


CIE Standard Illuminants

CIE Standard Illuminants:

2500 - tungsten light (A)


4800 - Sunset
10K - blue sky
6500 - Average daylight (D65)
58

Chromaticity Defined in Polar Coordinates

Given a reference white. 0.8


Dominant Wavelength –
wavelength of the spectral
color which added to the 0.6
reference white, produces
the given color.
0.4
reference white

0.2

0
0 0.2 0.4 0.6 0.8
59

Chromaticity Defined in Polar Coordinates

Given a reference white. 0.8


Dominant Wavelength

Complementary 0.6
Wavelength - wavelength
of the spectral color which
added to the given color, 0.4
produces the reference
reference white
white.
0.2

0
0 0.2 0.4 0.6 0.8
60

Chromaticity Defined in Polar Coordinates

Given a reference white. 0.8


Dominant Wavelength

Complementary 0.6
Wavelength
purity
Excitation Purity – 0.4
the ratio of the lengths
reference white
between the given color
and reference white and 0.2
between the dominant
wavelength light and
reference white. 0
Ranges between 0 .. 1. 0 0.2 0.4 0.6 0.8
61

Device Color Gamut/Range


• We can use the CIE chromaticity diagram to
compare the gamut of various devices:
• Note, for example,
that a color printer
cannot reproduce
all shades available
on a color monitor
62

Perceptual (Luv, Lab)


Luminance v.s. Brightness

Luminance Brightness
(intensity) vs (Lightness)
Y in XYZ V in HSV

Equal intensity steps:

Luminance DI2
I2

Equal brightness steps: DI1


I1

I1 < I2, DI1 = DI2


63

Perceptual Color Spaces


• An improvement over CIE-XYZ that represents better
uniform color spaces
• The transformation from XYZ space to perceptual
space is Non Linear.
• Two standard adopted by CIE are
L*u’v’ and L*a*b*
• The L* line in both spaces is a replacement of the Y
lightness scale in the XYZ model, but it is more
indicative of the actual visual differences.
64

Opponent
Opponent Color Spaces

+
black-white
+
blue-yellow

- +
red-green

-
65

YIQ Color Model


• YIQ is the color model used for color TV in America
(NTSC= National Television Systems Committee)
• Y is luminance, I & Q are color (I=red/green, Q=blue/yellow)
• Note: Y is the same as CIE’s Y
• Result: backwards compatibility with B/W TV!
• Convert from RGB to YIQ:

Y  0.30 0.59 0.11   R 


 I   0.60  0.28  0.32 G 
    
Q   0.21  0.52 0.31   B 

• The YIQ model exploits properties of our visual system, which


allows to assign different bandwidth for each of the primaries (4
MHz to Y, 1.5 to I and 0.6 to Q)
66

YUV Color Model


 YUV is the color model used for color TV in
Israel (PAL), and in video. Also called YCbCr.
 Y is luminance as in YIQ.
 U and V are blue and red (Cb and Cr).
 The YUV uses the same benefits as YIQ,
(5.5 MHz for Y, 1.3 for U and V).
 Converting from RGB to YUV:
 Y = 0.299R + 0.587G + 0.114B
 U = 0.492(B – Y)
 V = 0.877(R – Y)
67

YUV - Example

Y U V
68

Summary
• Light  Eye (Cones,Rods)  [l,m,s]  Color

• Many 3D color models:


• Reproducing Metamers to Colors
• Different reproduction Gamut
• More / Less intuitive
• CIE standards

https://www.cs.rit.edu/~ncs/color/t_convert.html
https://docs.opencv.org/3.4/de/d25/imgproc_color_conversions.html
69

Color Conversions
• RGB ↔ GRAY
• RGB ↔ CIE XYZ.Rec 709 with D65 white point
• RGB ↔ YCrCb JPEG (or YCC)
• RGB ↔ HSV
• RGB ↔ HLS
• RGB ↔ CIE L*a*b*
• RGB ↔ CIE L*u*v*

https://docs.opencv.org/3.4/de/d25/imgproc_color_conversions.html
https://www.cs.rit.edu/~ncs/color/t_convert.html
70

Color Conversion Formula


71

Color conversion
72
73
74
75
76

Question: Assignment
• Convert the following RGB image into the following image
format according to the Roll number mentioned in the next
page. The RGB values and corresponding index are
shown.
 
 100, 200 , 220 0,50 ,90 0 , 0 , 0 
• (i) RGB to Gray ( 0,0 ) ( 0 ,1) ( 0, 2 )
• (ii) RGB ↔ CIE XYZ I   80,70,40 127,127,127 255,0,255 
 (1, 0 ) (1,1) (1, 2 ) 
• (iii) RGB ↔ YCrCb  255,0,255 60,125,225 255,255,255
• (iv) RGB ↔ HSV  ( 2, 0 ) ( 2 ,1) ( 0,0) 
• (v) RGB ↔ HLS
• (vi) RGB ↔ CIE L*a*b*
• (vii) RGB ↔ CIE L*u*v*

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy