Sie sind auf Seite 1von 50

ColorScienceand

ImageRepresentation
IT6902;SemesterB,2004/2005;Leung
ColorScienceand
ImageRepresentation2
IT6902;SemesterB,2004/2005;Leung
ColorScience
Introduction
LightandSpectra
HumanVision
SpectralSensitivityoftheEye
ImageFormation
ColorRepresentationandSpecification
Color-MatchingFunctions
CIEChromaticityDiagram
Out-of-GamutColors
ColorMonitorSpecification
SubtractiveColor:CMYColorModel
PerceptionofColor
SimultaneousContrast
MachBands
ColorScienceand
ImageRepresentation3
IT6902;SemesterB,2004/2005;Leung
LightandSpectra
Lightisanelectromagnetic(EM)wave
Visiblelightrangesfrom400nmto700nm
Source: http://escience.anu.edu.au/lecture/cg/Color/visibleSpectrum.en.html
ColorScienceand
ImageRepresentation4
IT6902;SemesterB,2004/2005;Leung
LightandSpectra(2)
SpectralPowerDistribution(SPD),orspectrum,E(),
showstherelativeamountoflightenergyateach
wavelength

E()
SpectrumofDaylight
ColorScienceand
ImageRepresentation5
IT6902;SemesterB,2004/2005;Leung
HumanVision
Retinaconsistsofanarrayof
rodsandthreekindsofcones
Rodsarefornightvision
Conesareforcolorvision
Source: http://webvision.med.utah.edu/sretina.html
Three kinds of cones:
1. L-cone: most sensitive to red light
2. M-cone: most sensitive to green light
3. S-cone: most sensitive to blue light
ColorScienceand
ImageRepresentation6
IT6902;SemesterB,2004/2005;Leung
SpectralSensitivityoftheEye
Theeyeismostsensitivetolightinthemiddleofthevisible
spectrum.
Theresponseineachcolorchannelintheeyeisproportionalto the
numberofneuronsring.
RedReceptorSensitivityq
R
()
GreenReceptorSensitivityq
G
()
BlueReceptorSensitivityq
B
()
Luminous-efficiencyfunctionV(): q
R
()
q
G
()
q
B
()
V()

overallsensitivitythatisformedby
thesumoftheresponsecurvesfor
Red,GreenandBlue
The Blue receptor sensitivity is
not shown to scale because it is
much smaller than the curves
for Red or Green.
ColorScienceand
ImageRepresentation7
IT6902;SemesterB,2004/2005;Leung
SpectralSensitivityoftheEye(2)
Totalresponseoneachchannelisgivenby:
R = E()q
R
()d
G = E()q
G
()d
B = E()q
B
()d
q
R
()
q
G
()
q
B
()
V()

