0% found this document useful (0 votes)
1 views57 pages

CV - Part 3

The document covers the fundamentals of color perception, including the nature of light, human vision, and the role of cone cells in color differentiation. It discusses color models, particularly the RGB and CIE XYZ models, and their limitations in accurately representing all perceivable colors. Additionally, it explains key concepts such as hue, saturation, luminance, and the CIE 1931 chromaticity diagram that visually maps human color perception.

Uploaded by

yasmine.kaced
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)
1 views57 pages

CV - Part 3

The document covers the fundamentals of color perception, including the nature of light, human vision, and the role of cone cells in color differentiation. It discusses color models, particularly the RGB and CIE XYZ models, and their limitations in accurately representing all perceivable colors. Additionally, it explains key concepts such as hue, saturation, luminance, and the CIE 1931 chromaticity diagram that visually maps human color perception.

Uploaded by

yasmine.kaced
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/ 57

Course

« Computer Vision»
Sid-Ahmed Berrani
2024-2025

1
Color Fundamentals
• We have seen that we perceive light radiation which is characterized
by a certain intensity and wavelength.
• In 1660 Newton discovered that If we let white light pass through a
prism, the light is separated in various colors.
• Newton's intuition is that white is not a “pure” color, but is the
composition of several colors.

2
Color Fundamentals

3
Color Fundamentals
• The colors that humans and animals perceive in an object are determined by the nature
of the light (wavelength) reflected from the object.

• A body that favors reflectance in a limited range of the visible spectrum exhibits some
shades of color.

4
Human Vision
• Physiologic research showed that in the human cornea there are
three types of receptors for daylight vision (cones) sensible, in
different ways, to the various frequencies of the electromagnetic
radiation.

5
Human Vision
• In human vision, the retina contains two types of photoreceptor
cells: rods and cones.
• Rods are responsible for vision in low-light conditions and do not detect color.
• Cones are responsible for color vision and function best in bright light.
• There are three types of cone cells, each sensitive to different ranges of
wavelengths of light, corresponding to the perception of red, green,
and blue colors.
• The human retina contains approximately 6-7 million cones in total.

6
Human Vision
Types of Cones and Their Sensitivity
• S-cones (Short-wavelength cones):
• Most sensitive to blue light (peak sensitivity around 420-440 nm).
• Constitute about 2-5% of all cones.
• M-cones (Medium-wavelength cones):
• Most sensitive to green light (peak sensitivity around 530-540 nm).
• Constitute about 32-40% of all cones.
• L-cones (Long-wavelength cones):
• Most sensitive to red light (peak sensitivity around 560-580 nm).
• Constitute about 55-65% of all cones.

7
Human Vision
Our perception of colors is the
result of the simultaneous stimulus
(tri-stimulus) of the 3 different
classes of cones.

8
Human Vision: Color Blindness
• Color blindness (color vision deficiency) means you see colors differently than
most people.
• Most of the time, color vision deficiency makes it hard to tell the difference
between certain colors.
• The most common type of color vision deficiency makes it hard to tell the
difference between red and green.
• Another type makes blue and yellow look the same.
• There different types of color vision deficiencies.

9
Human Vision: Color Blindness

S-cone absent

L-cone absent

10
Human Vision: Color Blindness
The Ishihara Test is a widely used color vision test designed to detect color
blindness. It was developed by Dr. Shinobu Ishihara in 1917.
• The test consists of a series of circular plates (Ishihara plates) filled with colored dots.

• Each plate contains a hidden number or pattern made up of dots in a specific color.

• People with normal color vision can distinguish the numbers easily.

• People with red-green color blindness (protanopia or deuteranopia) may struggle to see certain
numbers or may see different ones.

