Vous êtes sur la page 1sur 62

Color Image Processing

CS555 Digital Image Processing Dr. Amar Raheja

Elements of Colour

Color Fundamentals

Digital Image Processing

Color Fundamentals

Digital Image Processing

Color Fundamentals

6 to 7 million cones in the human eye can be divided into three principal sensing categories, corresponding roughly to red, green, and blue. 65%: red 33%: green 2%: blue (blue cones are the most sensitive)

Digital Image Processing

Color Fundamentals

Digital Image Processing

How we see color


It

all depends on how much the different cones are stimulated It is possible to have two different spectra that stimulate cones the same way
o Called a metamer
To

a person, these colors look the same, but they are (in some sense) completely different

Some colors do not come from a single wavelength


There

will never be a purple laser Purple comes from blue (short wavelength) and red (long wavelength) light
o More precisely, the sensation that we call purple comes from the blue and red cones being stimulated

And no others!

Human Eye

The photosensitive part of the eye is called the retina. The retina is largely composed of two types of cells, called rods and cones. Only the cones are responsible for color perception.

Cones
Cones are most densely packed within a region of the eye called the fovea There are three types of cones, referred to as S, M, and L. They are roughly equivalent to blue, green, and red sensors, respectively.

o Their peak sensitivities are located at approximately 430nm, 560nm, and 610nm for the "average" observer.

Spectrum is encoded into three values that correspond to each type of cone - trichromacy

10

Non-uniform distribution
Blue Red

cones are least dense in the fovea

o 3-5%, versus about 8% elsewhere

cones are about 33%, fairly evenly distributed Green are 64% in the fovea, about 55% elsewhere

Another way to see this

Color constancy
As

the spectrum of the illuminating light changes, so does the pattern of cone stimulus
o Yet your red coat looks the same as you walk outside! o No one has a good (computational) understanding of this problem

How many colors can we see?


Humans

can discriminate about

o 200 hues o 20 saturation values o 500 brightness steps


The

NBS lists 267 color names What about across languages?


o Seem to be about 11 basic ones

white, black, red, green, yellow, blue, brown, purple, pink, orange, gray

Additive versus subtractive colors


Paint

is colored because of the spectrum it absorbs (subtracts from the incident light)
o Red paint absorbs non-red photons o Color filters are another example

Lights

have colors because of the spectrum they emit


o Televisions and monitors work this way

The

two obey different rules!

Subtractive colors

Additive colors

Cheap versus expensive cameras


Cheap

CCD

color (video) cameras have a single

o Mask in front of the imaging array o Reduces spatial resolution


More

expensive cameras have 3 different video cameras


o Color output really is 3 different (independent) signals

Digital Image Processing

19

Color in Cameras, Scanners and Monitors is generated from 3 primary colors - Red, Green and Blue

NOTE: The 3 sensors generate 3 monochrome images (the color is created in the brain)

In printers, the inks subtract the light using three Subtractive primaries
Red Yellow Magenta

Green Cyan Blue From the graph above:


o Cyan = Green + Blue = -Red o Magenta = Red + Blue = Green o Yellow = Red + Green = -Blue o BlacK = - (Red+Blue+Green) = - White = BLACK

Color Spaces are universally agreed upon descriptions of color


Device Dependent
RGB CMYK

Device Independent
XYZ CIE L*a*b*

X and Y and Z (pronounced CapX, Cap-Y, Cap-Z)


Source S() Color Matching Functions x-bar, ybar, zbar

Reflector R()

TRISTIMULUS values (XYZ) define color numerically

X = S * R * x-bar Y = S * R * y-bar Z = S * R * z-bar


CIE Chromaticity diagram shows all the colors we see (color gamut of eye)

Represents the XYZ color space Problem: Perceptually NON-UNIFORM

CIEL*a*b* was motivated by a need for a perceptually uniform color space

L* = Lightness (Luminance) (0-100) a* = colors (Chrominance1) from Red to Green b*= (Chrominance2) colors from blue to yellow

