0% found this document useful (0 votes)
162 views65 pages

03 Color Space Lecture Note

This document discusses color spaces and color models, which are fundamental concepts for color image analysis. It provides definitions and examples of several common color models, including RGB, CMYK, HSV, YCbCr, and CIELAB. It also discusses how color images are typically stored using 2D arrays of color values and different bit depths for the color channels.

Uploaded by

thuandvt97
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)
162 views65 pages

03 Color Space Lecture Note

This document discusses color spaces and color models, which are fundamental concepts for color image analysis. It provides definitions and examples of several common color models, including RGB, CMYK, HSV, YCbCr, and CIELAB. It also discusses how color images are typically stored using 2D arrays of color values and different bit depths for the color channels.

Uploaded by

thuandvt97
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/ 65

• This is the third lecture note of the course IMAGE ANALYSIS in 103-1

semester, EE, FJU.


• This lecture note can be used to another course COMPUTER VISION.
• In this lecture note, I teach a special and important tpoic for color: color
space and color model, which is very fundamental for color image analysis.
• Web site of this course: http://image-analysis.weebly.com.

1
• There are two sections in this unit.
1. Color model and color space
2. Conversion between color spaces

2
• Course: Image Manipulation and Computational Photography, Efros,
Berkeley. URL: http://inst.eecs.berkeley.edu/~cs194-26/fa14/

3
• This is the first section of this lecture note
1. Color model and color space
2. Conversion between color spaces

4
• Color image, wikipedia: http://en.wikipedia.org/wiki/Color_image
• A (digital) color image is a digital image that includes color
information for each pixel.
• For visually acceptable results, it is necessary (and almost sufficient)
to provide three samples (color channels) for each pixel, which are
interpreted as coordinates in some color space.
• The RGB color space is commonly used in computer displays, but
other spaces such as YCbCr, HSV, and are often used in other
contexts.
• A color image has three values per pixel and they measure the
intensity and chrominance of light.
• The actual information stored in the digital image data is the
brightness information in each spectral band.

5
• A color image is usually stored in memory as a raster map, a two-
dimensional array of small integer triplets; or (rarely) as three separate
raster maps, one for each channel.
• Eight bits per sample (24 bits per pixel) seem adequate for most uses, but
faint banding artifacts may still be visible in some smoothly varying
images, especially those subject to processing. Particularly demanding
applications may use 10 bits per sample or more.
• On the other hand, some widely used image file formats and graphics cards
may use only 8 bits per pixel, i.e., only 256 different colors, or 2–3 bits per
channel. Converting continuous-tone images like photographs to such
formats requires dithering and yields rather grainy and fuzzy results.
• Graphics cards that support 16 bits per pixel provide 65536 distinct colors,
or 5–6 bits per channel. This resolution seems satisfactory for non-
professional uses, even without dithering.

6
• Television use additive color mixing with primary colors of red, green, and blue, each
of which stimulates one of the three types of the eye's color receptors with as little
stimulation as possible of the other two.
• This is called "RGB" color space. Mixtures of light of these primary colors cover a
large part of the human color space and thus produce a large part of human color
experiences.
• Sec. 4.1 RGB and displays, RGB color model, wikipedoa:
http://en.wikipedia.org/wiki/RGB_color_model#RGB_and_displays
• One common application of the RGB color model is the display of colors on a
cathode ray tube (CRT), liquid crystal display (LCD), plasma display, or
organic light emitting diode (OLED) display such as a television, a computer’s
monitor, or a large scale screen. Each pixel on the screen is built by driving
three small and very close but still separated RGB light sources. At common
viewing distance, the separate sources are indistinguishable, which tricks the
eye to see a given solid color. All the pixels together arranged in the
rectangular screen surface conforms the color image.
• During digital image processing each pixel can be represented in the computer
memory or interface hardware (for example, a graphics card) as binary values
for the red, green, and blue color components. When properly managed, these
values are converted into intensities or voltages via gamma correction to
correct the inherent nonlinearity of some devices, such that the intended
intensities are reproduced on the display.

7
• Color model, wikipedia: http://en.wikipedia.org/wiki/Color_model
• A color model is an abstract mathematical model describing the
way colors can be represented as tuples of numbers, typically as
three or four values or color components. When this model is
associated with a precise description of how the components are to
be interpreted (viewing conditions, etc.), the resulting set of colors
is called color space. This section describes ways in which human
color vision can be modeled.

