chapter 6 : color image processing

43
CCU, Taiwan Wen-Nung Lie Chapter 6 : Color Image Processing

Upload: others

Post on 22-Nov-2021

1 views

Category:

Documents


0 download

TRANSCRIPT

CCU, TaiwanWen-Nung Lie

Chapter 6 : Color Image Processing

6-1CCU, TaiwanWen-Nung Lie

Color FundamentalsSpectrum that covers visible colors : 400 ~ 700 nmThree basic quantities

Radiance : energy that flows from the light source (measured in Watts)Luminance : a measure of energy an observer perceives from a light source (in lumens)Brightness : a subjective descriptor difficult to measure

6-2CCU, TaiwanWen-Nung Lie

About human eyesPrimary colors for standardization

blue : 435.8 nm, green : 546.1 nm, red : 700 nm

Not all visible colors can be produced by mixing these three primaries in various intensity proportionsCones in human eyes are divided into three sensing categories

65% are sensitive to red light, 33% sensitive to green light, 2% sensitive to blue (but most sensitive) The R, G, and B colors perceived by human eyes cover a range of spectrum

6-3CCU, TaiwanWen-Nung Lie

Primary and secondary colors of light and pigments

Secondary colors of lightmagenta (R+B), cyan (G+B), yellow (R+G)R+G+B=white

Primary colors of pigmentsmagenta, cyan, and yellowM+C+Y=black

6-4CCU, TaiwanWen-Nung Lie

ChromaticityHue + saturation = chromaticity

hue : an attribute associated with the dominant wavelength or dominant colors perceived by an observersaturation : relative purity or the amount of white light mixed with a hue (the degree of saturation is inversely proportional to the amount of added white light)