Color Spaces
Device dependent Device In-dependent

R G B

+source (white point) +x-bar, y-bar, z-bar

X Y Z

+math (matrix algebra)

CIE Lab

What do we know so far


Color

is a combination of Source, Subject and Detector Color Spaces are universally agreed upon, numerical representations of color
o Rgb AND Cmyk are device dependent color spaces o RGB + source + eye = XYZ (a device independent color space) o XYZ + perceptual uniformity =Lab
Lets

manage color !!

Representing Colour
How

can a particular colour be precisely and unambiguously described? Verbal descriptions such as Dark blue, Bright red, Slimy green are too broad Description of its spectral density curve, by specifying its level at a number of wavelengths is awkward, and too specific, as many different spectral shapes produce the same perceived colour

Numeric Colour Description


Ideally,

every colour should be described uniquely in some numeric way How many numbers are required to define a colour? What coding scheme can be used to map colours into numbers, and vice versa? There are several different conventions for coding colours, what are they, and how do they relate to each other? International standard for colour description?

Color Fundamentals

The characteristics generally used to distinguish one color from another are brightness, hue, and saturation brightness: the achromatic notion of intensity. hue: dominant wavelength in a mixture of light waves, represents dominant color as perceived by an observer. saturation: relative purity or the amount of white light mixed with its hue.

Digital Image Processing

30

Dominant Wavelength Theory


Capitalizes

on the variety of spectra that produce the same perceived colour Specifies a spectrum having this simple shape: B D A
400 620 700

Dominant Wavelength Theory


Luminance is the total power in the light: o L = (D - A)B + AW (W = ?) Hue is the location of the dominant wavelength, i.e. the colour of the main pure light present (in previous e.g. its red) Saturation is the purity of the light, i.e. the percentage of luminance that resides in the dominant component: o

S=

(D - A)B L

X 100%

Dominant Wavelength cont.


The

dominant wavelength, luminance and saturation fully define a colour When D = A, saturation is 0, and white light is seen. When A=0, a pure light is seen. Pastel colours contain much white light, and are therefore unsaturated. The eye can distinguish about 200 different hues, and about 20 different saturations (depending on the hue).

3-dimensional colour spaces


Saturation,

luminance and hue are useful concepts for describing colour However, not very easy to measure these values when presented with a sample colour It does, however, illustrate the fact that colour perception is three-dimensional, i.e. that any colour may be described uniquely by exactly three numbers Any colour can be represented as a point in a three-dimensional colour space.

CIE Color Space

