cg08 color

Upload: xuan-khuong

Post on 04-Feb-2018

218 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/21/2019 CG08 Color

    1/37

    K thut ho1

    Bi 6:Musctrong ha Color model

  • 7/21/2019 CG08 Color

    2/37

    K thut ho2

    M hnh mu - color model

    M hnh mu l h thng c quy tc cho vic to khong mu t tpcc mu c bn.

    Khong mu m chng ta to ra vi tp cc mu c bn goi l gam

    mu h thng systems color gamut.

    Mi m hnh mu c khong mu hay gam mu ring gamut (range)ca nhng mu m n c th hin th hay in.

    Mi m hnh mu c gii hn khong ca ph mu nhn c.Gam mu hay khong cn c gi l khng gian mu "color space".

    nh hay ho vector c th ni: s dng khng gian mu RGM hayCMY hay bt c khng gian mu no khc

    Mt s ng dng ho cho php ngi dng s dng nhiu mhnh mu ng thi son tho hay th hin i tng hnh hc.

    im quan trng l hiu v ch ng m hnh cn thit cho cngvic.

  • 7/21/2019 CG08 Color

    3/37

    K thut ho3

    C 2 loi m hnh mu l:

    Mu thm additive:M hnh mu thm s dngnh sng - light hin th mu. Mu sc ca m

    hnh ny l kt qu ca nh sng tryn dn -transmitted

    Mu b subtractive:m hnh m b s dng mcin - printing inks. Mu sc cm nhn c l t nh

    sng phn x - reflectedlight.

  • 7/21/2019 CG08 Color

    4/37

    K thut ho4

    Php trn mu Colour Mixing

    Additive: spectrum of light is the result ofaddition of individual spectra

    CRT colour mixing LCD projectors

    Subtractive: colour resulting from theselective absorption of light wavelengths paints

    dyes

    + =

    =

  • 7/21/2019 CG08 Color

    5/37

    M hnh mu thmAdditive Model RGB

    Khi 2 ngun sng kt hp th kt qu thuc l s thm vo ca ca phn bph nng lng

    Thomas Young (1801) 3 mu c bn red,green, blue tng i s cho ra 3 mu thcp yellow, cyan, magenta;

    Mu trng thu c khi kt hp c 3 mu

    S thay i cng ca cc mu thnh

    phn s to c gi tr mu bt k trongph mu --spectral hues

    Mn hnh mu s dng nguyn l 3 muthm

  • 7/21/2019 CG08 Color

    6/37

    K thut ho6

    M hnh mu RGB (Red - Green - Blue) - Lc - Lam

    Additive Color Model

    C = rR + gG + bB

    C = color or resulting light,

    (r,g,b) = color coordinates in range0 1, cng c nh sng chiuhay b 3 gi tr kch thchtristimulus values RGB

    (R,G,B) = red, green, blue primary

    colors. Nu 2 mu to ra cng 1 gi tr

    kch thch th chng ta khngth phn bit c 2 mu

  • 7/21/2019 CG08 Color

    7/37

    RGB Color Model

    Advantages relates easily to CRT operation easy to implement

    Disadvantages RGB values generally not transferable betweendevices (no standard `red phosphor)

    not perceptually (colours close together near whiteare distinguishable, but not true near black)

    not intuitive - eg where is skin colour? ng dng

    CRT display transparency slide film

  • 7/21/2019 CG08 Color

    8/37

    K thut ho8

    Device Dependency

    This is a vector spacewith thebasis vectors defined by the

    properties of the monitorphosphors.

    If the phosphors change thecolour space changes.

    We cannot use RGB touniversally define a colour.

    we require a deviceindependent colour space.

    R G B S p a c e 1

    RGB Sp a c e

  • 7/21/2019 CG08 Color

    9/37

    K thut ho9

    Subtractive color - Mu bCMY- (Cyan, Magenta, Yellow)

    M hnh mu CMY- xanh tm, ti,vng

    M hnh mu b - Subtractive color

    modelshin th nh sng v mu scphn x t mc in. Bxung thm mcng ngha vi nh sng phn x cng t.

    Khi b mt khng ph mc th nh sngphn x l nh sng trng - white.

    Khi 3 mu c cng gi tr cho ramu xm. Khi cc gi tr t maxcho mu en

    Color = cC + mM + yY

    B

    G

    R

    Y

    M

    C

    1

    1

    1

  • 7/21/2019 CG08 Color

    10/37

    K thut ho10

    M hnh mu CMY- K

    M hnh mrngcaCMY ngdngtrong myin mu. Gi tr en b xung vo thay th chohm lngmubngnhau ca3 mucbn.

    Cng thcchuyni:K = min(C, M, Y) ;

    C = C - K ;

    M = M - K;Y = Y K ;

    C-Cyan, M-Magenta, Y-Yellow; K-blacK

  • 7/21/2019 CG08 Color

    11/37

    K thut ho11

    M hnh mu YIQ

    M hnh muYIQ l m hnh mucngdngtrongtruynhnh mubng tnrng tiM,v do n cmiquan hchtchvimn hnh homu raster.

    YIQ l sthay icaRGB cho khnngtruynpht

    v tnh tngthch viti vi entrngthhtrc. Tnhiu truyn s dng trong h thng NTSC (NationalTelevision System Committee).

    S bin i RGB thnh YIQ c xc nh theocng thc sau:

    Yis luminance, I & Q i lng v mu sc

    Note: Y is the same as CIEs Y

    B

    G

    R

    Q

    I

    Y

    0 311523212

    0 321275596

    0 114587299

  • 7/21/2019 CG08 Color

    12/37

    K thut ho12

    The Munsell Color System

    Albert Henry Munsell, an American artist.

    Da trn tri gic cm nhn, Rational way to describecolor" s dng k php m t thp phn n gin

    thay vo tn mu, ( he considered "foolish" and"misleading.") 1898 with the creation of his color sphere, or tree A Color Notation, in 1905. a mu chun standard for

    colorimetry (the measuring of color). Munsell m hnh h h thng nh l qu o ca cc mc

    quay quanh ph mu. Trc ca qu o l trc en trng t l vi en l trc nam

    en tai trc bc (black as the south pole.) Extending horizontally from the axis at each gray value is a

    gradation of color progressing from neutral gray to fullsaturation.

    With these three defining aspects, any of thousands ofcolors could be fully described. Munsell named these

  • 7/21/2019 CG08 Color

    13/37

    K thut ho13

    HueMunsell defined hue as "the quality by whichwe distinguish one color from another." Heselected five principle colors: red, yellow,green, blue, and purple; and five intermediate

    colors: yellow-red, green-yellow, blue-green,purple-blue, and red-purple; and he arrangedthese in a wheel measured off in 100compass points

    ValueValue was defined by Munsell defined valueas "the quality by which we distinguish a light

    color from a dark one." Value is a neutral axisthat refers to the grey level of the color. Thisranges from white to black. As notations suchas 10R, 5YR, 7.5PB, etc. denote particularhues, the notation N is used to denote thegray value at any point on the axis. Thus avalue of 5N would denote a middle gray, 2N adark gray, and 7N a light gray. In Munsell'soriginal system, values 1N and 9N are,respectively, black and white, though this was

  • 7/21/2019 CG08 Color

    14/37

    K thut ho14

    Chroma

    Chroma is the quality thatdistinguishes the difference from apure hue to a gray shade. Thechroma axis extends from the valueaxis at a right angle and the amountof chroma is noted after the valuedesignation. Thus 7.5YR 7/12indicates a yellow-red hue tendingtoward yellow with a value of 7 and

    a chroma of 12: However, chroma is not uniform for

    every hue at every value. Munsellsaw that full chroma for individualhues might be achieved at very

    different places in the color sphere.For exam le the fullest chroma for

  • 7/21/2019 CG08 Color

    15/37

    K thut ho15

    M hnh mu HSVYu t cm nhn

    Hue - sc mu dng phn bits khc nhau gia cc mu nh

    xanh, ,vng...

    Saturation - bo ho: chra mcthuncamtmu hay khong

    cch camutiimc cngcn bng(muxm) Lightness - sng: hinthn vm tcngsng tnh sng

    phnxnhnctitng.

    Brighitness (pht sng). cngnh sng m titngpht

    ra chkhng phido phnxtcc ngunsng khc.

  • 7/21/2019 CG08 Color

    16/37

    K thut ho16

    M hnh mu HSV( Hue, Saturation, Value )

    M hi`nh mu RGB, CMY, YIQ cnh hng cho phn cng

    HSV=HSB nh hng ngi sdngdatrn cs vtrcgic v

    tng mu, scvscthi mthut HSV, 1978 by Alvey Ray Smith

    Hue: sc0-360

    Value-Brightness:(sng) 0-1

    Saturation: bo ho0-1 odd and anti-intuitive when the

    strength of the colour of whiteis considered

  • 7/21/2019 CG08 Color

    17/37

    K thut ho17

    HSV Color Space

    Khng gian mu trc quan H = Hue

    S = Saturation

    V = Value (or brightness)

    ValueSaturation

    Hue

  • 7/21/2019 CG08 Color

    18/37

    K thut ho18

    Chuyn i HSV-RGB

    Khi S=0 H ko tham gia //en trng R = V;

    G = V;

    B = V;

    Else//CHROMATIC case H = H/60; I = Floor(H);// ly gi tr nguyn F = H I; M = V*(1 S); N = V*(l S*F);

    K = V*(1S*(1F))

    if I = 0 then (R,G,B) = (V,K,M);

    If I = 1 then (R, G, B) = (N, V, M);

    if I = 2 then (R, G, B) = (M, V, K);

    if I = 3 then (R, G, B) = (M, N, V);

    if I = 4 then (R, G, B) = (K, M, V);

  • 7/21/2019 CG08 Color

    19/37

    Hue, Lightness, Saturation Model

    M hnh thng c s dngtrong k thut ho.

    u im intuitive(trc gic): choose hue,

    vary lightness, vary saturation

    Nhc im Chuyn i vi RGB c sai s

    (cube stood on end) thay i trntrn cc loi mn hnh khc nhau.

    khng c cm nhn u

  • 7/21/2019 CG08 Color

    20/37

    K thut ho20

    HSV (Hue, Saturation and Value),HLS (Hue, Luminance and Saturation)HSI (Hue, Saturation and Intensity)

  • 7/21/2019 CG08 Color

    21/37

    K thut ho21

    Nhc im RGB

    Kt qu thc nghim cho thy rt nhiu nhng nhsng mu khng th to thnh t 3 thnh phn mu c

    c vi nguyn nhn do v ca vng mc - retinalcortex.

    Vi mu Cyan: cng ca nh sng 2 mu green vblue kch thch cm nhn mu trong mt ngn khng

    cho thu c mu chnh xc Cch duy nht thu c mu ny l loi bt phn

    mu bng cch thm nh sng vo mu ban u.

    Bng cch thm t t nh sng vo thu c (test +

    red) s cho ra mu ng bng (blue + green)

  • 7/21/2019 CG08 Color

    22/37

    K thut ho22

    CIE stands for Com iss ion Internat ionale de l 'Eclairage(International Commission on Illumination).

    Commission thnh lp 1913 tomt in n quc t v to i tng v thng tin cng nh

    tp chun - set standards chonhng vn lin quan nnh sng.

    M hnh mu CIE color pht

    trin trn c s hon ton clp thit b

    Da trn s cm nhn ca camt ngi v mu sc.

    Yu t c bn ca m hnh CIE nh n ha trn chun v n un

  • 7/21/2019 CG08 Color

    23/37

    K thut ho23

    Standard Sources & Standard ObserverThe following CIE standard sources were defined in 1931:

    Ngun chun - Standard Sources Source A tungsten-filament lamp with a color temperature of 2854K Source B model of noon sunlight with a temperature of 4800K Source C model of average daylight with a temperature of 6500K

    Ngun B v C c th thu t ngun A thng qua lc t phn b ph cangun A.

    Ngi quan st chun - Standard ObserverCIE 1931 c 2 c t cho chun ngi quan st v b xungnm 1964

    Standard observer l s kt hp c nhm nh cc c th (about 15-20) vl i din cho h quan st mu sc ca ngi thng-normal human colorvision.

    Cc c t s dng k thut tng t thu c nhng mu c 3 gitr kch thch tng ng vi 3 kch thch t RGB - RGB tristimulus value

    CIEXYZ: l m hnh CIE gc s dng s mu c chp nhnnm 1931.

    http://www.adobe.com/support/techguides/color/colormodels/ciexyz.htmlhttp://www.adobe.com/support/techguides/color/colormodels/cieluv.htmlhttp://www.adobe.com/support/techguides/color/colormodels/ciexyz.html
  • 7/21/2019 CG08 Color

    24/37

    K thut ho24

    CIE XYZ - Color Space

    CIE - Cambridge, England, 1931.vi tng 3 i lng nh snglights mu X, Y, Z cng ph

    tng ng: Mi sng nh sng c th cm

    nhn c bi s kt hp ca 3i lng X,Y,Z

    M hnh - l khi hnh khng gian3D X,Y,Z gm gamutca tt ccc mu c th cm nhn c.

    Color = XX + YY + ZZ

    XYZ tristimulus values thay th

  • 7/21/2019 CG08 Color

    25/37

    K thut ho25

    CIE XYZ

    CIE s dng 3 gi tr XYZ tristimulus hnhthnh nn tp cc gi tr v kt ta mu -chromaticity m t bng xyz

    u im ca 3 loi mu nguyn l c bn l cth sinh ra cc mu trn c s tng cc i lngdng ca mu mi thnh phn.

    Vic chuyn i t khng gian mu 3D ta (X,Y,Z) vo khng gian 2D xc nh bi ta (x,y),theo cng thc di phn s ca ca tng 3thnh phn c bn.

    x = X/(X+Y+Z) , y = Y/(X+Y+Z) , z = Z/(X+Y+Z) x + y + z = 1

  • 7/21/2019 CG08 Color

    26/37

    K thut ho26

    CIE's 1931xyY - The chromaticity coordinatesv chromaticity diagram

    Chun CIE xc nh 3 mu githuyt hypothetical colors,X,Y, and Zlm c s cho php

    trn mu theo m hnh 3 thnhphn kch thch - tristimulusmodel.

    Khng gian mu hnh mng

    nga -horseshoe-shaped lkt hp ca khng gian ta 2D mu-chromaticity x, y v sng.

    x = 700 nm;

    y = 543.1 nm;z = 435.8 nm

  • 7/21/2019 CG08 Color

    27/37

    K thut ho27

    M hnhCIE xyY

    Thang o ca Y xut pht t imtrng trn ng thng vung gc vimt phng x,y vi gi tr t 0 to 100.

    Khang mu ln nht khi Y=0 ti imtrng v bng CIE Illuminant C. yl y ca hnh.

    Khi Y tng mu tr nn sng hn vkhong mu hay gam mu gim dintch trn ta x,y cng gim theo

    Ti im trn khng gian vi Y= 100mu c sc xm bc v khong mu y l b nht.

    Khng s dng s mu xyY nh l nh x cho vic ch ra quan h gia ccmu.S l l khng gian phng gii hn bi ng cong m php nh x quanh mu ca khng gian quan st c b vn mo.Vid d: mu khng thuc khong xanh lc s thuc phn hay tm.

    X = x(Y/y) , Y = Y , Z = (1 - x - y)(Y/y)

  • 7/21/2019 CG08 Color

    28/37

    K thut ho28

    u im

    Cung cp Chun chuyn i gi tr mu m

    bo ho thnh thng tin ca cc m

    hnh mu khc. 1 cch nh ngha v xc nh trc

    quan v n gin v mu b thngqua gii thut hnh hc cth tnhton.

    nh ngha t nhin v sc thi tintv n gin ho vic nh lng gitr ca thuc tnh ny

    C s cho nh ngha gam mu

    (space) cho mn hnh hay thit bhin th. Gam ca mn hnh RGB

  • 7/21/2019 CG08 Color

    29/37

    K thut ho29

    CIE-LUV

    hiu chnh iu , s t l mu ng dng-uniform chromaticityscale (UCS) c a ra.

    S UCS s dng cng thc ton chuyn i gi trXYZhay ta x,ythnh 1 cp cc gi tr mi (u,v) biu din 1 cch trc quan v

    chnh xc m hnh 2 chiu 1960 CIE ch nh n lo i UCS v vi tn 1960 CIE u vChromaticit

    Trong s mi on thng m t s khc bit vmu sc tng ng vi t l bng nhau.Khong cch gia 2 u ca mi on thng ccm nhn l nh nhau theo CIE 1931 2 standard

    observer.Chiu di on thng l bin thin v c th rtln ph thuc vo v tr c chng trn biu S khc bit gia chiu di ca on thng cngchnh l s bin dng mo gia cc phn ca

    th.

  • 7/21/2019 CG08 Color

    30/37

    K thut ho30

    CIE u ,vChromaticity Diagram:

    So snh UCS vi s 1931diagramtrc ,khc bit l sko di vng mu lam- blue-red ca s v sh thay i vtr ca im chi trng n ngim trng thy s khc bit cavng mu lc.

    Ty nhin iu vn khng tho

    mn cho n nm1975, 1976 CIE a ra s sa i ca

    s u,vthay bng 2 gi tr mi(u',v') bng cch nhn vvi 1.5.

    S mi c dng chuyn i. u'= u

    http://www.adobe.com/support/techguides/color/colormodels/ciexyz.html#1931_xyzhttp://www.adobe.com/support/techguides/color/colormodels/ciexyz.html#1931_xyzhttp://www.adobe.com/support/techguides/color/colormodels/ciexyz.html#1931_xyzhttp://www.adobe.com/support/techguides/color/colormodels/ciexyz.html#1931_xyz
  • 7/21/2019 CG08 Color

    31/37

    K thut ho31

    CIE uv

    Ty khng phi l ton din nhng s u',v'a ra s ng dng tthn hn so vi u,v.

    on thng trong s u',v'cng c hnh dng ging nh trongx,ynhng quan st cho thy chng gn nh ng dng vi nhau.

    Mt im khc bit to to nn m hnh CIELUV l s thay thango gi tr sng Y bng thang o L*. Thang o ca Y l t l ng dng ca sng vi cc bc thay i

    l bng nhau. Tuy nhin t l ny cha tho ng khi biu din s khc bit tng

    ng v sng.

  • 7/21/2019 CG08 Color

    32/37

    K thut ho32

    CIE LUV

    sng Yc cho l khng khc bit vi gi tr lcng l khong l 70 hay 75. V con s s khc bitl 5 tuy chng ta khng phn bit c s khc bit gia

    gi tr thp hay cao cng nh im nm gia. S dng cng thc ton, gi tr Ychuyn thnh gi tr khc

    xp x v ng dng ch ra s khc bit 1 cch d dng. Thang o mi L*, gn ging vi thang o h thng

    Munsell. S khc bit r rng nht l L* s dng thang o0-100, trong khi Munsell's s dng thang o 0-10.

    Thang o sng L*c s dng trong CIELAB cngnh CIELUV. Gi tr ca CIELUV tng t CIEXYZ v CIE

    xyY l tnh c lp thit b v v vy ore not restrained by

    gamut. Vi c ht trin theo CIEXYZ vx Y s cho h biu din

  • 7/21/2019 CG08 Color

    33/37

    K thut ho33

    CIE-LAB

    CIELAB l h thng th 2 c CIEchp nhn nm 1976 nh l m hnhmu biu din tt hn gi tr mung dng.

    CIELAB l h thng mu i nghch datrn h thng ca Richard Hunter [1942]gi l L, a, b.

    S i mu c pht hin ra vo

    khong gia nm 60s hat: ti 1 v tr giathn kinh th gic v no hay vng mcs kch thch mu c chuyn thnh skhc bit ga ti v sng (light and dark)gia v lc( red and green), gia lam

    v vng( blue and yellow).

  • 7/21/2019 CG08 Color

    34/37

    K thut ho34

    CIE - LAB

    Trcmudatheo nguyn l: mukhng thclnlchay lam v vng v chng l muilnnhau.Trn mitrcgi trchytdngnm. Trn trca-a', gi trdngchra tngcamutrong khi m

    chra tngmuxanh. Trn trcb-b', muvng dngv lam m. Trn c2 trczero cho muxm

    Nhvygi trchcn2 trcmcn sng hay mcxmsdngtrc(L*), khc bithnviRGB, CMY or XYZ sngphthucvo tngtngquan cacc knh mu.

    CIELAB v desktop color. clpthitb(unlike RGB and CMYK), L m hnh mucscho Adobe PostScript (level 2 and level 3) cdng l m hnh qunl muclpthitbcho ICC

    (International Color Consortium

  • 7/21/2019 CG08 Color

    35/37

    K thut ho35

    XYZ RGB Conversion

    Ultimate goal: select most appropriate RGBvalues to match the hue and luminance of aspectral source.

    380 780

    56.0

    32.0

    11.0

    B

    G

    R

  • 7/21/2019 CG08 Color

    36/37

    K thut ho36

    RGB XYZ Conversion

    Recall linear relationship between XYZ and RGBspaces:

    Linear system can be solved if positions of 3 colours

    are known in both spaces. Sometimes manufacturers provide tristimulus values

    for monitor phosphors = (Xr, Yr, Zr) (Xg, Yg, Zg) (Xb,Yb, Zb)

    BG

    R

    aaaaaa

    aaa

    ZY

    X

    333231

    232221

    131211

  • 7/21/2019 CG08 Color

    37/37

    K th t h 37

    RGB XYZ Conversion

    Solution of the linear system:

    Note:

    and similarly for G = 1 and B = 1.

    BG

    R

    ZZZYYY

    XXX

    ZY

    X

    bgr

    bgr

    bgr

    r

    r

    r

    Z

    Y

    X

    Z

    Y

    X

    B

    G

    R

    0

    0

    1