https://www.fr.colorlitelens.com/ishihara-test
11
Color Matching
• Characterize every monochromatic (single wavelength) color as a mixture of
three suitably chosen primaries.
• In the 1930s, the CIE defined the 3 primary colors:
1. RED: 700.0 nm
2. GREEN: 546.1 nm
3. BLUE: 435.8 nm
• CIE: The Commission Internationale de l'Éclairage (CIE) is an organization that
sets standards for light, color, and vision.
• CIE is responsible for defining color spaces and mathematical models that
describe human color perception.
12
Color Fundamentals
A color model is a mathematical structure for representing colors as sets of numbers.
How CIE Modeled Colors Using Three Wavelengths (RGB)?
• CIE developed a mathematical model of human color perception based on the fact
that the human eye has three types of cone cells, each sensitive to different ranges
of wavelengths:
Short-wavelength cones (S): Most sensitive to blue (~450 nm)
Medium-wavelength cones (M): Most sensitive to green (~530 nm)
Long-wavelength cones (L): Most sensitive to red (~600 nm)

13
Color Fundamentals
• Because human vision is trichromatic, the CIE modeled color using three primary
colors: red, green, and blue (RGB).
• It conducted experiments where test subjects adjusted the intensity of three
primary light sources (red, green, and blue) to match a target color.
• This led to the creation of the CIE RGB color matching functions, which describe
how any visible color can be represented as a combination of three primary
wavelengths.

14
Color Fundamentals

The standard observer is actually an average


taken over only 17 British subjects

15
Color Fundamentals
• CIE RGB color matching function

The standard observer is actually an average


taken over only 17 British subjects

16
Color Fundamentals
CIE RGB color matching function
• Almost all colors can be matched this way, except
some shades between blue and green that cannot be
reproduced.
• If we add some red to the test light, than we can
match it using only green and blue.
• We need a negative amount of red to obtain some
colors!

17
Color Fundamentals
• The reason: The sensitivity regions of the three classes of cones overlap.

• The green light activates the red receptor more than the test light (cyan).
• To obtain the same response, we need to reduce the activation of the red cones
(subtract some red)
18
Color Fundamentals
The metamers

• These are different combinations of wavelengths of light that appear identical to the human
eye, despite having different spectral compositions.
• This occurs because the human visual system relies on the responses of the three types of cone
cells (L, M, and S) rather than detecting individual wavelengths.
• In other words, metamerism is the phenomenon where two spectrally distinct lights or colors
look the same because they stimulate the cone cells in the same way.
• Can also be defined as two things that are physically different but perceived the same.
19
Color Fundamentals
The metamers:

20
Color Fundamentals
Color characteristics
The characteristics generally used to distinguish one color from another are
brightness, hue, and saturation.
• Brightness: achromatic notion of intensity
• Hue: dominant wavelength in a mixture of light waves (represents dominant
color as perceived by an observer)
• Saturation: the “relative purity” or the amount of white light mixed with a hue

21
Color Fundamentals
• Describing colors using hue, saturation and brightness
(lightness) is a convenient way to organize differences in colors
as perceived by humans.
• If the three primary colors red, green and blue placed equally
apart on a color wheel, all the other colors of the spectrum can
be created by mixes between any two of the primary colors.
• In the color wheel, any particular spot on the wheel from 0 to
360 degrees is referred to as a hue.

• The hue specifies the specific tone of color.

22
Color Fundamentals
Hue: The Identity of Color
• Hue refers to the basic color on the spectrum, such as red, blue, or green. It is essentially what
differentiates colors from one another.
• Hue is the foundation of color perception. It is what differentiates a shade of red from a shade
of blue. The concept of hue dates back to Isaac Newton’s color wheel, which helped define
how colors relate to one another.
• While hue is a specific wavelength of light within the color spectrum, color is a broader term
that includes hue along with saturation and luminance.
• A bright pink and a deep maroon share the same hue (red) but differ in saturation and
luminance.
• H (hue) = 0, if R = G = B, otherwise a value between 0 and 255, with the range of 0 to 255 being
split into three strips for G to B, B to R and R to G gradients.

23
Color Fundamentals
Saturation: The intensity or purity of a color
• Saturation is the intensity of a hue from gray tone (no saturation) to pure, vivid color (high
saturation).
• Saturation plays a crucial role in setting the mood of an image:
• Highly saturated images convey energy and excitement,
• Highly saturated colors appear vivid and bold,
• Desaturated images evoke a softer or more subdued atmosphere.
• Desaturated colors look muted or washed out.
• S (saturation) = 0, if R = G = B, otherwise (M - m) / (M + m), if L < 128,
otherwise 255 *255 * (M - m) / (511 - (M + m)).
M is max(R, G, B) m is min(R, G, B) L = (M + m) / 2