8
• RGB
• Colors can be created on computer monitors with color spaces
based on the RGB color model, using the additive primary colors
(red, green, and blue). A three-dimensional representation would
assign each of the three colors to the X, Y, and Z axes. Note that
colors generated on given monitor will be limited by the
reproduction medium, such as the phosphor (in a CRT monitor) or
filters and backlight (LCD monitor).
• CMY/CMYK
• Colors can be created in printing with color spaces based on the
CMYK color model, using the subtractive primary colors of
pigment (cyan (C), magenta (M), yellow (Y), and black (K)). To
create a three-dimensional representation of a given color space, we
can assign the amount of magenta color to the representation's X
axis, the amount of cyan to its Y axis, and the amount of yellow to
its Z axis. The resulting 3-D space provides a unique position for
every possible color that can be created by combining those three
pigments.
• HSV
• Recognizing that the geometry of the RGB model is poorly aligned
with the color-making attributes recognized by human vision,
computer graphics researchers developed two alternate

9
representations of RGB, HSV and HSL (hue, saturation, value and hue,
saturation, lightness), in the late 1970s. HSV and HSL improve on the
color cube representation of RGB by arranging colors of each hue in a
radial slice, around a central axis of neutral colors which ranges from black
at the bottom to white at the top. The fully saturated colors of each hue
then lie in a circle, a color wheel.

9
• YCbCr
• YCbCr, Y Pb/Cb Pr/Cr, also written as YCBCR, is a family of color
spaces used as a part of the color image pipeline in video and
digital photography systems. CB and CR are the blue-difference
and red-difference chroma components. Y is luminance.
• YCbCr is not an absolute color space; rather, it is a way of
encoding RGB information. The actual color displayed depends on
the actual RGB primaries used to display the signal. Therefore a
value expressed as YCbCr is predictable only if standard RGB
primary chromaticities are used.
• CIELAB
• Unlike the RGB and CMYK color models, Lab color is designed to
approximate human vision. It aspires to perceptual uniformity, and
its L component closely matches human perception of lightness.
• Because Lab space is much larger than the gamut of computer
displays, printers, or even human vision, a bitmap image
represented as Lab requires more data per pixel to obtain the same
precision as an RGB or CMYK bitmap.
• In addition, many of the "colors" within Lab space fall outside the
gamut of human vision, and are therefore purely imaginary; these
"colors" cannot be reproduced in the physical world. Though color
management software, such as that built into image editing

10
applications, will pick the closest in-gamut approximation, changing
lightness, chroma, and sometimes hue in the process.

10
• Color space, wikipedia: http://en.wikipedia.org/wiki/Color_space
• A color space is a specific organization of colors.
• In combination with physical device profiling, it allows for reproducible
representations of color, in both analog and digital representations.
• A color space may be arbitrary, with particular colors assigned to a set of
physical color swatches and corresponding assigned names or numbers
such as with the Pantone system, or structured mathematically, as with
Adobe RGB or sRGB.
• A color model is an abstract mathematical model describing the way
colors can be represented as tuples of numbers (e.g. three tuples in RGB
or four in CMYK), however a color model with no associated mapping
function to an absolute color space is a more or less arbitrary color
system with no connection to any globally understood system of color
interpretation.
• Adding a specific mapping function between a color model and a
reference color space establishes within the reference color space a
definite "footprint", known as a gamut, and for a given color model this
defines a color space.
• For example, Adobe RGB and sRGB are two different absolute color
spaces, both based on the RGB color model. When defining a color space,
the usual reference standard is the CIELAB or CIEXYZ color spaces,
which were specifically designed to encompass all colors the average
human can see.

11
• All values of R, G, and B are assumed to be in the range [0,1]
• Color space, wikipedia: http://en.wikipedia.org/wiki/Color_space
• Since colors are usually defined by three components, not only in
the RGB model, but also in other color models such as CIELAB
and Y'UV, among others, then a three-dimensional volume is
described by treating the component values as ordinary cartesian
coordinates in a euclidean space.
• For the RGB model, this is represented by a cube using non-
negative values within a 0–1 range, assigning black to the origin at
the vertex (0, 0, 0), and with increasing intensity values running
along the three axes up to white at the vertex (1, 1, 1), diagonally
opposite black.
• An RGB triplet (r,g,b) represents the three-dimensional coordinate
of the point of the given color within the cube or its faces or along
its edges. This approach allows computations of the color similarity
of two given RGB colors by simply calculating the distance
between them: the shorter the distance, the higher the similarity.
Out-of-gamut computations can also be performed this way.

