Color Imaggge Processing
Inel 5327
Prof. Vidya Manian Introduction
• Color fundamentals • Color models • Histogram processing • ShidhiSmoothing and sharpening • Color image segmentation • Edge detection Color fundamentals
Chromatic light spans the EM spectrum from 400nm to 700nm. Quality of light source: Radiance, luminance and brightness Color fundamentals
• Radiance-total amount of energy that flows from the light source (watts, W) • Luminance-amount of energy an observer perceives (lumens , lm) • Brightness-embodies the achromatic notion of intensity • Absorption characteristics of the human eye • Blue=435.8nm , green=546 .1nm , red=700nm
• Characteristic used to distinguish one color from another – brightness, hue, and saturation • Chromaticity – hue and saturation taken together • Tristimulus values (X,Y and Z) – amounts of red, green, and blue needed to form any particular color • A color is then specified by
XYZ xyz,, X YZ XYZ XYZ • x+y+z=1 • CIE chromaticity diagram – used to specify colors • For any value of x and y, corresponding value of z (blue) is obtained from Figure. Chromaticity diagram
Color models • Also called color space or color system-facilitate specification of colors in some standard , accepted way • It is a specification of a coordinate system • RGB color model
CMY and CMYK color model
• [C M Y]’=[1 1 1]’-[R G B]’ HSI color model
• RGB not good for practical human interpretation • Hue, saturation and brightness –used for dibilbjdescribing a color object • Hue –color attribute describes pure color (pure yellow, orange or red) • Saturation-measure of degree to which a pure color is diluted byyg white light • Brightness-embodies achromatic notion of intensity
load trees yiq=rgb2ntsc(map); [y, i,q] = ind2rgb(X, yiq); figure subplot(2,2,2), imshow(y), title('Luminance'); subplot( (,,),2,2,3), imshow( (),i), title( 'Hue'); subplot(2,2,4), imshow(q), title('Saturation'); subplot(2,2,1), imshow(X,map), title('Original'); • hsv=rgb2hsv(map); • [h,s,v]=ind2rgb(X,hsv); • subplot(2,2,2), imshow(h), title('Luminance'); • subplot(2, 2, 3), imshow(s), title('saturation'); • subplot(2,2,4), imshow(v), title('value'); Converting from RGB to HSI
if BG B G H 360 if B>G 1 [(RG ) ( RB _ )] 1 2 cos 21/2 [(R GRBGB ) ( )( )] 3 SRGB1[min(,,)] ()R GB 1 I ()RGB 3
Manipulating HSI component images
Normalized RGB color space
R rR,G, B , R G B
G gR,G, B , R G B
B bRGB,, RGB
r g b 1 Pseudocolor image processing
• False color IP consists of assigning colors to gray values based on a specified criterion (generate color maps of classification) • Intensity slicing – using a plane at f(x,y)=li to slice ifiimage function to two l llevels
fxy()( , ) ck iff(xy)Vif f(x,y) Vk
ck is the color associated with the kth intensity interval, Vk is defined byyp the partitionin gpg planes at l=k-1 and l=k Intensity slicing
Color coding Intensity to color transformations
Color coding of multispectral image
Basics of full color image processing Color transformations
Perceptually uniform color space CIE L*a*b*
X 0.412453R 0.357580G 0.180423B Y 0.212671R 0.715160G 0.072169B Z 0.019334R 0.119193G 0.950227B
Y L* 116 f 16 Yn X Y a* 500 f f X n Yn Y Z b* 200 f f Yn Zn
q1/ 3, if q 0.008856 f (q) 7.787q 16/116, otherwise The tristimulus values Xn, Yn, Zn are those of the nominally white object-color stimulus given by a CIE standard illuminant Tone and color corrections
Histoggpram processin g
• Spread the color intensities uniformly, leaving the hues unchangg(ed (HSI s pace ) Color image smoothing
• Average of RGB component vectors in the neighborhood is • Smooth only the intensity component of the HSI representation 1 cxy(, ) cxy (, ) K (,)xy Sxy 1 Rxy(, ) K (,)xy Sxy 1 cxy()( , )( Gxy (), ) K (,)xy Sxy 1 Bxy(, ) K ()( xy, )S xy
Color image sharpening
• The Laplacian of vector c is 2R()(xy, ) 22 [(,)]cxy Gxy (,) 2 B(,xy )
Compppute Laplacian of a full-color imaggye by comp uting Laplacian of each component image separately
Image segmentation based on color • Segmentation in HSI color space
Color segmentation in RGB vector space • a –estimate of the “average” color that we wish to segment • Euclidean distance between an arbitrary point z in RGB space and a Dza(, ) z a [(z aza )T ( )]1/2 2221/2 [(zaRR ) ( za GG ) ( za BB ) ]
The locus of points such that D(z,a)D0 is a solid sphere of radius D0 A useful generalization to the distance measure C is the covariance matrix of the samples representative of the color we wish to segment Dza()[()( , )[() z aT C11/2 ( z a )]
Color edge detection (vector-valued images) • For scalar images -gradient is a vector pointing in the direction of maximum rate of change of f at coordinates (x,y) • DiZenzo, S. [1986]. “A note on the gradient of a multi - image”, CVGIP, Vol. 33, pp. 116-125. • r,g,b –unit vectors along the R, G, and B axis of RGB color space, dfidefine vectors R GB uggb x xx R GB vggb yyy • Define gxx, gyy and gxy in terms of the dot product of vectors u and v as: RRR222 guuuu. T xx xxx 222 RRR gvvvv. T yy yyy R RGGBB guvuv. T xy x yxyxy • It can be shown that (DiZenzo[1986]) the direction of maxifhf()iibhlimum rate of change of c(x,y) is given by the angle
1 1 2gxy tan 2(ggxxyy ) • This produces 2 values 90apart, associates with each point (x,y) a pair of orthogonal directions, along one direction F is maximum, and along the other F is minimum • The value of the range of change at (x,y), is given by
1/2 1 Fggggg() (xx yy ) ( xx yy )cos2 2 xy sin2 2
Noise in color images
Color image compression Exercises • In an automated assembly application, three classes of parts are to be color coded in order to simplify detection. However, only a monochrome TV camera is available to acquire digital images. Propose a technique for using this camera to detect the 3 different colors. • How would you implement the color equivalent of gray scale histogram matching from chapter 3 . • Show that Dza()[()( , )[() z aT C11/2 ( z a )] reduces to Dza(, ) z a [(za )T ( za )]1/2 2221/2 [(zaRR ) ( za GG ) ( za BB ) ] When C=I (identity matrix).