Color = brightness + chromaticityTristimulus values (the amount of R, G, and B needed to form any particular color : X, Y, Z

trichromatic coefficients :

)/( ZYXXx ++= )/( ZYXYy ++= )/( ZYXZz ++=

6-5CCU, TaiwanWen-Nung Lie

Chromaticity diagramShow color composition as a function of x, y, and zSpectrum colors are indicated around the boundary of the tongue-shaped chromaticity diagramPoint of equal energy : equal fractions of three primary colors → CIE defined white lightPoints located on the boundary of chromaticity diagram are fully saturated -- the saturation at the center point is zero

6-6CCU, TaiwanWen-Nung Lie

Chromaticity diagram (cont.)A straight line segment joining any two points defines all color variations of the combination of themNo three colors in the diagram can span the whole color space -- not all colors can be obtained with three single and fixed primariesThe color gamut produced by RGB monitors ⇒The color printing gamut is irregularly-shaped ⇒

6-7CCU, TaiwanWen-Nung Lie

Color models, Color spaceA color model is a specification of a coordinate system within which each color is represented by a single pointHardware-oriented color models

e.g., color monitors and printersRGB, CMY (cyan, magenta, yellow), CMYK (+black)

Application-oriented color modelHSI (hue, saturation, intensity)

6-8CCU, TaiwanWen-Nung Lie

RGB color modelEach color appears in its primary spectral components of R, G, and BBased on a Cartesian coordinate system (cube)

6-9CCU, TaiwanWen-Nung Lie

CMY and CMYK color modelsUseful in color printers and copiersConversion between RGB and CMY

In practice, combining CMY colors produces a muddy-looking black. To produce true black, a forth color, black, is added ⇒ CMYK color model

⎥⎥⎥

⎢⎢⎢

⎡−

⎥⎥⎥

⎢⎢⎢

⎡=

⎥⎥⎥

⎢⎢⎢

BGR

YMC

111

6-10CCU, TaiwanWen-Nung Lie

HSI color modelRGB, CMY, and similar others are not practical for human interpretationHue : a color attribute that describes a pure colorSaturation : a measure of the degree to which a pure color is diluted by white lightDerivation of HSI from RGB color cube

All points contained in the plane segment defined by the intensity axis (i.e., from black to white) and one color point on the boundaries of the cube have the same hue

6-11CCU, TaiwanWen-Nung Lie

HSI color model (cont)The HSI space is represented by a vertical intensity axis, the length (saturation) of a vector from the axis to a color point, and the angle (hue) this vector makes with the red axisThe power of HSI color model is to allow independent control over hue, saturation, and intensity

6-12CCU, TaiwanWen-Nung Lie

Conversion between RGB and HSI

From RGB to HSI

From HSI to RGBRG sector (0°<H<120°)

⎩⎨⎧

>−≤

=GBGB

H if 360 if

θθ

⎭⎬⎫

⎩⎨⎧

−−+−−+−

= −2/12

21

1

)])(()[()]()[(cosBGBRGR

BRGRθ

)],,[min()(

31 BGRBGR

s++

−= )(31 BGRI ++=

)1( SIB −= ])60cos(

cos1[H

HSIR−

+=o

)(3 BRIG +−=

6-13CCU, TaiwanWen-Nung Lie

Conversion between RGB and HSI (cont)

GB sector (120°<H<240°)

BR sector (240°<H<360°)

o120−= HH

])60cos(

cos1[H

HSIG−

+=o )(3 GRIB +−=

o240−= HH

])60cos(

cos1[H

HSIB−

+=o )(3 BGIR +−=

)1( SIR −=

)1( SIG −=

6-14CCU, TaiwanWen-Nung Lie

HSI ⇔ RGB

RGB

HSI

6-15CCU, TaiwanWen-Nung Lie

YUV color modelYUV color model has been used in PAL TV systems.The luminance Y can be determined from RGB model asThe other two chrominance components, U and V, are defined as color difference as

For Completeness, an expression of YUV in terms of RGB is listed below

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

−−−−=

⎥⎥⎥

⎢⎢⎢

BGR

VUY

100.0515.0615.0436.0289.0147.0114.0587.0299.0

BGRY 114.0587.0299.0 ++=

)(877.0 )(493.0 YRVYBU −=−=

6-16CCU, TaiwanWen-Nung Lie

YCbCr color modelIt is noted that U and V may be negative as well. In order to make chrominance components nonnegative, the Y, U and V are shifted to produce the YCbCr model, which is used in the international coding standards JPEG and MPEG

The inverse operation⎥⎥⎥

⎢⎢⎢

⎡+

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

−−−−=

⎥⎥⎥

⎢⎢⎢

12812816

439.0291.0148.0071.0368.0439.0

098.0504.0257.0

BGR

CbCrY

)128(017.2)16(164.1')128(392.0)128(813.0)16(164.1'

)128(596.1)16(164.1'

−+−=−−−−−=

−+−=

CbYBCbCrYG

CrYR

Reference: B.G. Haskell, A. Puri, A.N. Netravali, Digital Video: An introduction to MPEG-2, Chapman & Hail, 1997Y.Q. Shi, H. Sun, Image and Video compression for multimedia engineering, CRC press, 1999

6-17CCU, TaiwanWen-Nung Lie

Conversion between YUV and YCbCr

From YUV to YCbCr

⎥⎥⎥

⎢⎢⎢

⎡+

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

⎡=

⎥⎥⎥

⎢⎢⎢

12812816

714.0000007.1000860.0

VUY

CrCbY

6-18CCU, TaiwanWen-Nung Lie

Gray level to color transformation -- pseudocolor

Three independent transformation on the graylevels, i.e., establish a color mapping system for graylevelsSome standardized CMSs exist, e.g., ironball for infrared image displayIf all three transforms are the same --> monchrome

6-19CCU, TaiwanWen-Nung Lie

Effect of different gray to color transformations

6-20CCU, TaiwanWen-Nung Lie

Color composition for multi-spectral images

Often used in display of multi-spectral satellite imagesMap three bands out of multi-spectra into RGB for color display

RGB = (red, green, blue)

RGB = (near IR, green, blue)

6-21CCU, TaiwanWen-Nung Lie

Full-color image processingFull-color and interpretations of its various color-space componentsMethod 1

Process each component image individually and form a composite processed color image from the individually processed components

Method 2Work with color pixels directly

6-22CCU, TaiwanWen-Nung Lie

• There is a discontinuity in HSI model where 0° and 360°of hue meet

• Hue is undefined for 0 saturation

6-23CCU, TaiwanWen-Nung Lie

Color transformationTransform a vector in color space to another vector -- color mapping function

Transformation on a per-color-component basis

Some operations are better suited to specific models

Modify pixel intensity ⇒ HSI is suitable (but the cost for conversion from RGB or CMY to HSI is costly)

nirrrTs nii ,...,2,1 ,),...,,( 21 ==

nirTs iii ,...,2,1 ,)( ==

6-24CCU, TaiwanWen-Nung Lie

Saturation should be altered to implement complement

Color complements

Color circle

Approximation only

6-25CCU, TaiwanWen-Nung Lie

Color slicing

⎪⎩

⎪⎨⎧

⎥⎦⎤

⎢⎣⎡ >−

= ≤≤

otherwise 2

,5.0nj1

i

anyjj

i

r

Warifs

nir

Rarifsi

jji ,...2,1 ,

otherwise

)( ,5.0n

1j

20

2

=⎪⎩

⎪⎨⎧

>−= ∑

=

(a1, a2, …,an) is the prototype or average color

Highlighting a specific range of colors in an image

6-26CCU, TaiwanWen-Nung Lie

Device-independent color model (CIE L*a*b* model)

Unlike RGB and CMY which are specific for certain devices (monitors and printers)Characteristics of L*a*b* color model

The choice for many color management system (CMS)Being colorimetricPerceptually uniform (color differences are perceived uniformly)Device-independentEncompass the entire visible spectrum and can represent accurately the colors of any display, print, or input deviceAn excellent decoupler of intensity (L*) and color (a* : red minus green, b* : green minus blue), making it useful in both image manipulation and image compression applications

6-27CCU, TaiwanWen-Nung Lie

CIE L*a*b* model

are reference white tristimulas values and X, Y, and Z are tristimulas values of any colorThe degree to which the luminance is separated from the color in L*a*b* is greater than in other color models

⎩⎨⎧

≤+>

=008856.0 116/16787.7008856.0 ,)(

3

qqqqqh

⎥⎦

⎤⎢⎣

⎡⎟⎟⎠

⎞⎜⎜⎝

⎛−⎟⎟⎠

⎞⎜⎜⎝

⎛=

⎥⎦

⎤⎢⎣

⎡⎟⎟⎠

⎞⎜⎜⎝

⎛−⎟⎟⎠

⎞⎜⎜⎝

⎛=

−⎟⎟⎠

⎞⎜⎜⎝

⎛⋅=

WW

WW

W

ZZh

YYhb

YYh

XXha

YYhL

200

500*

16116

*

*

),,( WWW ZYX

6-28CCU, TaiwanWen-Nung Lie

Color image tonal correction Tonal correction to provide a proper key (tone) of an image (just like to correct the brightness of a graytone image)

Hue of color is not changedFor RGB and CMYK -- map all color components with the same transformation functionFor HSI – only the intensity component is modified

6-29CCU, TaiwanWen-Nung Lie

Tonal correction

6-30CCU, TaiwanWen-Nung Lie

Color image histogram equalization

Modify brightness and contrast without influencing the hue and saturation

Operation on intensity component only (e.g., HSI model)

Adjustment of hue or saturation is common when working with the intensity component in HSI space since change in intensity usually affect the relative appearance of colors in an image

6-31CCU, TaiwanWen-Nung Lie

Histogram equalization

6-32CCU, TaiwanWen-Nung Lie

Color balancing correction

To reduce magenta ⇒remove both red and blue or add greenThe color ring is useful as a reference tool for identifying color printing problem

6-33CCU, TaiwanWen-Nung Lie

Color image smoothing)1( SIB −=

Smoothing on independent R, G, and B planesSmoothing on intensity plane of HSI modelThe above two results are different

])60cos(

cos1[H

HSIR−

+=o

)(3 BRIG +−=

When I increases with α ⇒ αB, αR, and αG

6-34CCU, TaiwanWen-Nung Lie

Color image sharpeningSharpening on independent R, G, and B planesSharpening on intensity plane of HSI modelThe above two results are different

6-35CCU, TaiwanWen-Nung Lie

Color segmentation -- in HSI space

To extract image regions that have desired range of colors

processing on hue imagesaturation image is used as masking to isolate ROIless frequently used for intensity image

Binary saturation mask

Grayscale histogramming of (f)

6-36CCU, TaiwanWen-Nung Lie

Color segmentation -- in RGB space

Measure color similarity in terms of Euclidean distance

within spherical, elliptical, or bounded box region

Get much more accurate result than in HSI space

result

matrixcovariance: )]()[(or ),( 2

11

CazCazazaz −−−= −TD

6-37CCU, TaiwanWen-Nung Lie

Color edge detectionGradient operation defined on color vectors

bgruxB

xG

xR

∂∂

+∂∂

+∂∂

= bgrvyB

yG

yR

∂∂

+∂∂

+∂∂

=

222

xB

xG

xRgxx ∂

∂+

∂∂

+∂∂

=⋅= uu222

yB

yG

yRg yy ∂

∂+

∂∂

+∂∂

=⋅= vv

yB

xB

yG

xG

yR

xRgxy ∂

∂∂∂

+∂∂

∂∂

+∂∂

∂∂

=⋅= vu

⎥⎥⎦

⎢⎢⎣

−= −

)(2

tan21 1

yyxx

xy

ggg

θ

[ ] 21

2sin22cos)()(21)(

⎭⎬⎫

⎩⎨⎧ +−++= θθθ xyyyxxyyxx gggggF

r,g,b : Unit vectors along R, G, and B axes

θ : direction of maximum change

F(θ) : Rate of change (gradient)

6-38CCU, TaiwanWen-Nung Lie

Computing the gradients on individual images and then adding them to form a composite gradient image will lead to different results from those obtained by gradient operation on color vectorsEdge detail of the vector gradient image is more completeMore computational burden for vector gradient operation

6-39CCU, TaiwanWen-Nung Lie

Vector gradient

Individual gradients difference

6-40CCU, TaiwanWen-Nung Lie

Noise in color imagesHow noise carries over when converting from one color model to another

Fine grain noise tends to be less visually noticeable in a color image than it is in a monochrome imageSignificantly degrade the hue and saturation components of the noisy images, but slightly smooth out the intensity image (since I=(R+G+B)/3)

6-41CCU, TaiwanWen-Nung Lie

Less visually noticeable

HSI model

6-42CCU, TaiwanWen-Nung Lie

When only one RGB channel is affected by noise, conversion to HSI spreads the noise to all HSI component images

Noise on green channel