ECE 78: Image Pocessing REVIEW Lectue #2 Mach 3, 23 Couse Outline! Intoduction! Digital Images! Image Tansfoms! Sampling and Quantization! Image Enhancement! Image/Video Coding JPEG MPEG Mach 3, 23 Mach 3, 23 2 Relationship between pixels! eighbohoods 4-neighbos (,S,W,E pixels) == 4 (p). Diagonal neighbos == D (p). 8-neighbos: include diagonal pixels == 8 (p).! Connectivity -> to tace contous, define object boundaies, segmentation. V: Set of gay level values used to define connectivity; e.g., V={}. Connected components! If p and q ae in S, p is connected to q in S if thee is a path fom p to q entiely in S.! Connected component: Set of pixels in S that ae connected; Thee can be moe than one such set within a given S.! Labelling of connected components. Mach 3, 23 3 Mach 3, 23 4 Distance Measues! What is a Distance Metic? Fo pixels p,q, and z, with coodinates (x,y), (s,t), and (u,v), espectively: Dpq (, ) ( Dpq (, ) = iff p= q) Dpq (, ) = Dqp (, ) Dpz (, ) Dpq (, ) + Dqz (, ) Linea systems-eview 2D impulse function Line function Step function Linea systems and Shift invaiance Impulse Response of LSI Systems 2-D Convolution Mach 3, 23 5 Mach 3, 23 6
2D FT: Popeties 2-D Digital Tansfoms Week II-III Lineaity: a f(x,y) + b g(x,y) Convolution: f(x,y) g(x,y) = F(u,v) G(u,v) Multiplicationn: f(x,y) g(x,y) = F(u,v) G(u,v) Sepaable functions: Suppose f(x,y) = g(x) h(y), Then F(u,v)=G(u)H(v) Shifting: f(x+x, y+y ) a F(u,v) + b G(u,v) exp[2π (x u + y v)] F(u,v) Mach 3, 23 7 Mach 3, 23 8 2-D DFT Often it is convenient to conside a symmetic tansfom: In 2-D: conside a X image - vk ( ) = ÂunW ( ) n= - un ( ) = Â vkw ( ) n= kn -kn and - - km ln vkl (,) = Â Â umn (, ) W W, m= n= - - umn (, ) = Â Â vkl (, ) W k= l= -km-ln Mach 3, 23 9 2D DFT Popeties: Peiodicity & Conjugate Symmety F u(m,n) v(k,l) v(k,l) = v(k+, l) = v(k, l+) = v(k+, l+) If u(m,n) is eal, v(k,l) also exhibits conjugate symmety v(k,l) = v* (-k, -l) o v(k,l) = v(-k, -l) Mach 3, 23 Rotation Linea Convolution using DFT Extended sequences Cicula convolution Mach 3, 23 Mach 3, 23 2
Discete Cosine Tansfom Conside - D fist; Let x(n) be a point sequence n -. 2 - point x(n) y(n) DFT 2 point point Y(u) C(u) xn ( ), n yn ( ) = xn ( ) + x( 2 n) = x( 2 n), n 2 x(n) y(n) Why DCT?! Blocking atifacts less ponounced in DCT than in DFT.! Good appoximation to the Kahunen- Loeve Tansfom (KLT) but with basis vectos fixed.! DCT is used in JPEG image compession standad. 2 3 4 2 3 4 5 6 7 8 Mach 3, 23 3 Mach 3, 23 4 Sampling and Quantization Sampling and Quantization 2D sampling theoem Optimal quantize Unifom quantize WEEK IV Mach 3, 23 5 Mach 3, 23 6 Sampled Spectum: Example Reconstuction R 2 R δr Mach 3, 23 7 Mach 3, 23 8
Image Quantization Quantization u (continuous ) Quantize u u ε {, 2, 3,..., L } k!optimal quantize! Unifom Quantize t t k t k+ t L+ u Mach 3, 23 9 Mach 3, 23 2 MMSE Quantize Minimise the mean squaed eo, MSE = Expected value of (u-u ) 2 given the numbe of quantization levels L. Assume that the density function p u (u) is known (o can be appoximated by a nomalised histogam). ote that fo images, u==image intensity. p u (u) is the image intensity ditibution. Mach 3, 23 2 Optimum tansition/econst. () Optimal tansition levels lie halfway between the optimum econstuction levels. (2) Optimum econstuction levels lie at the cente of mass of the pobabality density in between the tansition levels. (3) A and B ae simultaneous non-linea equations (in geneal) Closed fom solutions nomally dont exist use numeical techniques Mach 3, 23 22 Image Enhancement Image Enhancement WEEK V-VI! Point Opeations! Histogam Modification! Aveage and Median Filteing! Fequency domain opeations! Homomophic Filteing! Edge enhancement Mach 3, 23 23 Mach 3, 23 24
Equalization (contd.) Histogam Modification We ae inteested in obtaining a tansfomation function T( ) which tansfoms an abitay p.d.f. to an unifom distibution! Histogam Equalization! Histogam Specification p () p s (s) s Mach 3, 23 25 Mach 3, 23 26 Histogam specification z Suppose s= T() = p ( w) dw p () Oiginal histogam ; p () z Desied histogam z Let v= G() z = p ( w) dw and z= G () v But s and v ae identical p.d.f. z= G () v = G () s = G ( T()) z z Steps: () Equalize the levels of oiginal image (2) Specify the desied p z (z) and obtain G(z) (3) Apply z=g - (s) to the levels s obtained in step Example Poblem Which tansfomation should be applied in ode to change the 3 π histogam hb ( ) = b into tb ( ) = sin( πb)? 2 2 Mach 3, 23 27 Mach 3, 23 28 Median filteing Replace f (x,y) with median [ f (x, y ) ] (x, y ) E neighbouhood Useful in eliminating intensity spikes. ( salt & peppe noise) Bette at peseving edges. Invaiant Signals Invaiant signals to a median filte: Constant Monotonically inceasing deceasing Example: 2 2 (,5,2,2,2,2,2,25,) 2 5 2 Median=2 25 2 So eplace (5) with (2) Mach 3, 23 29 length? Mach 3, 23 3
Homomophic filteing (not discussed duing class lectue) Conside f (x,y) = i (x,y). (x,y) Illumination Reflectance ow I{ f( x, y)} I{. i } So cannot opeate on individual components diectly Let zxy (, ) = ln f( xy, ) = ln ixy (, ) + ln xy (, ) I { zxy (, )} = I {ln i} + I{ln } Z(, u v) = I + R; Let S(, u v) = HZ = HI + HR sxy (, ) =I { HI} +I { HR} Let i ( x, y) =I { HI} ; ( x, y) =I { HR} Mach 3, 23 3 IMAGE COMPRESSIO Week VIII-IX Mach 3, 23 32 Image compession Objective: To educe the amount of data equied to epesent an image. Impotant in data stoage and tansmission Pogessive tansmission of images (intenet, www) Video coding (HDTV, Teleconfeencing) Digital libaies and image databases Medical imaging Satellite images IMAGE COMPRESSIO! Data edundancy! Self-infomation and Entopy! Eo-fee and lossy compession! Huffman coding, Aithmetic coding! Pedictive coding! Tansfom coding Mach 3, 23 33 Mach 3, 23 34 Video Coding! Motion compensation! H.26, MPEG- and MPEG-2 The End Mach 3, 23 35 Mach 3, 23 36