Professional Documents
Culture Documents
COMP4421
Dr. Hao CHEN
Dept. of CSE, HKUST
We have covered…
World is colorful!
2
Color Image Processing
Why Color?
• Powerful descriptor
for object detection and feature extraction
3
Color Image Processing
• Pseudo-color processing
• Full-color processing
4
Color Image Processing
We will cover:
• Color Fundamentals
• Color Models
• RGB, CMY and CMYK, HSI
• Color Image processing
• Pseudo color image processing
• Full color image processing
• Full Color Image Processing
• Color transformations
• Color image smoothing and sharpening
• Color image segmentation
• Noise in color models
5
Color Image Processing
We will cover:
• Color Fundamentals
• Color Models
• RGB, CMY and CMYK, HSI
• Color Image processing
• Pseudo color image processing
• Full color image processing
• Full Color Image Processing
• Color transformations
• Color image smoothing and sharpening
• Color image segmentation
• Noise in color models
6
Color Fundamentals
7
Color Fundamentals
• Perceived color depends on spectral content (wavelength composition)
• e.g., 700nm ~ red.
• A light with equal energy in all visible bands appears white
8
Color Fundamentals
The colors that humans perceive of an object are
determined by the nature of the light reflected from
the object.
Incident light (electromagnetic wave) →human eye.
The light is visible to human eyes if its
wavelength is between 380-780 (nm).
Human eyes have the following sensitivity :
Brightness: light intensity (energy)
9
Human Perception of Color
Quantities describing a chromatic light source
Radiance: total amount of energy from the light source (Watt, W)
Luminance: a measure of the amount of energy by an observer
(Lumens, lm)
Brightness: a subjective descriptor, difficult to measure
10
Human Perception of Color
Two Types of Photoreceptors at Retina
• Rods
• Long and thin
• Large quantity (~ 100 million)
• Provide scotopic vision (i.e., dim light vision or at low illumination)
• Only extract luminance information and provide a general overall
picture
• Cones
• Short and thick, densely packed in fovea (center of retina)
• Much fewer (~7 million) and less sensitive to light than rods
• Provide photopic vision (i.e., bright light vision or at high illumination)
• Help resolve fine details as each cone is connected to its own nerve end
• Responsible for color vision
Yellow
CIE 1931:Primary Colors:
Red (700nm)
Cyan magenta Green (546.1nm)
Blue (435.8nm)
Mixtures of Light
14
Color Characterization
• Brightness
• brightness embodies the achromatic notion of intensity
• Hue
• hue represents dominant color as perceived by an observer
• specify color tone (redness, greenness, etc.)
• depend on peak wavelength
• Saturation
• the relative purity or the amount of white light mixed with a hue
• describe how pure the color is
• depend on the spread (bandwidth) of light spectrum
Hue
• reflect how much white light is added Chromaticity
Saturation
15
CIE Chromaticity Diagram
• Color can be viewed as a mixture of
primary colors
• Tristimulus value: amount of red green
blue to form any color (X, Y, Z)
• Color can be specified by its trichromatic
value (x, y, z)
Specify color by using
X chromaticity diagram
x=
X +Y + Z y=62% green x=25% red
Y z=13% blue
y=
X +Y + Z
Z
z=
X +Y + Z
Points on the boundary are
x + y + z =1 fully saturated colors 16
Example: Seeing Yellow without Yellow
570nm
520nm 630nm
There are numerous color models in use today. Model conversion is required.
19
RGB Color Model
RGB color model: Based on the cartesian coordinate system
Schematic of RGB color cube. Points along the main diagonal have gray values,
from black at the origin to white at point (1, 1, 1). 20
RGB Color Model
Pixel depth:
Number of bits used to represent each pixel.
22
Image Represented by RGB Models
23
CMY and CMYK Color Models
• Primary colors for pigment
• CMY – Cyan, Magenta, Yellow
– Complementary to RGB
– Proper mix of them produces black
24
HSI Color Model
RGB, CMY models are not good for human interpreting. HSI color model decouples
color and grayscale (intensity).
25
Example: HSI Components of RGB Cube
RGB Cube
Saturation Intensity
27
Example: Manipulating HSI Components
• Full color image process: The process to manipulate real color images
such as color photographs.
30
Pseudo Color Image Processing
Pseudo color = false color : In some case there is no “color” concept for a gray scale
image but we can assign “false” colors to an image.
Why we need to assign colors to gray scale image?
Answer: Human can distinguish different colors better than different shades of gray
(visualization and interpretation of grayscale images ).
31
Intensity Slicing and Color Coding
32
Intensity Slicing and Color Coding
34
Multi-level Intensity Slicing
g(x, y) = Ck for lk −1 < f ( x, y) ≤ lk
Ck = Color No. k
lk = Threshold level k
Color
Ck
Ck-1
C3
C2
C1
0 l1 l2 l3 lk-1 lk
L-1
Intensity 35
Intensity Slicing Example
Grayscale image of the Picker Thyroid Result of intensity slicing using eight colors.
Phantom (a radiation test pattern).
36
Intensity Slicing and Color Coding
Gray Color
Scale 10 map
37
Intensity to Color Transformations
Red component
Blue component
40
Multi-spectral Images
41
Intensity to Color Transformations
IR(0.76-0.90 𝜇𝜇𝜇𝜇)
Biomass and shoreline mapping
IR+G+B R+IR+B
42
Intensity to Color Transformations
Image/video colorization with deep learning: Using deep learning to learn a complicate
transformation function considering context.
https://richzhang.github.io/colorization/ https://github.com/ChenyangLEI/automatic-video-colorization
43
Color Image Processing
We will cover:
• Color Fundamentals
• Color Models
• RGB, CMY and CMYK, HSI
• Color Image processing
• Pseudo color image processing
• Full color image processing
• Full Color Image Processing
• Color transformations
• Color image smoothing and sharpening
• Color image segmentation
• Noise in Color models
44
Basics of Full-color Image Processing
Methods:
45
Color Transformations
• Formulation:
𝑔𝑔(𝑥𝑥, 𝑦𝑦) = 𝑇𝑇[𝑓𝑓(𝑥𝑥, 𝑦𝑦)]
• Processing the components of a color image within the context of a single-color model.
Number of components
𝑠𝑠𝑖𝑖 = 𝑇𝑇𝑖𝑖 𝑟𝑟𝑖𝑖 , 𝑖𝑖 = 1,2, … , 𝑛𝑛
A full-color image
Full Color Cyan Magenta Yellow and its various
color-space
components.
A full-color image
and its various
Red Green Blue color-space
components.
Set to gray
Set to gray
49
Example: Color Slicing Transformation
After color slicing
Original image
50
Histogram Equalization of a Full-color Image
• Histogram equalization of a color image can be performed by adjusting color
intensity uniformly while leaving color unchanged.
• The HSI model is suitable for histogram equalization where only Intensity (I)
component is equalized. 𝑘𝑘
where 𝑟𝑟 and 𝑠𝑠 are intensity components of input and output color image.
51
Histogram Equalization of a Full-color Image
Original image
52
Color Image Smoothing
Image smoothing by neighborhood averaging:
Two methods:
• Per-color-plane method: for RGB, CMY
color models, Smooth each color plane
using moving averaging and combine back
to RGB;
• Smooth only Intensity component of a HSI
image while leaving H and S unmodified.
Note: two methods are not equivalent.
53
Color Image Smoothing Example
Green
Blue
54
Color Image Smoothing Example
Color image
HSI Components
55
Color Image Smoothing Example
Smooth all RGB components Smooth only I component of HSI (faster) Differences
56
Color Image Sharpening
Image sharpening using the Laplacian:
57
Color Image Sharpening Example
58
Color Image Segmentation
Methods
• 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.
59
Color Segmentation in HSI Color Space
Color image Hue
1 2
3 4
Saturation Intensity
60
Color Segmentation in HSI Color Space
Binary thresholding of S component Product of 2 and 5
with T = 10%
5 6
Red pixels
7 8
Histogram of 6 Segmentation of red color pixels 61
Color Segmentation in HSI Color Space
62
Color Segmentation in RGB Vector Space
• Each point with (R,G,B) coordinate in the vector space represents one color.
• Segmentation is based on distance thresholding in a vector space.
1 if D(c(x, y), cT ) ≤ T
g(x, y) =
0 if D(c(x, y), cT ) > T
cT = color to be segmented.
D(u,v) = distance function c(x,y) = RGB vector at pixel (x,y).
63
Example: Segmentation in RGB Color Space
Color image
Reference color cT to be
𝑇𝑇 =average color of pixel in the box
𝑐𝑐segmented
64
Noise in Color Images
RGB
(corrupted by
additive + +
Gaussian noise)
R G B
H S I
65
Noise in Color Images
RGB image with green Hue component Saturation component Intensity component
channel corrupted by
salt-and-pepper noise
66
Color Image Processing
We will cover:
• Color Fundamentals
• Color Models
• RGB, CMY and CMYK, HSI
• Color Image processing
• Pseudo color image processing
• Full color image processing
• Full Color Image Processing
• Color transformations
• Color image smoothing and sharpening
• Color image segmentation
• Noise in color models
67