12
• The choice of primary colors is related to the
physiology of the human eye; good primaries are
stimuli that maximize the difference between the
responses of the cone cells of the human retina to
light of different wavelengths, and that thereby
make a large color triangle.
• Examples of electronics device using RGB color
model
• RGB and displays
• One common application of the RGB
color model is the display of colors
on a cathode ray tube (CRT), liquid
crystal display (LCD), plasma
display, or organic light emitting
diode (OLED) display such as a
television, a computer’s monitor, or a
large scale screen.
• RGB and cameras
• In color television and video cameras
manufactured before the 1990s, the
incoming light was separated by
prisms and filters into the three RGB

13
primary colors feeding each color into a separate video camera tube
(or pickup tube). These tubes are a type of cathode ray tube, not to
be confused with that of CRT displays.
• RGB and scanners
• In computing, an image scanner is a device that optically scans
images (printed text, handwriting, or an object) and converts it to a
digital image which is transferred to a computer. Among other
formats, flat, drum, and film scanners exist, and most of them
support RGB color. They can be considered the successors of early
telephotography input devices, which were able to send consecutive
scan lines as analog amplitude modulation signals through standard
telephonic lines to appropriate receivers; such systems were in use
in press since the 1920s to the mid-1990s. Color telephotographs
were sent as three separated RGB filtered images consecutively.

13
• The examples color image is illustrated into three planes: red, green, and
blue.

14
• There are different definitions of RGB color model
• RGB color model , wikipedia:
http://en.wikipedia.org/wiki/RGB_color_model
• RGB color space, wikipedia:
http://en.wikipedia.org/wiki/RGB_color_space
• Adobe RGB color space, wikipedia:
http://en.wikipedia.org/wiki/Adobe_RGB_color_space
• The Adobe RGB (1998) color space is an RGB color space
developed by Adobe Systems, Inc. in 1998. It was designed
to encompass most of the colors achievable on CMYK color
printers, but by using RGB primary colors on a device such
as a computer display. The Adobe RGB (1998) color space
encompasses roughly 50% of the visible colors specified by
the CIELAB color space – improving upon the gamut of the
sRGB color space, primarily in cyan-green hues.
• sRGB, wikipedia: http://en.wikipedia.org/wiki/SRGB
• sRGB is a standard RGB color space created cooperatively
by HP and Microsoft in 1996 for use on monitors, printers
and the Internet.
• The sRGB color space has been endorsed by the W3C, Exif,
Intel, Pantone, Corel, and many other industry players.

15
• It is used in proprietary and open graphics file formats, such as
SVG.
• The sRGB color space is well specified and is designed to match
typical home and office viewing conditions, rather than the darker
environment typically used for commercial color matching.

15
• HSV model decouples the intensity component from the color information.
• HSV color model, wikipedia: http://en.wikipedia.org/wiki/HSL_and_HSV.
• HSL (hue-saturation-lightness) and HSV (hue-saturation-value) are the two most
common cylindrical-coordinate representations of points in an RGB color model.
Developed in the 1970s for computer graphics applications, HSL and HSV are used
today in color pickers, in image editing software, and less commonly in image analysis
and computer vision.
• The two representations rearrange the geometry of RGB in an attempt to be more
intuitive and perceptually relevant than the cartesian (cube) representation, by mapping
the values into a cylinder loosely inspired by a traditional color wheel. The angle around
the central vertical axis corresponds to "hue" and the distance from the axis corresponds
to "saturation". These first two values give the two schemes the 'H' and 'S' in their
names. The height corresponds to a third value, the system's representation of the
perceived luminance in relation to the saturation.
• Section 5 Use in Image Analysis, HSV color model page, wikipedia.
• HSL, HSV, HSI, or related models are often used in computer vision and image analysis
for feature detection or image segmentation. The applications of such tools include
object detection, for instance in robot vision; object recognition, for instance of faces,
text, or license plates; content-based image retrieval; and analysis of medical images.
• For the most part, computer vision algorithms used on color images are straightforward
extensions to algorithms designed for grayscale images, for instance k-means or fuzzy
clustering of pixel colors, or canny edge detection. At the simplest, each color
component is separately passed through the same algorithm.
• It is important, therefore, that the features of interest can be distinguished in the color
dimensions used. Because the R, G, and B components of an object’s color in a digital
image are all correlated with the amount of light hitting the object, and therefore with
each other, image descriptions in terms of those components make object discrimination
difficult. Descriptions in terms of hue/lightness/chroma or hue/lightness/saturation are
often more relevant.
16
• The examples image is decoupled into three image planes of HSV model.

