color coordinate

Upload: rasim-avci

Post on 06-Apr-2018

220 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/3/2019 Color Coordinate

    1/12

    Lecture 8. Color Image Processing

    EL512 Image Processing

    Dr. Zhu Liu

    [email protected]

    Note: Part of the materials in the slides are from Gonzalezs DigitalImage Processingand Onurs lecture slides

    Fall 2004 EL512 Image Processing Lecture 8, Page 2

    Lecture Outline

    Color perception and representation

    Human perception of color

    Trichromatic color mixing theory

    Different color representations

    Color image display

    True color image

    Indexed color images

    Pseudo color images

    Color image enhancement

    Fall 2004 EL512 Image Processing Lecture 8, Page 3

    Light is part of the EM wave

    Fall 2004 EL512 Image Processing Lecture 8, Page 4

    Human Perception of Color

    Retina contains receptors

    Cones

    Day vision, can perceive color tone

    Red, green, and blue cones

    Rods

    Night vision, perceive brightness only

    Color sensation

    Luminance (brightness)

    Chrominance

    Hue (color tone)

    Saturation (color purity)

    Fromhttp://www.macula.org/anatomy

    /retinaframe.html

  • 8/3/2019 Color Coordinate

    2/12

    Fall 2004 EL512 Image Processing Lecture 8, Page 5

    Frequency Responses of Cones

    ybgridaCC ii ,,,,)()( == Fall 2004 EL512 Image Processing Lecture 8, Page 6

    Illuminating and Reflecting Light

    Illuminating sources: emit light (e.g. the sun, light bulb, TV monitors)

    perceived color depends on the emittedfrequency

    Reflecting sources: reflect an incoming light (e.g. the color dye,

    matte surface, cloth)

    perceived color depends on reflected

    frequency (=emitted frequency - absorbedfrequency

    Fall 2004 EL512 Image Processing Lecture 8, Page 7

    Tri-chromatic Color Mixing

    Tri-chromatic color mixing theory Any color can be obtained by mixing three primary colors with a

    right proportion

    Primary colors for illuminating sources:

    Red, Green, Blue (RGB) Color monitor works by exciting red, green, blue phosphors

    using separate electronic guns

    follows additive rule: R+G+B=White

    Primary colors for reflecting sources (also known assecondary colors): Cyan, Magenta, Yellow (CMY)

    Color printer works by using cyan, magenta, yellow and black(CMYK) dyes

    follows subtractive rule: R+G+B=Black

    Fall 2004 EL512 Image Processing Lecture 8, Page 8

    RGB vs CMY

    Magenta = Red + BlueCyan = Blue + GreenYellow = Green + Red

    Magenta = White - GreenCyan = White - RedYellow = White - Blue

  • 8/3/2019 Color Coordinate

    3/12

    Fall 2004 EL512 Image Processing Lecture 8, Page 9

    Red

    Green Blue

    A Color Image

    Fall 2004 EL512 Image Processing Lecture 8, Page 10

    Tristimuls Values

    Tristimulus valueThe amounts of red, green, and blue needed

    to form any particular color are called thetristimulus values, denoted by X, Y, and Z.

    Trichromatic coefficients

    Only two chromaticity coefficients are

    necessary to specify the chrominance of alight.

    .,,ZYX

    Zz

    ZYX

    Yy

    ZYX

    Xx

    ++=

    ++=

    ++=

    1=++ zyx

    Fall 2004 EL512 Image Processing Lecture 8, Page 11

    CIE Chromaticity Diagram

    CIE (CommissionInternationale deLEclairage,InternationalCommission onIllumination ) systemof color specification

    x axis: redy axis: green

    The point marked with GREEN

    x: 25%, y: 62%, z: 13%.

    Fall 2004 EL512 Image Processing Lecture 8, Page 12

    Color Models

    Specify three primary or secondary colorsRed, Green, Blue.

    Cyan, Magenta, Yellow.

    Specify the luminance and chrominanceHSB or HSI (Hue, saturation, and brightness or

    intensity)

    YIQ (used in NTSC color TV)

    YCbCr (used in digital color TV)

    Amplitude specification:8 bits per color component, or 24 bits per pixel

    Total of 16 million colorsA 1kx1k true RGB color requires 3 MB memory

  • 8/3/2019 Color Coordinate

    4/12

    Fall 2004 EL512 Image Processing Lecture 8, Page 13

    RGB Color Model

    RGB 24-bit color cube

    Fall 2004 EL512 Image Processing Lecture 8, Page 14

    CMY and CMYK Color Models

    Conversion between RGB and CMY

    Equal amounts of Cyan, Magenta, andYellow produce black. In practice, thisproduce muddy-looking black. To producetrue black, a fourth color, black is added,which is CMYK color model.

    .

    1

    11

    ,

    1

    11

    =

    =

    Y

    MC

    B

    GR

    B

    GR

    Y

    MC

    Fall 2004 EL512 Image Processing Lecture 8, Page 15

    HSI Color Model

    Hue represents dominant color asperceived by an observer. It is an attributeassociated with the dominant wavelength.

    Saturation refers to the relative purity orthe amount of white light mixed with a hue.The pure spectrum colors are fullysaturated. Pink and lavender are lesssaturated.

    Intensity reflects the brightness.

    Fall 2004 EL512 Image Processing Lecture 8, Page 16

    The HSI Color Model

  • 8/3/2019 Color Coordinate

    5/12

    Fall 2004 EL512 Image Processing Lecture 8, Page 17

    Conversion Between RGB and HSI

    Converting color from RGB to HSI

    Converting color from HSI to RGB

    [ ]

    [ ]

    ][3

    1

    )],,[min()(

    31

    ))(()(

    )()(

    2

    1

    cos,3602

    12

    1

    BGRI

    BGRBGR

    S

    BGBRGR

    BRGR

    withGBif

    GBifH

    ++=

    ++=

    +

    +

    =

    >

    =

    )(1

    )60cos(

    cos1

    )1(

    BRG

    H

    HSIR

    SIB

    +=

    +=

    =

    RG sector (0H

  • 8/3/2019 Color Coordinate

    6/12

    Fall 2004 EL512 Image Processing Lecture 8, Page 21

    Demo Using Photoshop

    Fall 2004 EL512 Image Processing Lecture 8, Page 22

    Color Image Display and Printing

    Display:

    Need three light sources projecting red, green, blue

    components respectively at every pixelAnalog display: raster scan

    Digital display: directly projecting at all pixel locations

    Printing:

    Need three (or more) color dyes (Cyan, Magenta,Yellow, and Black)

    Analog printing

    Digital printing

    Out of gamut color

    Fall 2004 EL512 Image Processing Lecture 8, Page 23

    Color Image Display

    RedLUT

    RedGun

    GreenLUT

    RedGun

    Blue

    LUT

    Red

    Gun

    Red signal

    Green signal

    Blue signal

    0

    1

    255

    Input Output

    Fall 2004 EL512 Image Processing Lecture 8, Page 24

    Color Gamut

    Each color model has different color range (or gamut). RGB model has a larger gamut than CMY.

    Therefore, some color that appears on a screen may not be printable and is replaced by the closestcolor in the CMY gamut.

  • 8/3/2019 Color Coordinate

    7/12

    Fall 2004 EL512 Image Processing Lecture 8, Page 25

    Demo with Photoshop

    Using photoshop to show how out of gamut color

    (view->Gamut warning).

    Fall 2004 EL512 Image Processing Lecture 8, Page 26

    Gamma Correction

    The intensity to voltage response curve ofthe computer monitor is not linear.

    Gamma correction

    Sample Input to Monitor

    Output from Monitor

    Graph of Input

    Graph of Output L=V2.5

    Sample Input to Monitor

    Monitor Output

    Gamma corrected Input

    Graph of Input

    Graph of Output

    Graph of Correction L=L1/2.5

    Fall 2004 EL512 Image Processing Lecture 8, Page 27

    Color Quantization

    Select a set of colors that are most frequently used in animage, save them in a look-up table (also known as colormap or color palette)

    Any color is quantized to one of the indexed colors Only needs to save the index as the image pixel value

    and in the display buffer

    Typically: k=8, m=8 (selecting 256 out of 16 million)

    Input index (k bits) Red color (m bits) Green color (m bits) Blue color (m bits)

    Index 1

    .

    Index 2^k

    Fall 2004 EL512 Image Processing Lecture 8, Page 28

    Uniform vs. Adaptive Quantization

    Uniform (scalar quantization)

    Quantize each color component uniformly

    E.g. 24 bit-> 8 bit can be realized by using 3 bits (8 levels) forred, 3 bits (8 levels) for green, 2 bits (4 levels) for blue

    Do not produce good result

    Adaptive (vector quantization)

    Treating each color (a 3-D vector) as one entity. Findsthe Ncolors (vectors) that appear most often in agiven image, save them in the color palette

    (codebook). Replace the color at each pixel by the

    closest color in the codebook

    The codebook (I.e. color palette) varies from image toimage -> adaptive

  • 8/3/2019 Color Coordinate

    8/12

    Fall 2004 EL512 Image Processing Lecture 8, Page 29

    Illustration of the Vector Quantization

    x

    y

    x

    y

    Uniform Quantization Vector Quantization

    Codebook size: 25

    Fall 2004 EL512 Image Processing Lecture 8, Page 30

    24 bits -> 8 bits

    Adaptive (non-uniform) quantization(vector quantization)

    Uniform quantization(3 bits for R,G, 2 bits for B)

    Example of Color Image Quantization

    Fall 2004 EL512 Image Processing Lecture 8, Page 31

    Web Colors: 216 Safe RGB Colors

    These colors are those that can be rendered consistently by different computer systems. They are obtainedby quantizing the R,G,B component independently using uniform quanitization. Each component is

    quantized to 6 possible values: 0(0x00), 51(0x33), 102(0x66), 153(0x99), 204(0xCC), 255(0xFF).

    Fall 2004 EL512 Image Processing Lecture 8, Page 32

    Color Dithering

    Color quantization may cause contour effect when thenumber of colors is not sufficient

    Dithering: randomly perturb the color values slightly to

    break up the contour effect fixed pattern dithering diffusion dithering (the perturbed value of the next pixel depends

    on the previous one)

    Developed originally for rendering gray scale image using blackand white ink only

    Original

    value(R,G, or B)

    Ditheringvalue

    Dithered

    value

  • 8/3/2019 Color Coordinate

    9/12

    Fall 2004 EL512 Image Processing Lecture 8, Page 33

    8 bit uniformwithout dithering

    8 bit uniformwith diffusion dithering

    Example of Color Dithering

    Fall 2004 EL512 Image Processing Lecture 8, Page 34

    Demo Using Photoshop

    Show quantization results with different methods

    using image->mode->index color

    PaletteSystem(Windows)

    256 colors

    Fall 2004 EL512 Image Processing Lecture 8, Page 35

    Pseudo Color Image

    Why?

    Human eye is more sensitive to changes in

    the color hue than in brightness.

    How?

    Use different colors (different in hue) to

    represent different image features in amonochrome image.

    Fall 2004 EL512 Image Processing Lecture 8, Page 36

    Pseudo Color Display

    Intensity slicing: Display different gray levelsas different colors

    Can be useful to visualize medical / scientific /

    vegetation imagery E.g. if one is interested in features with a certain intensity

    range or several intensity ranges

    Frequency slicing: Decomposing an image intodifferent frequency components and represent

    them using different colors.

  • 8/3/2019 Color Coordinate

    10/12

    Fall 2004 EL512 Image Processing Lecture 8, Page 37

    Intensity Slicing

    Pixels with gray-scale (intensity) value in the range of (fi-1 , fi) are rendered with color Ci

    f0 =0

    C3

    C2

    C1

    f2f1 f3 f4

    C4

    Gray level

    Color

    Fall 2004 EL512 Image Processing Lecture 8, Page 38

    Example

    Fall 2004 EL512 Image Processing Lecture 8, Page 39

    Another Example

    Fall 2004 EL512 Image Processing Lecture 8, Page 40

    Pseudo Color Display of Multiple Images

    Display multi-sensor images as a single colorimage

    Multi-sensor images: e.g. multi-spectral images by

    satellite

  • 8/3/2019 Color Coordinate

    11/12

    Fall 2004 EL512 Image Processing Lecture 8, Page 41

    An Example

    Fall 2004 EL512 Image Processing Lecture 8, Page 42

    Example

    Fall 2004 EL512 Image Processing Lecture 8, Page 43

    Color Image Enhancement

    Enhance each primary color componentindependently using the techniques formonochrome images

    Will change the color hue of the originalimage

    Convert the tri-stimulus representation intoa luminance / chrominance representation,and enhance the contrast of the luminancecomponent only.

    Use HSI representation, where I truly reflectsthe luminance information.

    Fall 2004 EL512 Image Processing Lecture 8, Page 44

    Example of Color Image Enhancement

  • 8/3/2019 Color Coordinate

    12/12

    Fall 2004 EL512 Image Processing Lecture 8, Page 45

    Example of Color Image Enhancement

    Fall 2004 EL512 Image Processing Lecture 8, Page 46

    Example of Color Image Enhancement

    Fall 2004 EL512 Image Processing Lecture 8, Page 47

    Homework

    1. (Computer Assignment) Write a program which first performs highpass filtering(you can use matlab func conv2 for this part) of an input gray scale image using thefollowing filter:

    Scale the filtered image to range between 0 and 255. Then displays the filteredimage using 3 pseudo colors, using the following color transformation: Color Red forvalues 0-80, Color Green for values 81-160, color blue for values 161-255. In matlab,you can use the function colormapto change the colormap and use imshowtodisplay an image using a specified colormap. Comment on the visual effect, e.g.each color represents what attributes of the image?

    2. (Computer Assignment) Choose a 24 bit RGB color image, perform the followingoperations: 1) convert it to YIQ format, save the resulting images in three separatefiles (for Y, I and Q components respectively), each with 8 bits/pixel; 2) performhistogram equalization to the Y image; 3) convert the enhanced Y image and theoriginal I and Q image back to the RGB image. View the original and enhanced colorRGB images and comment on your observations.

    3. (Computer Assignment) Choose a 24 bit color RGB image, quantize the R, G, and Bcomponents to 3, 3, and 2 bits, respectively, using a uniform quantizer in the range0-256. Display the original and quantized color image using the original colormapassociated with the image. Comment on the difference in color accuracy. Make sureyou use a computer that has a 24 bit color display, and the test image has goodcolor contrast.

    010

    141

    010

    4

    1

    Fall 2004 EL512 Image Processing Lecture 8, Page 48

    Reading

    Prof. Yao Wangs Lecture Notes, Chapter6.

    R. Gonzalez, Digital Image Processing,Chapter 6.

    A. K. Jain, Fundamentals of Digital ImageProcessing, Section 3.7 ~ 3.11, 7.7 ~ 7.8.