Title: Color Theory
1Color Theory
2Contents
- Color Theory
- 2D Bitmap Image Theory
- 2D Bitmap Image Processing
- 2D Vector Image Theory
3Color Theory
- How to manipulate color digitally?
4What is color?
- Color Mixture of various frequency of light
- Perceptive colors for human eyes around 400nm
700nm (wavelength) - The number of colors in real world Infinite
- But human eyes cannot distinguish every color
A color
400
500
600
700
5Visible spectrum
- Progressive Rainbow
- "visible" light can be broken down into a
spectrum that ranges from blue to red in a
progressive rainbow
The visible spectrum of light
Continuous optical spectrum (designed for
monitors with gamma 1.5).
6Wheel of Color Visible spectrum
The visible spectrum of light
7Visible spectrum
nm is the most common unit to describe the
wavelength of light, with visible light falling
in the region of 400700 nm. The data in compact
discs is stored as indentations (known as pits)
that are approximately 100 nm deep by 500 nm
wide. Reading an optical disk requires a laser
with a wavelength 4 times the pit depth -- a CD
requires a 780 nm wavelength (near infrared)
laser, while the shallower pits of a DVD requires
a shorter 650 nm wavelength (red) laser, and the
even shallower pits of a Blu-ray Disc require a
shorter 405 nm wavelength (blue) laser.
8Color in the eye
The ability of the human eye to distinguish
colors is based upon the varying sensitivity of
different cells in the retina to light of
different wavelengths. The retina contains three
types of color receptor cells, or cones. One
type, relatively distinct from the other two, is
most responsive to light that we perceive as
violet, with wavelengths around 420 nm. (Cones of
this type are sometimes called short-wavelength
cones, S cones, blue cones.) The other two types
are closely related genetically and chemically.
One of them (sometimes called long-wavelength
cones, L cones, red cones) is most sensitive to
light we perceive as yellowish-green, with
wavelengths around 564 nm the other type
(sometimes called middle-wavelength cones, M
cones, green cones) is most sensitive to light
perceived as green, with wavelengths around 534
nm.
9Visible spectrum
This image contains 1 million pixels, each of a
different color. The human eye can
distinguish about 10 million different colors.
10Color Model
- Math model for color information
- RGB
- Red, Green, Blue
- CMY / CMYK
- Cyan, Magenta, Yellow, blacK (or Key)
- HSL / HSB / HSV / HVC
- Hue , Saturation , Lightness (Brightness/Value)
- YUV / YCbCr (YCC)
- Luminance 2 Chrominance (Color differences)
- Other color models
11Wheel of Color
- The Color Wheel
- A color wheel usually include 12 distinct colors.
The color wheel is essentially the linear
progression of color as seen in the color
spectrum, connecting the two ends together.
12Wheel of Color (RGB Color Model)
- The Primary Colors (Additive colors)
- Most of us now use color display, for which the
primary colors will be Red, Green and Blue.
13Wheel of Color (RGB Color Model)
- The Primary Colors (Additive colors)
- Most of us now use color display, for which the
primary colors will be Red, Green and Blue.
14RGB Color Model
Red
Blue
Green
- Cubic coordinate based on primary additive colors
- Start from Black (darkness)
- Sum of all White (light)
- Widely used in PC hardware
- CRT, LCD / Image Scanner
- Easy to implement
- Not efficient/intuitive for processing
- Difficult to achieve / adjust to desired color
for human
Additive Color( mixing light)
B
White
Black
G
R
15Wheel of Color (CMY Color Model)
- The Secondary Colors (Subtractive Colors)
- Secondary color wheel the three colors that are
obtained by combining any two adjacent primary
colors. These will be the secondary colors cyan,
magenta, and yellow.
16Wheel of Color (CMY Color Model)
- The Secondary Colors (Subtractive Colors)
- Secondary color wheel the three colors that are
obtained by combining any two adjacent primary
colors. These will be the secondary colors cyan,
magenta, and yellow.
17CMY / CMYK Color Model
Cyan
Yellow
- Subtractive version of RGB
- Start from White (paper)
- Sum of all Black (ink)
- Widely used in Publishing Industry
- Printer / Color publishing uses 4 inks (CMYK)
- Why K (Black) ?
- For pure black / black letter
Magenta
Subtractive Color( mixing ink)
C
M
White
Black
Y
18Wheel of Color
- The Tertiary Colors
- Tertiary colors are the same for both the
additive and subtractive worlds.
19Wheel of Color
- Analogous Colors
- Analogous colors directly beside a given color.
If you start with Orange and you want its two
analogous colors, select Red and Yellow.
20Wheel of Color
- The Complementary Colors
- Complementary colors are directly opposite each
other on the color wheel. Selecting contrasting
colors is useful when you want to make the colors
stand out more vibrantly.
21Wheel of Color
- Split Complementary Colors
- Split complementary colors can be made up of two
or three colors. You select a color, find its
complementary color or colors on the either side
of the color wheel.
22Wheel of Color
- Warm Colors
- Warm colors are made up of the Red hues, such as
Red, Orange and Yellow. They lend a sense of
warmth, comfort, and energy to the color
selection. They also produce visual result.
23Wheel of Color
- Cool Colors
- Cool colors come from the Blue hues, such as
Blue, Cyan, and Green. These colors will
stabilize and cool the color scheme. These are
good to use for page background.
24Dimension of Color (HSL/HSV/HVC)
- Hue Color name (red, blue, green, etc.)
- Saturation Density (purity) of the color
- Value Lightness Darkness
25HSL / HSV / HVC Color Model
- Cylindrical coordinates based on logical aspect
of color - Hue Color name (red, blue, green, etc.)
- Saturation Density (purity) of the color
- Lightness
- Used in image editingsoftware
- Very easy to achieve / adjust to desired
colorfor human
White
Black
26Color Matching
- Color Gamut
- The range of color that can be reproduced on any
imaging device - Color Matching
- Adjustment / Compensation of the difference of
color gamut among multiple image devices
Eye
CRT
Scanner
Printer
Offset
27Color Depth
- How many colors are needed?
- Black White
- 1 bit
1
0
28Color Depth
- How many colors are needed?
- Gray Scale
- 8 bit (256 shadows)
29Palette and Dithering
256-color image
30Color Depth
- How many colors are needed?
- Full Color
- 8 bits for each R, G and B
- 24 bits (16.7 million colors)
31Color Depth
- How many colors are needed?
- Black White
- 1 bit
- Gray Scale
- 8 bit (256 shadows)
- Indexed Color
- 8 bit (217256 color pallet)
- Full Color
- 8 bit each for RGB
- 24 bit (16.7 million colors)
- Medical / Professional photography
- 3048 bit (1016 bit/RGB)
- (Preserve detail / accuracy in editing)
32Color Depth
- Graphic/Image Data Structure
- Pixels picture elements in digital images
- Image resolution number of pixels in a digital
image - Bit-map a representation of the graphic/image
data in the same manner as they are stored in
video memory
33Color Depth
- Graphic/Image Data Structure
- Black White
- 1 bit
Mono-chrome image Each pixel is stored as a
single bit (0 or 1) A 640 X 480 monochrome image
requires 37.5 Kbytes
34Color Depth
- Graphic/Image Data Structure
- Indexed Color
- 8 bit (217256 color pallet)
- One byte for each pixel
- Support 256 colors
- A 640 X 480 8-bit color image requires 307.2
KBytes
35Video Systems
- Goals
- Efficient use of bandwidth
- High viewer perception of quality
36Camera Operation
S-Video
Color Filters
Camera Tubes
Zoom Lens
R
Beam Splitter
G
Component
B
- Note
- Camera has 1, 2, or 3 tubes for sampling
- More tubes (CCDs) and better lens produce
better pictures
Composite
37Color Perception
- Color is perceived lightwave
- 400nm to 700nm received at retina
- Retina (on the back wall of the eye) composed of
approximately 125 million rods and 7 million
cones - Cones respond to different frequencies (three
types, RGB) - Rods measure brightness at low light levels
(i.e., night vision)
38Color Perception (Cont)
- Spectral-response functions of each of the three
types of cones on the human retina - G gt R gtgt B
- Humans more sensitive to brightness than color
- The processing and perception of the image takes
place in the brain. - Need to understand that there are also
physiological and psychological aspects to the
perception of color. Colors are often associated
with various emotions, such as "feeling blue."
39Color Models in Video
- YIQ color model used in NTSC color TV
- Y is luminance containing brightness and the
detail (monochrome TV) - To create the Y signal, the red, green and blue
inputs to the Y signal must be balanced to
compensate for the color perception misbalance of
the eye. - Y 0.3R 0.59G 0.11B
- Chrominance
- I 0.6R 0.28G - 0.32B (cyan-orange axis)
- Q 0.21R 0.52G 0.31B (purple-green axis)
- Human eyes are most sensitive to Y, next to I,
next to Q. - In a channel (6 MHz) of NTSC TV, 4 MHz is
allocated to Y, 1.5 MHz to I, and 0.5 MHz to Q.
40Color Models in Video (Cont)
- YUV color model for PAL TV and CCIR 601 standard
for digital video - Same definition for Y as in YIQ model
- Chrominance is defined by U and V the color
differences - U B Y
- V R Y
- YCbCr color model used in JPEG and MPEG
- Closely related to YUV scaled and shifted YUV
- Cb ((B Y)/2) 0.5
- Cr ((R Y)/1.6) 0.5
- Chrominance value in YCbCr are always in the
range of 0 to 1
41Color Models in Video (Cont)
- Color models based on linear transformation from
RGB color space
42Types of Color Video Signals
- Component video -- each primary is sent as a
separate video signal. - The primaries can either be RGB or a
luminance-chrominance transformation of them
(e.g., YIQ, YUV). - Best color reproduction
- Requires more bandwidth and good synchronization
of the three components - Composite video -- color (chrominance) and
luminance signals are mixed into a single carrier
wave. Some interference between the two signals
is inevitable. - S-Video (Separated video, e.g., in S-VHS) -- a
compromise between component analog video and the
composite video. It uses two lines, one for
luminance and another for composite chrominance
signal.
43Analog Video
- NTSC Video 525 scan lines per frame, 30 frames
per second (or be exact, 29.97 fps, 33.37
msec/frame) - Interlaced, each frame is divided into 2 fields,
262.5 lines/field - 20 lines reserved for control information at the
beginning of each field - So a maximum of 485 lines of visible data
- Laserdisc and S-VHS have actual resolution of
420 lines - Ordinary TV -- 320 lines
- Each line takes 63.5 microseconds to scan.
Horizontal retrace takes 10 microseconds (with 5
microseconds horizontal synch pulse embedded), so
the active line time is 53.5 microseconds.
44Scanning Video
- Chroma subsampling human visual system is more
sensitive to luminance than chrominance - We can sub-sample chrominance
- 444 No subsampling
- 422 horizontally subsample
- 411 horizontally subsample
- 420 horizontally and vertically
45Scanning Video
Y CR CB
46Scanning Video
- 422 horizontally subsample
Y CR CB
Y CR CB
Y Only
Y CR CB
Y Only
Y CR CB
Y Only
Y CR CB
Y Only
Line 1
Line 2
Line 3
Line 4
47Scanning Video
- 411 horizontally subsample
Y CR CB
Y CR CB
Y Only
Y Only
Y CR CB
Y Only
Y Only
Y Only
Y Only
Line 1
Line 2
Line 3
Line 4
48Scanning Video
- 420 horizontally and vertically
Y CR CB
Y CR Y CB
Y Only Y Only
Y CR Y CB
Y Only Y Only
Y CR Y CB
Y Only Y Only
Y CR Y CB
Y Only Y Only
Line 1
Line 2
Line 3
Line 4
49Color space compression
- Typical data assignment to YUV
- YUV 422 (TV)
- YUV 411 (JPEG)
- YUV 420 (JPEG)
Y
U
V
Y
U
V
Y
U
V
JPEG (150)
Y
U
V
50Standards for Video
HDTV CCIR 601 NTSC CCIR 601 PAL CIF QCIF
Luminance Resolution 1920 x 1080 720 x 486 720 x 576 352 x 288 176 x 144
Chrominance Resolution 960 x 540 360 x 486 360 x 576 176 x 144 88 x 72
Color Subsampling 422 422 422 420 420
Fields/sec 60 60 50 30 30
Aspect Ratio 169 43 43 43 43
Interlacing Yes Yes Yes No No
CCIR Consultative Committee for International
Radio CIF Common Intermediate Format
(approximately VHS quality)
51Sampling
- 1 Frame is stored 720x480 pixels for NTSC
- 1 Frame is stored 720x576 pixels for PAL
- Each Pixel is processed for Y (Luminance (BW)
- 422 Samples 2 of every 4 pixels for color
- 411 Samples 1 of every 4 pixels for color
- 422 has twice the color detail for 411
(shaper color edges) - 444 is not necessary as humans are more
sensitive to change in luminance than color
52Sampling
- The first number refers to the 13.5 MHz sampling
rate of the luminance - The other two numbers refer to the sampling rates
of the color difference signals R-Y and B-Y
(or,more properly in the digital domain, Cr and
Cb)
53Sampling
- 422 systems (D-1, D-5, DigiBeta, BetaSX,
Digital-S,DVCPRO50) color sampled at half the
rate of luminance, - Y is 13.5 MHz R-Y and B-Y is each 6.75 MHz
- 360 color samples (in each of Cr and Cb) per
scanline. - 411 systems (NTSC DV DVCAM, DVCPRO Color data
are sampled half as frequently as in 422 - Y is 13.5 MHz R-Y and B-Y is each 3.375 MHz .
- 180 color samples per scanline.
54Sampling
- 422 Better for
- Computer Graphics
- Special Effects
- Chroma Keying
- Compositing
- Matting
55Uncompressed Sizes (NTSC)
- For the 525 line TV standard the line data is
- 720(Y) 360(Cr) 360(Cb) 1,440 pixels/line
- 487 active lines/picture there are 1,440 x 487
701,280 pixels/picture - (sampling at 8-bits, a picture takes 701.3
kbytes) - 1 sec takes 701.3 x 30 21,039 kbytes, or 21
Mbytes - 1 min takes 21,039 x 60 1,262,340 kbytes, or
1.26 gigs
56Uncompressed Sizes (NTSC)
- BOTTOM LINE
- 1 Gbyte will hold 47 seconds
- 1 hour takes 76 Gbytes
- Of Active Picture (Does not include sync Blanking
etc as these can be regenerated)
57Uncompressed Sizes (NTSC)
- 1 hour takes
- Uncompressed 76 Gbytes
- 21 Compression 38 Gbytes
- 51 Compression 15 Gbytes
58Palette and Dithering
256-color image
Optimized Palette
Optimized Palette Dithered
- Dithering
- Better perception
Dithered
Banding Effect
59Gamma Correction
- Gamma Non-linearity of lightness in any imaging
device - output value ? input value ?
- ? 1 Linear
- 2.0 lt ? lt 3.0 Typical CRT
- Any imaging device has its gamma value
- Importance of Gamma correction
- It is very important to adjust gamma values if
you use same image in different imaging device - Especially in publishing industry
60Alpha Channel
- Transparency information of image
- Important for image editing, animation
Photo Collage
Grayscale Alpha Channel (8-bit)
61Anti-aliasing
- Aliasing problem
- Jagged edge of digital image
- Not a problem of image data itself
- Problem of PC's pixel-baseddisplay screen
- Anti-aliasing technology
- Make edge smoother
- Not a simple blur
- Over sampling orother advancedalgorithms
required
Aliased image
Simple Blur
Anti-Aliased Image
622D Bitmap Image Theory
63Bitmap image
RGB (FF,B6,98)
A pixel
- Pixel based
- Group of colored dots
- Best for real-world image
- Photography, Painted picture
- Large data size
- Needs compression for transfer
- Resolution Dependent
- Not suitable for resizing/zooming
Full Color Windows BMP / 44KB
64Bitmap image compression
- Loss-less Compression
- Can reproduce mathematically identical original
image without any data loss - Not high compression ratio (2.0)
- Lossy Compression
- Reduce non-sensitive information to human eyes
(not mathematical, but physiological method) - Cannot reproduce original image
- Can specify the amount of information loss
- High compression ratio (100)
65Compression algorithms
Algorithm Basic Concept Comp. Ratio FileFormat
Loss-Less RLE(Run-Length Encoding) Pack repetitive data 1.2 BMP
Loss-Less LZW(Lempel-Zif-Welsh) Build treed dictionary 2.0 TIFF, GIF
Lossy Color-space compression Cut non-sensitivecolor information 2.0 JPEG, (TV)
Lossy DCT(Discrete Cosine Transformation) Transform to seriesof Cosine functions 100 JPEG, MPEG1/2
Lossy Wavelet compression Transform to seriesof Wavelet functions 100 JPEG2000, MPEG4
66Color space compression (1)
- Uses human eye characteristics
- Less sensitive to color than lightness
- Less sensitive to red than green
- Color information can be sparse
- YUV color compression
- Y is the most sensitive light to human eyes
- We should reserve information on this component
- U/V is much less sensitive
- We can reduce information from these 2 components
- Typical ratio of data assignment to YUV component
- YUV 444 / 422 / 411 / 420
67Color space compression (2)
- Typical data assignment to YUV
- YUV 422 (TV)
- YUV 411 (JPEG)
- YUV 420 (JPEG)
Y
U
V
Y
U
V
Y
U
V
JPEG (150)
Y
U
V
68Transformation Algorithm
- Convert image to mathematical functions
- DCT (Discrete Cosine Transformation)
- Uses series of cosine functions to encode image
- Used in JPEG, MPEG, MPEG2, etc.
- Wavelet Transformation
- Uses series of wavelet functions to encode image
- Used in JPEG2000, MPEG4, DivX, XviD, etc.
a0
a1
a2
a0
a1
a2
69Algorithm Comparison
Original Image (154KB)
Compress to 3 KB (150)
Fractal
DCT
Wavelet
70Bitmap image file formats
- Industry standard
- TIFF - Adobe/Silicon Graphics
- Platform Standard
- BMP - Windows
- PICT - Macintosh
- GIF - CompuServe
- International Standard
- JPEG - ISO 10918
- PNG - MIT/W3C
- JPEG2000 - ISO 15444
http//www.dcs.ed.ac.uk/home/mxr/gfx/
71TIFF (Tagged Image File Format)
- Highly flexible
- Ability to handle various kinds of specialized
image formats by using internal Tag - over-24bit images (32, 36, up to 64-bits)
- Alpha-channel (Transparency) can be stored
- Multiple Layers
- LZW, JPEG or other compression
- For Professional
- Used in professional imaging industry
- Medical, Publishing, Digital photographers
Photoshop
72GIF (Graphics Interchange Format)
- Designed for amateur use on network
- Many useful features for hobbyist
- Transparency (1 bit only)
- Interlace (for fast perception over net)
- Animation (Cell Animation)
- Suitable for small pictures / icons
- Flexible choice of bit-per-pixel (18)
- Indexed color only (no full color support)
- LZW compression (patented)
- Widely used in WWW
- Mostly for small animations or icons
Many
73JPEG (Joint Photographic Experts Group)
- High compression for full-color image
- Based on characteristics of human eyes
- Less sensitive to color than lightness (YUV)
- Good for photography or artistic image
- NG for scientific image (uneven information loss)
- The only international standard (up to now)
- Block noise
- Widely used in consumer market, WWW
110
1100
Square noise in high compression
Many
74PNG (Portable Network Graphics)
- Designed to be the alternative of GIF
- No patent problem by free loss-less compression
algorithm (gnu zip) - Many advanced features
- Up to 48bpp color depth, 16 bit Alpha channel
- 2 dimensional interlace (Progressive image)
- File corruption checking
- Slowly getting popularitys
- No ground-breaking features (Others can do)
- Limited support in Web browsers
Macromedia Fireworks
75JPEG2000
- New international standard (2001)
- 20 better compression than JPEG
- Less noise in high compression ratio
- Many advanced features
- True progressive transfer
- Option for Loss-less compression
- Support for video Codec (Motion JPEG2000)
- Error resistance (good for the Internet)
- ROI (Region of interest) support
- Slow acceptance
- No native support in Web browsers
IrfanView32
762D Bitmap Image Processing
77Basic Image Processing
- How can you enhance your photograph taken by
digital cameras / image scanners? - Before doing any creative operation in
Photoshop, you should do basic (but important)
image adjustment - Necessary basic image adjustment
- 1. Color correction / White balance correction
- 2. Dynamic range correction
- 3. Gamma correction
- 4. Retouching
78White Balance Correction
- Especially useful for photos taken in house
- Incandescent lamp ? Photo shifts to Red
- Fluorescent lamp ? Photo shifts to Green
- Shadow in sunny day ? Photo shifts to Blue
- Use Auto Levels or Variations command
79Dynamic range correction Donts
- Brightness change
- Simple shift of lightness
- Contrast change
- Simple scaling of lightness
- Do not use them without caution
- Information will be lost
- Better to use dynamic range correction and / or
gamma correction
Histograms
Black
White
Black
White
Black
White
80Dynamic Range Correction
- Especially useful for scanned image
- Black is not truly black, White is not truly
white - Use Levels or Auto Contrast Tool
81Gamma Correction as a Tool
- Useful for too under/over exposed image
- Also used for detailed tone normalization
- Use Levels or Curves command
Only Brightness
Highlight and shadow are the same. Only middle
tone changes
82Dodge Burn
- Adjustment of dynamic range (lightness) of
selected area in an image - Traditionally the most sensitive task for
professional photographer in darkroom - Use masking and histogram manipulation
- Automatic local dynamic range correction
- The latest software (like Photoshop CS) has
function to automatically perform typical Dodge
Burn ? Surprisingly useful for photographer - But it still needs manual operation for real
content-based correction
83Dodge Burn (Example)
Gamma Correction
Original
Shadow/Highlight (Photoshop)
Manual Dodge Burn
84Photo Retouching
- Correct the defect in photograph
- Especially useful for scanned image (because it
always has many dust orscratch on the image) - Use Clone Stamp Tool
852D Vector Image Theory
86Vector image
Filled polygon
- Vector Based
- Group of mathematical shape data
- Best for Illustration /Technical Drawing
- Fully editable, structured data
- Small data size
- 1/100 of comparable bitmap image
- Suitable for slow network (Internet)
- Resolution Independent
- Suitable for resizing/zooming/printing
- Can be applied to 3D modeling
87Basic elements of vector image
- Line
- Fill - for closed path only
Polygon
Open Path
Closed Path
Open Path
Closed Path
Simple
Gradient
Pattern
88Z-order and Grouping
- Z-order
- Which object comes in front?
- Grouping
- Treed structure of objects
89Mathematical Curves
AnchorPoint 2
ControlPoint
- B-Spline curve
- Simple and fast calculation
- Easy to modify curve locally
- Used in TrueType Font, etc.
- Bézier curve
- The most popular 2Dcurve standard
- Easy to control the shape
- Widely used in almostall vector based graphics
programs
Anchor Point 1
AnchorPoint 2
Control Point 1
Anchor Point 1
ControlPoint 2
90Vector image file format
- Industry Standard
- EPS - Adobe ? Artistic drawing
- AI - Adobe ? Artistic drawing
- DXF - Autodesk ? 2D/3D CAD
- Platform Standard
- WMF, EMF - Windows
- International Standard
- CGM (Computer Graphics Metafile) - ANSI/ISO
- SVG - (W3C recommendation)
91EPS (Encapsulated Post Script)
- PostScript based
- PostScript Bézier-curve based page definition
language developed by Adobe - For printing complex page layout
- Highly expressive
- Color separation, Layers, etc.
- For Professional Artist
- Used in publishing / illustration industry
- Not used in mechanical drawing ? DXF
92AI (Adobe Illustrator)
- Proprietary format for Adobe Illustrator
- Based primarily on PostScript
- Adds all special functionality of Illustrator
- Somewhat industry standard
- More capability than EPS
- Many applications support this format
- Inconsistency in versions
- Each new version of Adobe Illustrator has newer
version of file format ? Incompatible
93WMF EMF
- WMF (Windows Meta File)
- Straight line-based (No curve!)
- Designed for Microsoft Windows 3.1
- Limited feature, but widely used in office market
- EMF (Enhanced Meta File)
- Bézier curve-based
- Designed for Microsoft Windows 95
- Used for exchange of vector data internally
between Windows applications