17
• This picture shows typical samples of colors with respect to different color
models: RGB, CMYK, HSV, ...

18
• In the example, the image on the left is the original photograph of a green
turtle. In the right image, we have rotated the hue (H) of each color by
−30°, while keeping HSV value and saturation or HSL lightness and
saturation constant.
• Notice how the hue-shifted middle version without such a
correction dramatically changes the perceived lightness
relationships between colors in the image.

19
• Image editing by HSV model
• To change individual color of any region in the RGB image, we
only have to change the hue image
• To change the saturation (purity) of the color, we only change the
saturation image
• To change the intensity of the RGB image, we only change the
value image

20
• YCbCr, wikipedia: http://en.wikipedia.org/wiki/YCbCr
• YCbCr is one of TV based luminance–chrominance color models
• YIQ for NTSC, YUV for PAL, YDBDR for SECAM, and
YCBCR(YBPR) for component video
• All are TV video standards for different purposes
• All are color difference signals, by which RGB color images can be
encoded for broadcasting/recording and later decoded into RGB
again to display them.
• These color models are intermediate formats needed for
compatibility with pre-existent black-and-white TV formats.
• Also, those color difference signals need lower data bandwidth
compared to full RGB signals.

21
• The examples image is decoupled into three image planes of YCbCr
model.

22
• Current high-efficiency digital color image data compression schemes such
as JPEG and MPEG store RGB color internally in YCBCR format, a digital
luminance-chrominance format based on YPBPR. The use of YCBCR also
allows to perform lossy subsampling with the chroma channels (typically
to 4:2:2 or 4:1:1 ratios), which it aids to reduce the resultant file size.
• Reference:
http://en.wikipedia.org/wiki/RGB_color_model#RGB_model_and_lumina
nce.E2.80.93chrominance_formats_relationship

23
• There are a lot of interface standards for home AV(audio-video)
entertainment system: AV connector, component video, composite video,
S-video, HDMI.
• List of video connectors, wikipedia:
http://en.wikipedia.org/wiki/List_of_video_connectors
• Composite video, wikipedia:
http://en.wikipedia.org/wiki/Composite_video
• S-video, wikipedia: http://en.wikipedia.org/wiki/S-Video
• Audio and video connector, wikipedia:
http://en.wikipedia.org/wiki/Audio_and_video_connector
• Component video is an interface standard to transmit YCbCr videos
• Component video, wikipedia:
http://en.wikipedia.org/wiki/Component_video

24
• CIELAB (CIE L*a*b*) is a device-independent color model
• The Lab color space includes all perceivable colors, which means
that its gamut exceeds those of the RGB and CMYK color models.
• Using the Lab color model among all color devices can preserve
color display and printing.
• Therefore Lab is the most commonly used color model in Color
Management System(CMS)
• CMS Is the system to perform color correction according to
device’s color profiles
• Colors in every color device have to be first converted into
the standard CIELAB color model
• Lab color model, wikipedia, http://en.wikipedia.org/wiki/Lab_color_space.
• A Lab color space is a color-opponent space with dimension L for
lightness and a and b for the color-opponent dimensions, based on
nonlinearly compressed (e.g. CIE XYZ color space) coordinates.
• Lab is now more often used as an informal abbreviation for CIE
Lab, the L-a-b representation of the CIE 1976 color space, but not
the Hunter Lab proposed in 1948.
• The L*a*b* color space includes all perceivable colors, which
means that its gamut exceeds those of the RGB and CMYK color
models.
• The 1976 CIELAB color space is derived from the prior "master" space
CIE 1931 XYZ color space, which can predict which spectral power

25
distributions will be perceived as the same color (see metamerism), but which is
not particularly perceptually uniform.
• The intention of both "Lab" color spaces is to create a space that can be
computed via simple formulas from the XYZ space but is more
perceptually uniform than XYZ.

25
• The examples image is decoupled into three image planes of Lab model.

26
• "Perceptual uniform color space" means uniform color difference(distance)
• Color difference, wikipedia: http://en.wikipedia.org/wiki/Color_difference
• Perceptual color differences(distances)
• The nonlinear relations between Lab and RGB are intended to
mimic the nonlinear response of the eye.
• Furthermore, uniform changes of components in the L*a*b* color
space aim to correspond to uniform changes in perceived color, so
the relative perceptual differences between any two colors in
L*a*b* can be approximated by treating each color as a point in a
three-dimensional space (with three components: L*, a*, b*) and
taking the Euclidean distance between them.
• Lab color model, wikipedia, http://en.wikipedia.org/wiki/Lab_color_space.

