Color Space
Color Space
Ordering
Colors in 3 separate arrays of similar length
Retrieve same location (u,v) in each R, G and B
array
True Color: Packed
Ordering
Component (RGB) values representing a pixel’s color
is packed together into single element
Indexed
Images
Permit only limited number of distinct colors (N = 2 to
256)
Used in illustrations or graphics containing large regions
with same color
Instead of intensity values, image contains indices into
color table or palette
Palette saved as part of image
Converting from true color to indexed color
requires quantization
Color Images in
ImageJ
ImageJ supports 2 types of color images
RGB full‐color images (24‐bit “RGB color”),
packed order
Supports TIFF, BMP, JPEG, PNG and RAW file formats
Indexed images (“8‐bit color”)
Up to 256 colors max (8 bits)
Supports GIF, PNG, BMP and TIFF (uncompressed) file
formats
See section 12.1.2 of Burger & Burge
Color Image Conversion in
ImageJ
Methods for converting between different types of color
and grayscale image objects
Note: if doScaling is true, pixel values scaled to
maximum range of new image
General Strategies
for Processing Color
Images
Strategy 1:
Process each RGB
matrix separately
General Strategies
for Processing Color
Images
Strategy 2: Compute
luminance
(weighted average
of RGB), process
intensity matrix
RGB to HSV
Conversion
Define the following
values
And luminance
value
RGB to HSV
Conversion
Normalize each component
using
Original RGB
image
HSV values
in grayscale
HSV to RGB
Conversion
HSV to RGB
Conversion
RGB Components can be scaled to whole numbers in
range [0,255] as
RGB to HLS
Conversion
Compute Hue same way as for HSV
model
HLS values
in grayscale
HLS to RGB
Conversion
Assuming H, L and S in [0,1]
range
Otherwise,
calculate
UV components computed
as:
YU
V
Entire transformation from RGB to
YUV
2D rotation
matrix
Note: Look up x, y
Calculate z as 1 – x - y
Standard
Illuminants
Central goal of CIE chart is the quantitative measurement
of colors in physical reality
CIE specifies some standard illuminants for many real and
hypothetical light sources
Specified by spectral radiant power distribution
and correlated color temperature
D50: natural direct sunlight
D65: Indirect daylight, overcast sky
CIE
uses
Find complementary colors:
equal linear distances from white in opposite directions
Measure hue and saturation:
Extend line from color to white till it cuts horseshoe (hue)
Saturation is ratio of distances color‐to‐white/hue‐to‐white
Define and compare device color gamut (color
ranges)
Problem: not perceptually uniform:
Same amount of changes in different directions
generate perceived difference that are not equal
CIE LUV, L*a*b* ‐ uniform
CIE
L*a*b*
Main goal was to make changes in this space linear
with respect to human perception
Now popular in high‐quality photographic applications
Used in Adobe photoshop as standard for converting
between different color spaces
Components:
Luminosity L
Color components a* and b* which specify color hue and
saturation along green‐red and blue‐yellow axes
All 3 components are measured relative to reference
white
Non‐linear correction function (like gamma correction)
applied
Device Color
Gamuts
Since X, Y, and Z are hypothetical light sources, no real
device can produce the entire gamut of perceivable
color
Depends on physical means of producing color on
device
Example: R,G,B phosphors on CRT monitor
Device Color
Gamuts
The RGB color cube sits within CIE color space
We can use the CIE chromaticity diagram to compare
the gamuts of various devices
E.g. compare color printer and monitor color gamuts
Transformation CIE XYZ to
L*a*b*
Current ISO Standard 13655
conversion
where
where
Example of L*a*b*
Components
Code for XYZ to L*a*b*
and L*a*b* to XYZ
Conversion
Measuring Color
Differences
Due to its uniformity with respect to human
perception, differences between colors in L*a*b*
color space can be determined as euclidean distance
sRG
B
For many computer display‐oriented applications, use of
CIE color space may be too cumbersome
sRGB
developed by Hewlett Packard and Microsoft
has relatively small gamut compared to L*a*b*
Its colors can be reproduced by most computer monitors
De Facto standard for digital cameras
Several image formats (EXIF, PNG) based on sRGB
Transformation CIE XYZ to
sRGB
First compute linear RGB values
as
Where
With