24
Color Fundamentals
Luminance
• Luminance refers to the brightness or darkness of a color.
• Unlike saturation, which affects color intensity, luminance determines how much light a color
emits or reflects.
• Luminance is essential for creating depth and contrast in an image. A well-balanced luminance
scale ensures that details are visible without overexposing or underexposing parts of an
image.
• L (lightness) = (M + m) / 2, where M is max(R, G, B) and m is min(R, G, B).

25
Color Fundamentals
• Hue determines color identity: The base color that changes in response to saturation and
luminance adjustments.

• Saturation defines intensity: Dictates how pure or diluted a color appears.

• Luminance controls brightness: Adjusts how dark or light a color appears without changing its hue.

26
Color Fundamentals

https://www.youtube.com/watch?v=YeI6Wqn4I78

27
Color Fundamentals
Color Models
• The purpose of a color model (also called color space or color system) is to facilitate
the specification of colors in some standard.
• A color model is a mathematical structure for representing colors as sets of
numbers.
• A color model is a specification of:
▪ A coordinate system
▪ A subspace within that system where each color is represented by a single point.

28
Color Models: RGB

Each corner of the cube corresponds to a specific color combination.


• (0, 0, 0) is the black corner, meaning no light is present (no red, green, or blue).
• (255, 255, 255) is the white corner, meaning full intensity of all three colors is combined => A white light.
• The diagonal axis running from (0, 0, 0) to (255, 255, 255) represents a mix of increasing intensity across
all three channels, resulting in a range from black to white.
29
Color Models: RGB

• The RGB color model is widely used in electronic displays, such as televisions, computer
monitors, and digital cameras…
• These devices emit light to display images.
• For example: Electronic screens (LCD, OLED, CRT, etc.)
• They use RGB pixels, where each pixel consists of three subpixels (red, green, and
blue).
• Adjusting the intensity of pixels allows millions of colors to be displayed.
 RGB is Device-dependent: Different displays use slightly different RGB primaries,
leading to variations in color reproduction.
30
Color Models: RGB
Problems with RGB (1/2):
• Only a small range of potential perceivable colors
• While RGB is widely used in digital imaging, there are certain colors that cannot be represented
accurately in this system.
• The exact range of colors (gamut) depends on the physical capabilities of the display or sensor.
• Some colors fall outside this gamut and cannot be accurately represented:
• Spectral Colors Beyond RGB Primaries: Colors like pure cyan, pure yellow, and pure magenta
• Extremely High-Saturation Colors: Some deeply saturated colors, such as those found in the natural spectrum of light
(e.g., laser light, neon colors), exceed the limits of typical RGB displays.
• Certain Fluorescent Colors: Fluorescent materials can reflect light in ways that exceed the capabilities of the RGB
model.
• ..

31
Color Models: RGB
Problems with RGB (1/2):
• Only a small range of potential perceivable colors
• While RGB is widely used in digital imaging, there are certain colors that cannot be represented
accurately in this system.
• The exact range of colors (gamut) depends on the physical capabilities of the display or sensor.
• Some colors fall outside this gamut and cannot be accurately represented:
• Spectral Colors Beyond RGB Primaries: Colors like pure cyan, pure yellow, and pure magenta
• Extremely High-Saturation Colors: Some deeply saturated colors, such as those found in the natural spectrum of light
(e.g., laser light, neon colors), exceed the limits of typical RGB displays.
• Certain Fluorescent Colors: Fluorescent materials can reflect light in ways that exceed the capabilities of the RGB
model.
• ..

32
Color Models: RGB
Problems with RGB (2/2):
• It is not easy to determine how much of R, G and B to use to make a given color.

RGB = (?, ?, ?)

• It is also perceptually non-linear:


• Two points at a certain distance d apart in one part of the space may be perceptually different.
• Two other points at the same distance d apart in another part of the space may be perceptually
the same.