27
• The Color Space Conversions Applet:
http://www.cs.rit.edu/~ncs/color/a_spaces.html
• Two web apps for online image editing by browsers
• Pixlr editor, Pixlr express
• These two software also provides mobile apps for iOS and
Andoid.
• Google+ photo
• Two excellent PC softwares for image editing (mobile apps are also
available for iOS and Andriod)
• Adobe photoshop
• Adobe lightroom
• Matlab is a programming language and environment for engineering
students
• We should use Matlab to write codes of color image analysis.
• Color related function list for Matlab:
http://www.mathworks.com/help/images/color.html
• Lab Color Space with Matlab:
http://www.mathworks.com/discovery/lab-color.html

28
29
• A Matlab code example to show R, G, B components of a color image.

30
31
• YIQ is a video format very similar with YCbCr
• Both YIQ and YCbCr are TV video standards
• YIQ for NTSC, YUV for PAL, and YCBCR(YBPR) for component
video
• YCbCr, wikipedia: http://en.wikipedia.org/wiki/YCbCr

32
33
34
• What is the color model used in digital camera?
• RGB model
• What is the color model of jpg and mpg files ?
• YUV model or YCbCr model
• Why not an image file format, ex. jpg, stores image data with Lab
color space?
• Because Lab space is much larger than the gamut of
computer displays, printers, or even human vision, a bitmap
image represented as Lab requires more data per pixel to
obtain the same precision as an RGB or CMYK bitmap. In
the 1990s, when computer hardware and software were
limited to storing and manipulating mostly 8-bit/channel
bitmaps, converting an RGB image to Lab and back was a
very lossy operation. With 16-bit/channel and floating-point
support now common, the loss due to quantization is
negligible.
• In addition, many of the "colors" within Lab space fall
outside the gamut of human vision, and are therefore purely
imaginary; these "colors" cannot be reproduced in the
physical world.
• Though color management software, such as that built into

35
image editing applications, will pick the closest in-gamut
approximation, changing lightness, chroma, and sometimes hue in
the process, author Dan Margulis claims that this access to
imaginary colors is useful, going between several steps in the
manipulation of a picture.
• How to print a color image by a color laser printer or an inkjet printer?
• RGB model and CMYK model
• What is the color model in softwares for photo/image processing?
• RGB, HSV model and Lab model
• What is the difference among HSV, HSI, HSL and HSB?

35
• Why not an image file format,ex. jpg, stores image data with Lab color
space?

36
37
• Contrast enhancement is best done by processing the intensity component

38
• Good result

39
• Bad result

40
• This is the second section of this lecture note
1. Color model and color space
2. Conversion between color spaces

41
42
43
• For a chosen color model, both T and T^-1 are necessary for image
processing and analysis.

44
45
46
47
• The transformation of the RGB colour space to a hue, saturation and
brightness colour space is essentially a conversion from a set of rectangular
coordinates to a set of (3D-polar) cylindrical coordinates.
• In the RGB space, the vectors [R, G, B] specify the amount of each red,
green and blue primary in the colour.
• For convenience, we take R, G, B  [0, 1]
• The valid coordinates form the RGB cube [0, 1]  [0, 1]  [0, 1].
• The basic idea behind the transformation to the hue, saturation and
brightness coordinate system is to place a new axis between [0, 0, 0] and
[1, 1, 1], and to specify the colours in 3D-polar coordinates based on this
axis.
• This new axis passes through all the grey points (R = G = B), so we
call it the achromatic axis.
• See more explanations in wikipedia: Achromatic axis
http://en.wikipedia.org/wiki/HSL_and_HSV

Hue
[1,1,1]
H

[0,0,0] Saturation
Brightness

48
• YCbCr is not a complete geometric space, so we may not use a space to
show YCbCr.
• Here we use three image planes to show the conversion from RGB to
YCbCr.
• YCbCr, wikipedia: http://en.wikipedia.org/wiki/YCbCr

49
50
51
52
53
• Color related function list for Matlab:
http://www.mathworks.com/help/images/color.html
• Convert from HSV to RGB Color Space:
http://www.mathworks.com/help/images/convert-from-hsv-to-rgb-
color-space.html
• Convert from YCbCr to RGB Color Space:
http://www.mathworks.com/help/images/convert-from-ycbcr-to-
rgb-color-space.html
• Lab Color Space with Matlab:
http://www.mathworks.com/discovery/lab-color.html

54
55
56
57
58
59

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