Boje i Svetlost Spektri Fundamentals

Embed Size (px)

Citation preview

  • 7/30/2019 Boje i Svetlost Spektri Fundamentals

    1/62

    Color Image Processing

    CS555 Digital Image Processing

    Dr. Amar Raheja

  • 7/30/2019 Boje i Svetlost Spektri Fundamentals

    2/62

    Elements of Colour

  • 7/30/2019 Boje i Svetlost Spektri Fundamentals

    3/62

    Color Fundamentals

    Digital Image Processing 3

  • 7/30/2019 Boje i Svetlost Spektri Fundamentals

    4/62

    Color Fundamentals

    Digital Image Processing 4

  • 7/30/2019 Boje i Svetlost Spektri Fundamentals

    5/62

    Color Fundamentals

    6 to 7 million cones in the human eye can be divided intothree principal sensing categories, corresponding roughlyto red, green, and blue.

    65%: red 33%: green 2%: blue (blue cones are themost sensitive)

    Digital Image Processing 5

  • 7/30/2019 Boje i Svetlost Spektri Fundamentals

    6/62

    Color Fundamentals

    Digital Image Processing 6

  • 7/30/2019 Boje i Svetlost Spektri Fundamentals

    7/62

    How we see color

    It all depends on how much the differentcones are stimulated

    It is possible to have two different spectrathat stimulate cones the same wayoCalled a metamer

    To a person, these colors look the same, butthey are (in some sense) completelydifferent

  • 7/30/2019 Boje i Svetlost Spektri Fundamentals

    8/62

    Some colors do not come from a

    single wavelengthThere will never be a purple laserPurple comes from blue (short wavelength)

    and red (long wavelength) lightoMore precisely, the sensation that we call purple

    comes from the blue and red cones beingstimulated

    And no others!

  • 7/30/2019 Boje i Svetlost Spektri Fundamentals

    9/62

    9

    Human Eye The photosensitive part

    of the eye is called theretina.

    The retina is largelycomposed of two typesof cells, called rodsandcones. Only the conesare responsible for colorperception.

  • 7/30/2019 Boje i Svetlost Spektri Fundamentals

    10/62

    10

    Cones Cones are most densely packed

    within a region of the eye calledthe fovea

    There are three types of cones,referred to as S, M, and L. Theyare roughly equivalent to blue,

    green, and red sensors,respectively.o Their peak sensitivities are

    located at approximately430nm, 560nm, and 610nm forthe "average" observer.

    Spectrum is encoded into threevalues that correspond to eachtype of cone - trichromacy

  • 7/30/2019 Boje i Svetlost Spektri Fundamentals

    11/62

    Non-uniform distribution

    Blue cones are least dense in the foveao3-5%, versus about 8% elsewhere

    Red cones are about 33%, fairly evenlydistributed

    Green are 64% in the fovea, about 55%elsewhere

  • 7/30/2019 Boje i Svetlost Spektri Fundamentals

    12/62

    Another way to see this

  • 7/30/2019 Boje i Svetlost Spektri Fundamentals

    13/62

    Color constancy

    As the spectrum of the illuminating lightchanges, so does the pattern of cone

    stimulusoYet your red coat looks the same as you walk

    outside!

    oNo one has a good (computational)understanding of this problem

  • 7/30/2019 Boje i Svetlost Spektri Fundamentals

    14/62

    How many colors can we see?

    Humans can discriminate abouto200 hueso

    20 saturation valueso500 brightness steps

    The NBS lists 267 color namesWhat about across languages?

    oSeem to be about 11 basic ones white, black, red, green, yellow, blue, brown, purple,

    pink, orange, gray

  • 7/30/2019 Boje i Svetlost Spektri Fundamentals

    15/62

    Additive versus subtractive

    colorsPaint is colored because of the spectrum it

    absorbs(subtracts from the incident light)

    oRed paint absorbs non-red photons

    oColor filters are another exampleLights have colors because of the spectrum

    they emit

    oTelevisions and monitors work this wayThe two obey different rules!

  • 7/30/2019 Boje i Svetlost Spektri Fundamentals

    16/62

    Subtractive colors

  • 7/30/2019 Boje i Svetlost Spektri Fundamentals

    17/62

    Additive colors

  • 7/30/2019 Boje i Svetlost Spektri Fundamentals

    18/62

    Cheap versus expensive

    camerasCheap color (video) cameras have a single

    CCD

    oMask in front of the imaging array

    oReduces spatial resolutionMore expensive cameras have 3 different

    video cameras

    oColor output really is 3 different (independent)signals

  • 7/30/2019 Boje i Svetlost Spektri Fundamentals

    19/62

    Digital Image Processing 19

  • 7/30/2019 Boje i Svetlost Spektri Fundamentals

    20/62

    Colorin Cameras, Scanners and Monitors isgenerated from 3 primary colors - Red, Green and

    Blue

    NOTE: The 3 sensors generate 3 monochromeimages (the coloriscreated in the brain)

  • 7/30/2019 Boje i Svetlost Spektri Fundamentals

    21/62

    In printers, the inks subtractthe lightusing three Subtractive primaries

    From the graph above:o Cyan = Green + Blue = -Redo Magenta = Red + Blue = -

    Green

    oYellow = Red + Green = -Blueo BlacK = - (Red+Blue+Green)

    = - White = BLACK

    Red

    Green Blue

    MagentaYellow

    Cyan

  • 7/30/2019 Boje i Svetlost Spektri Fundamentals

    22/62

    Color Spacesare universally agreed

    upon descriptions of color

    Device

    Dependent

    RGBCMYK

    Device

    Independent

    XYZCIE L*a*b*

  • 7/30/2019 Boje i Svetlost Spektri Fundamentals

    23/62

    X and Y and Z (pronounced Cap-

    X, Cap-Y, Cap-Z)

    TRISTIMULUS values (XYZ) define color numerically

    X = S * R *x-barY = S * R * y-bar

    Z = S * R * z-bar

    Source S()

    Reflector R()

    Color Matching Functions x-bar, ybar, zbar

  • 7/30/2019 Boje i Svetlost Spektri Fundamentals

    24/62

    CIE Chromaticity diagramshows all the

    colors we see (color gamut of eye)

    Represents the XYZ color space Problem: Perceptually NON-UNIFORM

  • 7/30/2019 Boje i Svetlost Spektri Fundamentals

    25/62

    CIEL*a*b* was motivated by a need for aperceptually uniformcolor space

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

  • 7/30/2019 Boje i Svetlost Spektri Fundamentals

    26/62

    Color Spaces

    +source (white point)

    +x-bar, y-bar, z-bar

    R

    G

    B

    X

    Y

    Z

    +math

    (matrix

    algebra)

    CIE Lab

    Device dependent Device In-dependent

  • 7/30/2019 Boje i Svetlost Spektri Fundamentals

    27/62

    What do we know so far

    Coloris a combination of Source, Subjectand Detector

    Color Spacesare universally agreedupon, numerical representations of color

    o Rgb AND Cmyk are device dependentcolorspaces

    o RGB + source + eye = XYZ (a deviceindependent color space)

    o XYZ + perceptual uniformity=LabLets manage color !!

  • 7/30/2019 Boje i Svetlost Spektri Fundamentals

    28/62

    Representing Colour

    How can a particular colour be precisely andunambiguously described?

    Verbal descriptions such as Dark blue,Bright red, Slimy green are too broad

    Description of its spectral density curve, byspecifying its level at a number of

    wavelengths is awkward, and too specific,as many different spectral shapes producethe same perceived colour

  • 7/30/2019 Boje i Svetlost Spektri Fundamentals

    29/62

    Numeric Colour Description

    Ideally, every colour should be described uniquelyin some numeric way

    How many numbers are required to define acolour?

    What coding scheme can be used to map coloursinto numbers, and vice versa?

    There are several different conventions for codingcolours, what are they, and how do they relate toeach other?

    International standard for colour description?

  • 7/30/2019 Boje i Svetlost Spektri Fundamentals

    30/62

    Color Fundamentals

    The characteristics generally used to distinguish one colorfrom 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 lightmixed with its hue.

    Digital Image Processing 30

  • 7/30/2019 Boje i Svetlost Spektri Fundamentals

    31/62

    Dominant Wavelength Theory

    Capitalizes on the variety of spectra that producethe same perceived colour

    Specifies a spectrum having this simple shape:

    400 700

    A

    D

    B

    620

  • 7/30/2019 Boje i Svetlost Spektri Fundamentals

    32/62

    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 ofluminance that resides in the dominant component:

    oS =

    (D - A)B

    LX 100%

  • 7/30/2019 Boje i Svetlost Spektri Fundamentals

    33/62

    Dominant Wavelength cont.

    The dominant wavelength, luminance andsaturation fully define a colour

    When D = A, saturation is 0, and white light isseen. When A=0, a pure light is seen. Pastelcolours contain much white light, and aretherefore unsaturated.

    The eye can distinguish about 200 different hues,and about 20 different saturations (depending onthe hue).

  • 7/30/2019 Boje i Svetlost Spektri Fundamentals

    34/62

    3-dimensional colour spaces

    Saturation, luminance and hue are useful conceptsfor describing colour

    However, not very easy to measure these valueswhen presented with a sample colour

    It does, however, illustrate the fact that colourperception is three-dimensional, i.e. that anycolour may be described uniquely by exactly three

    numbers

    Any colour can be represented as a point in athree-dimensional colour space.

  • 7/30/2019 Boje i Svetlost Spektri Fundamentals

    35/62

    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 lightsources, 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, wecan do so by integrating the product of the spectral power and each of the threematching curves over all wavelengths. The weights X,Y,Z form the three-dimensional CIEXYZ space, as shown above.

  • 7/30/2019 Boje i Svetlost Spektri Fundamentals

    36/62

    CIE Standard

    Standard based on three primaries which are able toproduce 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 chromaticitydiagram

    CIE chromaticity diagram is the view you would get lookingat the plane X+Y+Z=1, straight down the blue axis

    Provides a standard reference for comparing other colorsystems

  • 7/30/2019 Boje i Svetlost Spektri Fundamentals

    37/62

    37

    CIE Chromticity Diagram Less natural than RGB However this standard is

    useful for converting betwencolour spaces of differentdevices

    Projections defined as :

  • 7/30/2019 Boje i Svetlost Spektri Fundamentals

    38/62

    38

    CIE Chromaticity Diagram complementary colors

    colors which can be mixedtogether to yield white light.For example, colors onsegment CD arecomplementary to the colorson segment CB.

    dominant wavelength The spectral color which can

    be mixed with white light inorder to reproduce thedesired color. color B in theabove figure is the dominantwavelength for color A.

    non-spectral colors colors not having a dominant

    wavelength. For example,color E in the above figure.

  • 7/30/2019 Boje i Svetlost Spektri Fundamentals

    39/62

    39

    Color Gamuts Color gamuts are represented

    on the chromaticity diagram as

    straight line segments orpolygons

    Three primaries (from thevertices of the orange triangle)

    can only generate colors on theedges or inside the bounding

    edges of the triangle.

    Hence, no set of 3 primaries canbe additively combined to

    generate all perceived colors

    o Because no triangle within thediagram can encompass all

    colors

    Color gamuts traditionally usedto compare video monitors andhard-copy devices

  • 7/30/2019 Boje i Svetlost Spektri Fundamentals

    40/62

    40

    Tri-stimulus theory

    Any colour can be constructed as a linear combination ofthree 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) wouldbe a yellow

    Problem! To produce all perceivable colours, some of theabove scalars must be negative. This makes no physicalsense. Light cannot be removed that isnt there.

  • 7/30/2019 Boje i Svetlost Spektri Fundamentals

    41/62

    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

  • 7/30/2019 Boje i Svetlost Spektri Fundamentals

    42/62

    CIE Chromaticity Diagram

    It shows colorcompositionas a functionof x (red) andy (green)

    Digital Image Processing 42

  • 7/30/2019 Boje i Svetlost Spektri Fundamentals

    43/62

    RGB Color Model

    Digital Image Processing 43

  • 7/30/2019 Boje i Svetlost Spektri Fundamentals

    44/62

    RGB Color Model

    Digital Image Processing 44

    Pixel depth

    The total number ofcolors in a 24-bit RGB

    image is (28)3 =16,777,216

  • 7/30/2019 Boje i Svetlost Spektri Fundamentals

    45/62

    Digital Image Processing 45

  • 7/30/2019 Boje i Svetlost Spektri Fundamentals

    46/62

    Digital Image Processing 46

    Safe RGB colors (orsafe Web colors) are

    reproduced faithfully,reasonably

    independently ofviewer hardware

    capabilities

  • 7/30/2019 Boje i Svetlost Spektri Fundamentals

    47/62

    Digital Image Processing 47

  • 7/30/2019 Boje i Svetlost Spektri Fundamentals

    48/62

    The CMY and CMYK Color Models

    Digital Image Processing 48

    1

    1

    1

    C R

    M G

    Y B

    =

    Equal amounts of the pigment primaries, cyan, magenta, andyellow should produce black. In practice, combining thesecolors for printing produces a muddy-looking black.

    To produce true black, the predominant color in printing, thefourth color, black, is added, giving rise to the CMYK colormodel.

  • 7/30/2019 Boje i Svetlost Spektri Fundamentals

    49/62

    Digital Image Processing 49

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

    CMY vs. CMYK

  • 7/30/2019 Boje i Svetlost Spektri Fundamentals

    50/62

    HSI Color Model

    Digital Image Processing 50

    brightness: the achromatic notion ofintensity.

    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.

  • 7/30/2019 Boje i Svetlost Spektri Fundamentals

    51/62

    HSI Color Model

    Digital Image Processing 51

  • 7/30/2019 Boje i Svetlost Spektri Fundamentals

    52/62

    HSI Color Model

    Digital Image Processing 52

  • 7/30/2019 Boje i Svetlost Spektri Fundamentals

    53/62

    HSI Color Model

    Digital Image Processing 53

  • 7/30/2019 Boje i Svetlost Spektri Fundamentals

    54/62

    Converting Colors from RGB to HSI

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

    Digital Image Processing 54

    if B G

    360 if B>GH

    =

    [ ]

    ( )

    1

    1/22

    1( ) ( )

    2

    cos ( )( )

    R G R B

    R G R B G B

    +

    =

    +

  • 7/30/2019 Boje i Svetlost Spektri Fundamentals

    55/62

    Converting Colors from RGB to HSI

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

    Digital Image Processing 55

    [ ]3

    1 min( , , )( )S R G BR G B=

    + +

  • 7/30/2019 Boje i Svetlost Spektri Fundamentals

    56/62

    Converting Colors from RGB to HSI

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

    Digital Image Processing 56

    ( )1

    3I R G B= + +

  • 7/30/2019 Boje i Svetlost Spektri Fundamentals

    57/62

    Converting Colors from HSI to RGB

    RG sector

    Digital Image Processing 57

    (1 )

    cos1

    cos(60 )

    and

    3 ( )

    B I S

    S HR I

    H

    G I R B

    =

    = +

    = +

    o

    (0 120 )H

  • 7/30/2019 Boje i Svetlost Spektri Fundamentals

    58/62

    Converting Colors from HSI to RGB

    RG sector

    Digital Image Processing 58

    120

    (1 )

    cos1

    cos(60 )

    and

    3 ( )

    H H

    R I S

    S HG I

    H

    B I R G

    =

    =

    = +

    = +

    o

    o

    (120 240 )H

  • 7/30/2019 Boje i Svetlost Spektri Fundamentals

    59/62

    Converting Colors from HSI to RGB

    RG sector

    Digital Image Processing 59

    240

    (1 )

    cos1

    cos(60 )

    and

    3 ( )

    H H

    G I S

    S HB I

    H

    R I G B

    =

    =

    = +

    = +

    o

    o

    (240 360 )H o o

  • 7/30/2019 Boje i Svetlost Spektri Fundamentals

    60/62

    Digital Image Processing 60

  • 7/30/2019 Boje i Svetlost Spektri Fundamentals

    61/62

    Digital Image Processing 61

  • 7/30/2019 Boje i Svetlost Spektri Fundamentals

    62/62

    Digital Image Processing 62