2
Definition of Color
• Physical aspects– color is a part of magnetic spectrum of visible
light.
• Perceptual aspects– amount made up by varying R, G and B colors.– cone cells in human eyes detecting color (one for
each R, G and B color)– R, G, B = primary color
3
Primary and Secondary Colors
• Primary colors: the color consist of 1 primary color
• Secondary colors: the color consist of 2 primary colors
5
Color Model
• A.k.a. color space, color system
• Specify a color as a point in some standard coordinate
• Popular color models:– RGB color models– HSV color models– YIQ color models (NTSC standard)– LUV and LAB color models
7
Pixel Depth
• Pixel depth: #bit represented RGB image– E.g. 24-bit RGB color image: 8-bit for each color.
Able to represent (28)3 color
• Full-color image = 24-bit RGB color image
R.C. Gonzalez and R.E. Woods, “Digital Image Processing”, 2nd Ed., Prentice Hall, 2002.
8
Safe RGB Colors
• A.k.a all-system-safe colors, safe Web colors, safe browser color
• Set of the color that are likely to be reproduced color independent of the hardware
• Set of 216 colors (the other 40 are reproduced differently by various OS)
• Value for RGB: 0, 51, 102, 153, 204, 255
• Show in Hex format RRGGBB
9
Safe Color Diagram and Cube
Color only on the surface of the cube
R.C. Gonzalez and R.E. Woods, “Digital Image Processing”, 2nd Ed., Prentice Hall, 2002.
10
HSV Color Model
• Hue: true color attribute
• Saturation: amount that the color is diluted by white – pure red high saturation– light red low saturation
• Value: degree of brightness
12
HSV RGB
VS
BGRV
BGRV
},,min{
},,max{
GRHV
RBHVG
BGHVR
46
1 THEN B IF
26
1 THEN IF
6
1 THEN IF
))1(1(
)1(
)1(
6
6
FSVT
SFVQ
SVP
HHF
HH
H’ R G B0 V T P1 Q V P2 P V T3 P Q V4 T P V5 V P Q
All values are normalized.
13
HSV: MATLAB Command
• RGB HSV– MATLAB: rgb2hsv(Red, Green, Blue);
• HSVRGB– MATLAB: hsv2rgb(Hue, Saturation, Value);
14
RGB Image VS HSV Image
RGB Image
Hue Image
Saturation Image(white : low)
Value Image
http://en.wikipedia.org/wiki/HSV_color_space
15
YIQ Color Space
• Y : luminance, brightness
• I, Q: chrominance (color information)
B
G
R
Q
I
Y
312.0523.0211.0
322.0274.0596.0
114.0587.0299.0
Q
I
Y
B
G
R
703.1106.1000.1
647.0272.0000.1
621.0956.0000.1
16
YIQ: MATLAB Command
• RGB YIQ– MATLAB: rgb2ntsc(Red, Green, Blue);
• YIQRGB– MATLAB: ntsc2rgb(Y, I, Q);
18
MATLAB Structure
• 3-dimensional matrix: – [row, column, color space]
• RGB(HSV, YIQ): – red (hue, Y) components: [.., .., 1]– green (saturation, I) components: [.., .., 2]– blue (value, Q) components: [.., .., 3]
19
Contrast Enhancement
• Use histogram manipulation (E.g. histogram equalization) on only intensity component.
• Processing on RGB matrix leads to color distortion.
20
Histogram Equalization on RGB
http://documents.wolfram.com/applications/digitalimage/UsersGuide/3.4.html
BEFORE AFTER
21
Spatial Filtering
• Blurring: any are fine– average filter on RGB components– average filter on intensity(Y) components
• High-pass filter (E.g. unsharp)– process on intensity components
• General: work on intensity components
22
Smoothed Lena
Blame the reddish tone on the scanner!!!
R.C. Gonzalez and R.E. Woods, “Digital Image Processing”, 2nd Ed., Prentice Hall, 2002.
23
Noise Reduction
• Depended on where noise is generated.– generated in RGB spaces: reduce noise in RGB
matrix– generated in brightness space: reduce noise in
intensity (Y) components