In order to achieve a representation which uses only positive mixing coefficients, the CIE ("Commission Internationale d'Eclairage in 1931) defined three new hypothetical light sources, x, y, and z, which yield positive matching curves:

If we are given a spectrum and wish to find the corresponding X, Y, and Z quantities, we can do so by integrating the product of the spectral power and each of the three matching curves over all wavelengths. The weights X,Y,Z form the three-dimensional CIE XYZ space, as shown above.

CIE Standard

Standard based on three primaries which are able to produce ALL visible colours. Often it is convenient to work in a 2D color space This is commonly done by projecting the 3D color space onto the plane X+Y+Z=1, yielding a CIE chromaticity diagram CIE chromaticity diagram is the view you would get looking at the plane X+Y+Z=1, straight down the blue axis Provides a standard reference for comparing other color systems

CIE Chromticity Diagram


Less natural than RGB However this standard is useful for converting betwen colour spaces of different devices Projections defined as :

37

CIE Chromaticity Diagram

complementary colors

colors which can be mixed together to yield white light. For example, colors on segment CD are complementary to the colors on segment CB. The spectral color which can be mixed with white light in order to reproduce the desired color. color B in the above figure is the dominant wavelength for color A. colors not having a dominant wavelength. For example, color E in the above figure.

dominant wavelength

non-spectral colors

38

Color Gamuts

Color gamuts are represented on the chromaticity diagram as straight line segments or polygons Three primaries (from the vertices of the orange triangle) can only generate colors on the edges or inside the bounding edges of the triangle. Hence, no set of 3 primaries can be additively combined to generate all perceived colors
o Because no triangle within the diagram can encompass all colors

Color gamuts traditionally used to compare video monitors and hard-copy devices
39

Tri-stimulus theory

Any colour can be constructed as a linear combination of three primary colours, e.g. C = n1R + n2G + n3B (n1, n2, n3 scalars) (doesnt have to be red, green and blue, can be any three primaries) e.g. RGB(0,1,0) would be pure green, CMY(.2,.3,.5) would be a yellow Problem! To produce all perceivable colours, some of the above scalars must be negative. This makes no physical sense. Light cannot be removed that isnt there.
40

The RGB Colour Cube


On a display with 3 colour phosphors/lamps/LEDs, the possible magnitudes of each colour vary from 0 to 1. Thus the space of possible colours in R, G, B space is a unit cube The RGB colour cube is a well known vector space defining all possible colour combinations based on the RGB basis vectors E.g. (0, 0, 0) Black, (1, 0, 0) Red, (0, 1, 0) Green, (0, 0, 1) Blue, (1, 1, 0) Yellow, (1, 0, 1) Magenta, (0, 1, 1) Cyan, (1, 1, 1) White

CIE Chromaticity Diagram


It shows color composition as a function of x (red) and y (green)

Digital Image Processing

42

RGB Color Model

Digital Image Processing

43

RGB Color Model

Pixel depth The total number of colors in a 24-bit RGB image is (28)3 = 16,777,216

Digital Image Processing

44

Digital Image Processing

45

Digital Image Processing

Safe RGB colors (or safe Web colors) are reproduced faithfully, reasonably independently of viewer hardware 46 capabilities

Digital Image Processing

47

The CMY and CMYK Color Models

C 1 R M = 1 G Y 1 B
Equal amounts of the pigment primaries, cyan, magenta, and yellow should produce black. In practice, combining these colors for printing produces a muddy-looking black. To produce true black, the predominant color in printing, the fourth color, black, is added, giving rise to the CMYK color model.
Digital Image Processing
48

CMY vs. CMYK

Digital Image Processing


http://en.wikipedia.org/wiki/CMYK

49

HSI Color Model


brightness: the achromatic notion of intensity. hue: dominant wavelength in a mixture of light waves, represents dominant color as perceived by an observer. saturation: relative purity or the amount of white light mixed with its hue.

Digital Image Processing

50

HSI Color Model

Digital Image Processing

51

HSI Color Model

Digital Image Processing

52

HSI Color Model

Digital Image Processing

53

Converting Colors from RGB to HSI

Given an image in RGB color format, the H component of each RGB pixel is obtained using the equation

H = 360

if B G if B>G

1 ( R G ) + ( R B ) [ ] 1 2 = cos 1/2 2 ( R G ) + ( R B )(G B )


Digital Image Processing
54

Converting Colors from RGB to HSI

Given an image in RGB color format, the saturation component is given by

3 S = 1 [min( R, G, B)] ( R + G + B)

Digital Image Processing

55

Converting Colors from RGB to HSI

Given an image in RGB color format, the intensity component is given by

1 I = ( R + G + B) 3

Digital Image Processing

56

Converting Colors from HSI to RGB

RG sector (0o H < 120o)

B = I (1 S ) S cos H R = I 1 + o cos(60 H ) and G = 3I ( R + B )


Digital Image Processing
57

Converting Colors from HSI to RGB

RG sector (120o H < 240o)

H = H 120 R = I (1 S )

S cos H G = I 1 + o cos(60 H ) and B = 3I ( R + G )


Digital Image Processing
58

Converting Colors from HSI to RGB

RG sector (240o H 360o)

H = H 240 G = I (1 S )

S cos H B = I 1 + o cos(60 H ) and R = 3I (G + B )


Digital Image Processing
59

Digital Image Processing

60

Digital Image Processing

61

Digital Image Processing

62

Vous aimerez peut-être aussi