33
Color Models: CIE XYZ
• To overcome the problem of mixing negative amount of red light, CIE Standard
defined a new color space created by the combination of 3 virtual (hypothetical)
primaries: X, Y, and Z
 The XYZ Color Space.

The Y axis corresponds to the luminance,


that is the perceived relative brightness.

Pure white => a diagonal vector (equal-


valued vector)

34
Color Models: CIE XYZ
Problems with the XYZ:
Many points in XYZ do not corresponds to visible colors
XYZ is not realizable physically.

35
Color Models: XYZ
If we divide the XYZ values by the sum of X+Y+Z, we obtain the chromaticity
coordinates:
𝑿 𝒀 𝒁
𝒙= , 𝒚= , 𝒛= .
𝑿+𝒀+𝒁 𝑿+𝒀+𝒁 𝑿+𝒀+𝒁

 The CIE 1931 chromaticity diagram:


This diagram represents all the color that are visible by the average human eye.

It is a 2D representation of human color perception based on the CIE 1931 color space
It visually maps all perceivable colors based on how they stimulate the three types of cone cells in the
human eye.
36
The CIE 1931 chromaticity diagram: Key Features
1. Chromaticity Coordinates (x, y)

2. Spectral Locus (Horseshoe Shape):


• The outer curved edge represents pure spectral colors (monochromatic
light)
• The straight bottom edge (purple line) represents non-spectral purples,
which do not exist in the rainbow.

3. White Point (D65 Standard Illuminant)

4. Gamut and Color Mixing:


• Any color inside the diagram can be created by mixing three primary colors.
• The gamut of a display (RGB monitors, printers, etc.) is a triangle inside the
diagram, showing the range of reproducible colors.

37
The CIE 1931 chromaticity diagram: Key Features
The Gamut
Any device that reproduces colors by mixing a fixed set of
basic colors can only reproduce the colors within the convex
envelope of their basis.

The area of the envelope measures the quantity of


reproducible colors and is called Gamut

38
The CIE 1931 chromaticity diagram
• A straight-line segment joining any two points in the diagram defines all the different color
variations that can be obtained by combining these two colors additively

• Every point contained within this shape corresponds to a single color sensation.

39
Color Models
The CIE 1931 chromaticity diagram
A color model is defined by a triangle and the
white point.
If we chose a different triangle, we define a
different color models.
The same physical color will have different
coordinates if we consider different triangles
and hence different color models.

40
Color Models
The CIE 1931 chromaticity diagram
=> We need to define conversion methods
between different color space.

41
Color Models: HSV
• The HSV (Hue, Saturation, Value) color model is an alternative to the RGB color model

• It is designed to be more aligned with how humans perceive and categorize colors.
• While RGB uses red, green, and blue intensities to define a color, HSV separates the color
definition into three components:

1. Hue (H): This represents the color type and is the angle on the color wheel.
2. Saturation (S): This represents the intensity or purity of the color.
3. Value (V): This represents the brightness of the color. It ranges from 0% to 100%:
▪ 0% means the color is completely black, regardless of the hue and saturation.
▪ 100% means the color is at its full brightness, with no darkness added.

42
Color Models: HSV

• The Hue (H) is represented as an angle around the central vertical axis (like the spokes of a wheel).
• The Saturation (S) is represented by the distance from the center of the cylinder (the center
represents no saturation, or gray, and the edge represents full saturation).
• The Value (V) is represented by the height of the cylinder, from the bottom (dark) to the top (bright).
43
Color Models: HSV
• HSV model is more intuitive for humans.
• HSV is often easier to understand for humans because it separates chromatic
content from brightness and mimics the way we perceive color.
• We think about colors in terms of hue (red, green, etc.), how vivid they are
(saturation), and how light or dark they are (value).
• Its better for color manipulation. In digital imaging and graphics, HSV is often used
in applications where you want to change the color’s hue (e.g., shifting a color to a
different shade), adjust its brightness, or alter its vibrancy without affecting other
components.
44
Color Models: HSV in practice
• HSV color model is typically represented as:
• 0° to 360° for Hue
• 0 to 100% for Saturation and Value.
• In OpenCV, the HSV color model is represented in a slightly different range:
• Hue (H): Range: 0 to 179 using 8-bits.
To represent a full 360° hue range, the range is scaled down to 0 to 179:
0: Red
30: Yellow
60: Green
120: Cyan
150: Blue
180: Red (again, but the Hue wraps around at 180)
45
Color Models: HSV in practice
• In OpenCV, the HSV color model is represented in a slightly different range:
• Saturation (S): Range: 0 to 255 using 8 bits
0: No saturation (no color, grayscale)
255: Full saturation (pure color, maximum color intensity, no gray)
• Value (V): Range: 0 to 255 using 8 bits
0: Black (no brightness)
255: Full/maximum brightness (pure color)