E()
SpectrumofDaylight
Source: http://escience.anu.edu.au/lecture/cg/Color/colorPerception.en.html
ColorScienceand
ImageRepresentation8
IT6902;SemesterB,2004/2005;Leung
ImageFormation
Lightfromtheilluminant(lightsource)withSPDE()impingesona
surface,withsurfacespectralreflectancefunctionS(),isreflected,
andthenisfilteredbytheeye'sconefunctionsq().
Thecolorsignal C(),isdefinedbyC() = E() S()
Totalresponseoneachchannelisnowgivenby
R = E() S() q
R
() d = C() q
R
() d
G = E() S() q
G
() d = C() q
G
() d
B = E() S() q
B
() d = C() q
B
() d
ColorScienceand
ImageRepresentation9
IT6902;SemesterB,2004/2005;Leung
Color-MatchingFunctions
Theparticularsetofthreebasiclights
R,G,Busedinthisexperimentis
calledthesetofcolorprimaries.
Color-matchingexperiment:Tomatch
agivencolor,asubjectisaskedto
separatelyadjustthebrightnessof
thethreeprimariesusingasetof
controlsuntiltheresultingspotoflight
matchesmostcloselywiththedesired
color.
Colorimeter:Adeviceforcarryingout
thecolor-matchingexperiment
ColorScienceand
ImageRepresentation10
IT6902;SemesterB,2004/2005;Leung
Color-MatchingFunctions(2)
TheamountsofR,G,andBthesubjectselectstomatcheach
single-wavelengthlightformsthecolor-matchingcurves.
Colorprimaries:peaksat440nm,545nmand580nm
CIE RGB color-matching functions
) ( ), ( ), ( b g r
) ( r
) ( g
) ( b

The negative part of the curve


Indicates that some color cannot be
reproduced by a linear combination
of the primaries. For such color,
one or more primary lights has to be
shifted from one side to the other
Commission Internationale de LEclairage
ColorScienceand
ImageRepresentation11
IT6902;SemesterB,2004/2005;Leung
CIEChromaticityDiagram
Sincethe color-matchingcurvehasanegativelobe,asetof
fictitiousprimariesweredevisedthatleadtocolor-matching
functionswithonlypositivesvalues.
Theyarea33matrixawayfrom curves,andaredenoted
CIE RGB color-matching functions
) ( r
b g r , ,
) ( ), ( ), ( z y x
) ( r
) ( g
) ( b

CIE standard color-matching functions


ColorScienceand
ImageRepresentation12
IT6902;SemesterB,2004/2005;Leung
CIEChromaticityDiagram(2)
Thematrixischosensuchthatthemiddlestandardcolor-matching
function exactlyequalstheluminous-efficiencycurveV()
) ( y
CIE standard color-matching functions
q
R
()
q
G
()
q
B
()
V()

ColorScienceand
ImageRepresentation13
IT6902;SemesterB,2004/2005;Leung
CIEChromaticityDiagram(3)
ForageneralSPDE(),theessentialcolorimetric information
requiredtocharacterizeacoloristhesetoftristimulus valuesX,Y,Z
(Y ==luminance):
3-Ddataisdifficulttovisualize,sotheCIEdeviseda2-Ddiagram
basedonthetristimulus values(X,Y,Z)
WedividethetriplebythesumX+Y+Z tomakethechromaticity:
x = X/(X +Y +Z)
y = Y/(X +Y +Z)
z = Z/(X +Y +Z)
Thiseffectivelymeansthatonevalueoutoftheset(x,y,z)is
redundantsincewehavex + y + z =(X+Y+Z)/(X +Y +Z) = 1
sothatz = 1 - x - y



d z E Z
d y E Y
d x E X

=
=
=
) ( ) (
) ( ) (
) ( ) (
ColorScienceand
ImageRepresentation14
IT6902;SemesterB,2004/2005;Leung
CIEChromaticityDiagram(4)
Effectively,weareprojectingeachtristimulus vector(X,Y,Z)ontothe
planeconnectingpoints(1,0,0),(0,1,0),and(0,0,1).
Sincex,y 1andx + y 1,allpossiblechromaticityvaluesliebelow
thedasheddiagonalline
Source: http://www.dgp.toronto.edu/~karan/courses/csc418/fall_2002/notes/colour.html
3-D
2-D
ColorScienceand
ImageRepresentation15
IT6902;SemesterB,2004/2005;Leung
CIEChromaticityDiagram(5)
Thecolormatchingcurveseachadduptothesamevaluethe
areaundereachcurveisthesameforeachof
ForanE()=1forall,anequi-energywhitelight,chromaticity
valuesare(1/3,1/3).
Source: http://escience.anu.edu.au/lecture/cg/Color/CIEChromaticityDiagram.en.html
thelocusofpointsfor
monochromaticlight
- Pure colors
- Mostsaturated
) ( ), ( ), ( z y x
Whitepoint
- unsaturated
ColorScienceand
ImageRepresentation16
IT6902;SemesterB,2004/2005;Leung
ColorMonitorSpecifications
Colormonitorsarespecifiedinpartbythewhitepointchromaticity
thatisdesirediftheRGBelectrongunsareallactivatedattheir
highestvalue(1.0,ifwenormalizeto[0,1]).
Thereareseveralmonitorspecificationsincurrentuse:
ColorScienceand
ImageRepresentation17
IT6902;SemesterB,2004/2005;Leung
Out-of-GamutColors
ThetriangulargamutfortheNTSCsystemisshownontheCIE
diagram.Amonitorcandisplayonlythecolorsinsideatriangular
gamut.
WhatdowedoifanyoftheRGBnumbersisnegative?Thatcolor,
visibletohumans,isout-of-gamutforourdisplay.Wecouldsimply
usetheclosestin-gamutcoloravailable
ColorScienceand
ImageRepresentation18
IT6902;SemesterB,2004/2005;Leung
SubtractiveColor:
CMYColorModel
Sofar,wehavebeendealingonlywithadditivecolor.Namely,when
twolightbeamsimpingeonatarget,theircolorsadd;whentwo
phosphorsonaCRTscreenareturnedon,theircolorsadd.
Butforinkdepositedonpaper,theoppositesituationholds:yellow
inksubtractsbluefromwhiteillumination,butreflectsredand green;
itappearsyellow.
Instead of red, green, and blue
primaries, we need primaries that
amount to -red, -green and blue, i.e.,
we need to subtract R, G or B.
These subtractive color primaries are
Cyan (C), Magenta (M) and Yellow (Y)
inks.
ColorScienceand
ImageRepresentation19
IT6902;SemesterB,2004/2005;Leung
TransformationfromRGBtoCMY
Simplestmodelwecaninventtospecifywhatinkdensitytolay
downonpaper,tomakeacertaindesiredRGBcolor:
Thentheinversetransformis:

B
G
R
Y
M
C
1
1
1

Y
M
C
B
G
R
1
1
1
ColorScienceand
ImageRepresentation20
IT6902;SemesterB,2004/2005;Leung
Undercolor Removal:CMYKSystem
Undercolor removal:Sharperandcheaperprintercolors:calculate
thatpartoftheCMYmixthatwouldbeblack,removeitfromthe
colorproportions,andadditbackasrealblack.

=
K Y
K M
K C
Y
M
C
Y M C K } , , min{
RGB is used to specify
additive color
CMY is used to specify
subtractive color
ColorScienceand
ImageRepresentation21
IT6902;SemesterB,2004/2005;Leung
Illusion1
Whichpinkpixels(AorB)havelargerluminance?
A
B
http://www.eyetricks.com/0204.htm
ColorScienceand
ImageRepresentation22
IT6902;SemesterB,2004/2005;Leung
SimultaneousContrast
Ourperceptionissensitivetoluminancecontrast
ratherthantheabsoluteluminancevalues
Weberslaw:iftheluminancef
o
ofanobjectis
justnoticeablydifferentfromtheluminancef
s
of
itssurround,thentheirratiois
constant =

o
o s
f
f f
ColorScienceand
ImageRepresentation23
IT6902;SemesterB,2004/2005;Leung
Illusion2
Stareatthedotinthemiddle,doyouseethe
outeredgesofthecirclefadeaway?
http://www.eyetricks.com/1002.htm
ColorScienceand
ImageRepresentation24
IT6902;SemesterB,2004/2005;Leung
MachBands
Spatialinteractionofluminancefromanobjectanditssurround
createsaphenomenoncalledtheMachbandeffect
Thiseffectshowsthatbrightnessisnotamonotonicfunctionof
luminance
http://www.engr.udayton.edu/faculty/jloomis/ece563/notes/color/GrayScale/grays.html
ColorScienceand
ImageRepresentation25
IT6902;SemesterB,2004/2005;Leung
ImageRepresentation
Pixel
1-BitBinaryImagesand8-BitGray-LevelImages
ImageManipulation
ChangingtheImageResolution
ChangingtheBrightness
ChangingtheContrast
HistogramEqualization
Dithering
24-BitColorImagesand8-BitColorImages
ColorLookUpTables(LUTs)
Median-CutAlgorithm
ColorScienceand
ImageRepresentation26
IT6902;SemesterB,2004/2005;Leung
Pixel
Pixel:contractionofthewordspicture and
element.Apixelcorrespondstothesmallest
detailinapicturethatonewantstopreserve.
pixel
ColorScienceand
ImageRepresentation27
IT6902;SemesterB,2004/2005;Leung
1-BitBinaryImages
Eachpixelisstoredasasinglebit(0or1),soreferredto
asbinaryimage.
Suchanimageisalsocalleda1-bitmonochromeimage
sinceitcontainsnocolor.
ColorScienceand
ImageRepresentation28
IT6902;SemesterB,2004/2005;Leung
8-BitGray-LevelImages
Eachpixelhasagray-valuebetween0and255.Each
pixelisrepresentedbyasinglebyte(8bits);e.g.,adark
pixelmighthaveavalueof10,andabrightonemightbe
230.
Bitmap:Thetwo-dimensionalarrayofpixelvaluesthat
representsthegraphics/imagedata.
Imageresolutionreferstothenumberofpixelsina
digitalimage,say6464(higherresolutionalwaysyields
betterquality).
ColorScienceand
ImageRepresentation29
IT6902;SemesterB,2004/2005;Leung
BitsperPixel
Bits per pixel
Bands of gray values that can be specified by a fixed
number of bits in the binary representation of the pixels
If number of bits increase by one,
number of gray values will double
As the number of different gray
levels increases, it becomes
harder for us to visually distinguish
the boundaries between the
different levels
ColorScienceand
ImageRepresentation30
IT6902;SemesterB,2004/2005;Leung
ExampleImages
1-Bit Binary Images
8-Bit Gray-Level
ColorScienceand
ImageRepresentation31
IT6902;SemesterB,2004/2005;Leung
ChangingtheImageResolution
Thepixelvalueisasampleoflightintensity.Samplingcanbe
consideredastheprocessoftakingsamplesoflightintensitytoform
thepixels.
Theresolutionofanimagecanbemadesmallerbydownsampling,
e.g.,keepingonepixelforevery22blockofpixels.Thesampling
rateisdescreased afterdownsampling.
Samplingartifacts:distortionsarisinginasampledimagewhenthe
samplingrateistoosmalltocapturethefinestdetailintheinput
image.Thisresultingeffectiscalledspatialaliasing.
256256 128128 6464
3232
ColorScienceand
ImageRepresentation32
IT6902;SemesterB,2004/2005;Leung
ChangingtheBrightness
Brightnesscanbechangedbyaddingor
subtractingaconstantvaluetoallpixelvalues
Whensumordifferenceisnotapossiblepixel
value,thenearestpossiblevalueisused
Original image Image with
increased brightness
ColorScienceand
ImageRepresentation33
IT6902;SemesterB,2004/2005;Leung
ChangingtheContrast
Addanoffsetandthenmultiplewithaconstant
valuetoallpixelvalues
Whenresultisnotapossiblepixelvalue,the
nearestpossiblevalueisused
Original image Image with
increased contrast
ColorScienceand
ImageRepresentation34
IT6902;SemesterB,2004/2005;Leung
NegativeImage
Subtractaconstantvaluefromallpixelvalues
Film:negative;Photograph:positive
Original image Negative Image
ColorScienceand
ImageRepresentation35
IT6902;SemesterB,2004/2005;Leung
Histogram
Afunctionshowing,foreachintensitylevel,thenumberofpixelsinthe
imagethathavethatgraylevel.Thex-axisistheintensitylevelandthe
y-axisisthefrequencyofoccurrence(numberofpixels)
ColorScienceand
ImageRepresentation36
IT6902;SemesterB,2004/2005;Leung
HistogramEqualization
Objective:transformaninput
imagetoanoutputimagewith
equallymanypixelsatevery
graylevel(aflathistogram)
Afterhistogramequalization,
actualhistogramwillusually
takeonaratherragged
appearanceduetothefinite
numberofavailablegraylevels.
Somegraylevelswillbe
unoccupiedandothershighly
populated
Before histogram equalization
After histogram equalization
ColorScienceand
ImageRepresentation37
IT6902;SemesterB,2004/2005;Leung
Dithering
Whenanimageisprinted,thebasicstrategyofdithering
isused,whichtradesintensityresolutionforspatial
resolutiontoprovideabilitytoprintmulti-levelimageson
2-level(1-bit)printers.
Ditheringisusedtocalculatepatternsofdotssuchthat
valuesfrom0to255correspondtopatternsthatare
moreandmorefilledatdarkerpixelvalues,forprinting
ona1-bitprinter.
Themainstrategyistoreplaceapixelvaluebyalarger
pattern,say22or44binarymatrix,suchthatthe
resultingblackandwhitedotpatternapproximates
shading.
ColorScienceand
ImageRepresentation38
IT6902;SemesterB,2004/2005;Leung
Dithering(2)
Forexample,ifweusea22dithermatrix
wecanfirstre-mapimagevaluesin0..255intothenewrange0..4
by(integer)dividingby256/5.Then,e.g.,ifthepixelvalueis0we
printnothing,ina22areaofprinteroutput.Butifthepixelvalueis
4weprintallfourdots.
Theruleis:Iftheintensityis>thedithermatrixentrythenprintanon
dotatthatentrylocation.Replaceeachpixelbyann n matrixof
dots.
|
.
|

\
|
1 3
2 0

240 180
69 122
|
.
|

\
|
1 3
2 0

4 3
1 2

1 1 1 0
1 1 1 1
0 0 1 0
0 1 0 1
|
.
|

\
|
1 3
2 0
|
.
|

\
|
1 3
2 0
|
.
|

\
|
1 3
2 0
Dither
matrix
Dithered
Binary Image
22 Gray-
Level Image
Integer divide
by 256/5
Example:
ColorScienceand
ImageRepresentation39
IT6902;SemesterB,2004/2005;Leung
Dithering(3)
Thedithermatrixcanbe44insteadof22
Exampleimages
|
|
|
.
|

\
|
5 13 7 15
9 1 11 3
6 14 4 12
10 2 8 0
Q: How to derive the 88 dither matrix ?
Detail of
Dithered version
Dithered
Binary Image
Original Gray-
Level Image
ColorScienceand
ImageRepresentation40
IT6902;SemesterB,2004/2005;Leung
24-BitColorImages
Inacolor24-bitimage,eachpixelisrepresentedby
threebytes,usuallyrepresentingRGB.
Thisformatsupports256256256possiblecombinedcolors,or
atotalof16,777,216possiblecolors.
Howeversuchflexibilitydoesresultinastoragepenalty:A
64048024-bitcolorimagewouldrequire900KB
(64048024/8/1024)ofstoragewithoutanycompression.
Many24-bitcolorimagesareactuallystoredas32-bit
images,withtheextrabyteofdataforeachpixelusedto
storeanalphavaluerepresentingspecialeffect
information(e.g.,transparency).
ColorScienceand
ImageRepresentation41
IT6902;SemesterB,2004/2005;Leung
24-BitColorImages(2)
Example
24-Bit Color Image R Channel
B Channel G Channel
ColorScienceand
ImageRepresentation42
IT6902;SemesterB,2004/2005;Leung
24-BitColorImages(3)
Example
24-Bit Color Image
R Channel B Channel
G Channel
ColorScienceand
ImageRepresentation43
IT6902;SemesterB,2004/2005;Leung
8-BitColorImages
Manysystemscanmakeuseof8bitsofcolor
information(theso-called256colors)inproducinga
screenimage.
Suchimagefilesusetheconceptofalookuptableto
storecolorinformation.
Basically,theimagestoresnotcolor,butinsteadjusta
setofbytes,eachofwhichisactuallyanindexintoa
tablewith3-bytevaluesthatspecifythecolorforapixel
withthatlookuptableindex.
ColorScienceand
ImageRepresentation44
IT6902;SemesterB,2004/2005;Leung
8-BitColorImages(2)
Example
8-Bit Color Image
3-D Histogram
ColorScienceand
ImageRepresentation45
IT6902;SemesterB,2004/2005;Leung
ColorLookupTable
Theideausedin8-bitcolorimagesistostoreonlytheindex,or
codevalue,foreachpixel.Then,e.g.,ifapixelstoresthevalue25,
themeaningistogotorow25inacolorlook-uptable(LUT).
Averysimpleanimationprocessispossibleviasimplychangingthe
colortable:thisiscalledcolorcyclingorpaletteanimation.
ColorScienceand
ImageRepresentation46
IT6902;SemesterB,2004/2005;Leung
HowtoDeviseaColorLookupTable
Approach1:Themoststraightforwardwaytomake8-bitlook-up
coloroutof24-bitcolorwouldbetodividetheRGBcubeintoequal
rectangularblocks.
Thecentersofeachoftheresultingrectangularblockswouldserve
astheentriesinthecolorLUT.
SincehumansaremoresensitivetoRandGthantoB,wecould
shrinktheRrangeandGrange0..255intothe3-bitrange0..7and
shrinktheBrangedowntothe2-bitrange0..3,thusmakingupa
totalof8bits.
ColorScienceand
ImageRepresentation47
IT6902;SemesterB,2004/2005;Leung
HowtoDeviseaColorLookupTable(2)
Approach2:Median-CutAlgorithm:Asimplealternate
solutionthatdoesabetterjobforthiscolorreduction
problem.
TheideaistosorttheRbytevaluesandfindtheir
median;thenvaluessmallerthanthemedianarelabeled
witha0 bitandvalueslargerthanthemedianare
labeledwitha1 bit.
Thistypeofschemewillindeedconcentratebitswhere
theymostneedtodifferentiatebetweenhighpopulations
ofclosecolors.
Onecanmosteasilyvisualizefindingthemedianby
usingahistogramshowingcountsatposition0..255.
ColorScienceand
ImageRepresentation48
IT6902;SemesterB,2004/2005;Leung
HowtoDeviseaColorLookupTable(3)
Median-cutalgorithm
Blue bit 3, for red bit 1==0
and green bit 2==0
Blue bit 3, for red bit 1==0
and green bit 2==1
Blue bit 3, for red bit 1==1
and green bit 2==0
Blue bit 3, for red bit 1==1
and green bit 2==1
(65536)
(32768) (32768)
(32768)
(32768)
(16384) (16384) (16384) (16384)
(16384) (16384) (16384) (16384)
(8192) (8192) (8192) (8192) (8192) (8192) (8192) (8192)


ColorScienceand
ImageRepresentation49
IT6902;SemesterB,2004/2005;Leung
Summary
Introduction
LightandSpectra
HumanVision
SpectralSensitivityoftheEye
ImageFormation
ColorRepresentationand
Specification
Color-MatchingFunctions
CIEChromaticityDiagram
Out-of-GamutColors
ColorMonitorSpecification
SubtractiveColor:CMYColor
Model
PerceptionofColor
SimultaneousContrast
MachBands
Pixel
1-BitBinaryImagesand8-Bit
Gray-LevelImages
ImageManipulation
ChangingtheImageResolution
ChangingtheBrightness
ChangingtheContrast
HistogramEqualization
Dithering
24-BitColorImagesand8-Bit
ColorImages
ColorLookUpTables(LUTs)
Median-CutAlgorithm
Color Science Image Representation
ColorScienceand
ImageRepresentation50
IT6902;SemesterB,2004/2005;Leung
References
1. Ze-Nian LiandMarkS.Drew:Fundamentalsof
Multimedia,(PrenticeHall,2004,ISBN:0130618721)
2. KennethR.Casleman :DigitalImageProcessing,
(PrenticeHall,1996,ISBN:0132114674)
3. GeoffreyC.Orsak,SallyL.Wood,ScottC.Douglas,
DavidC.Munson,JohnR.Treichler,Ravindra A.
Athale,MarkW.Yoder,MarkA.Yoder:Engineering
OurDigitalFuture:TheInfinityProject,(PrenticeHall,
2003,ISBN:0130354821)
4. AnilK.Jain:FundamentalsofDigitalImage
Processing,(PrenticeHall,1989,ISBN:0133361659)

Das könnte Ihnen auch gefallen