46
Color Models: From RGB to HSV
• Given an RGB color where R, G, and B are in the range [0, 255].
• We first normalize them to [0,1]:

• Value:
• Saturation: If V=0 (the color is black), then S = 0 (no saturation), otherwise:

47
Color Models: From RGB to HSV
• Hue:
• Compute the difference

• Then determine H based on which color is the maximum:

• If H is negative, add 360° to keep it in the range [0, 360].

48
Color Models: From RGB to HSV
• Example: Let's convert RGB(255, 0, 0) (pure red) to HSV

Normalization

Value

Sat.

Hue

Result: RGB(255, 0, 0) (pure red in RGB) → HSV(0°, 100%, 100%) (pure red in HSV)

49
Color Models: From RGB to HSV
Applications of RGB to HSV Conversion:
• Image segmentation: HSV makes it easier to separate colors.
• Color filtering: Useful in OpenCV for detecting specific objects in images.
• Color adjustments: Easier to modify hue/saturation separately than in RGB.

50
Color Models: From HSV to RGB
A four-step process:
1. Input normalization:
• Hue H should be in the range [0°, 360°].
• Saturation S and Value V should be in the range [0, 1].

2. Comput RGB base values:


• Compute C (chroma) = V × S.
• Compute X = C × (1−∣(H/60°) mod 2−1∣).
• Compute m = V − C.

51
Color Models: From HSV to RGB
A three-step process:
3. Assign RGB values based on Hue H:

4. Adjust final RGB values

52
Color Models: HSI and HSL
Other perceptual color spaces that transform RGB into a more human-intuitive representation by separating
chromatic components (Hue, Saturation) from brightness-related components (Value, Intensity, or Lightness).
HSI HSL

53
Color Models: HSV, HSI and HSL
• Value (V) = Brightest RGB component
=> Brightness from RGB max

• Lightness (L) = Midpoint between min/max RGB


=> Perceptual brightness (closer to human vision)

• Intensity (I) = Average of RGB components


=> Overall color intensity (better for grayscale)

54
And Many Other Color Models
CMYK (Cyan, Magenta, Yellow, Key/Black)
• Used in printing: CMYK is designed for subtractive color mixing, where colors are
created by subtracting light from a white background.
• Components:
• Cyan (C), Magenta (M), Yellow (Y): The primary colors used in printing.
• Key (K): Black, used to deepen colors (since it's hard to achieve true black with
just CMY).
• Applications: Widely used in color printing (e.g., printers, publishing, graphic
design).
55
And Many Other Color Models
LAB (CIELAB)
• Perceptually Uniform: LAB is a device-independent color model based on human
perception, designed to be uniform in terms of how we perceive color differences.
• Components:
• L: Lightness (from black to white).
• A: Green to red axis.
• B: Blue to yellow axis.
• Applications: Used in color correction, image processing, and digital imaging as it
provides consistent color representation regardless of device.
• Conversion: It can be converted from/to RGB or XYZ easily.
56
And Many Other Color Models
YCbCr (Luminance, Chrominance)
• Used in video compression: YCbCr is a color space used in video and image
compression, especially in JPEG, MPEG, and video streaming.
• Components:
• Y: Luminance (brightness) – represents grayscale.
• Cb: Blue chrominance (difference from blue channel).
• Cr: Red chrominance (difference from red channel).
• Applications:
• Compression: YCbCr separates brightness from color to allow more efficient compression (since
humans are more sensitive to brightness than to chroma).
• Broadcasting and video formats: Used in digital TV, image compression, and video editing.
57

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