Digital Image Processing: Image Restoration Matrix Formulation - Duong Anh Duc provides about matrix Formulation of Image Restoration Problem; constrained least squares filtering (restoration); a brief review of matrix differentiation; Pseudo-inverse Filtering; Minimum Mean Square Error (Wiener) Filter; Parametric Wiener Filter.
Digital Image Processing Image Restoration Matrix Formulation 21/11/15 Duong Anh Duc - Digital Image Processing Matrix Formulation of Image Restoration Problem 1-D Case: We will consider the 1-D version first, for simplicity: g(m) = f(m)*h(m) + (m) We will assume that the arrays f and h have been zeropadded to be of size M, where M length(f) + length(h) Henceforth, we will not explicitly mention the zero-padding The degradation equation: can be written in matrix-vector form as follows: g = Hf + n, where 21/11/15 Duong Anh Duc - Digital Image Processing Matrix Formulation of Image Restoration Problem H H1 h0 h1 h2 hM h h0 h1 hM h0 h1 h2 hM 21/11/15 h h h0 hM h0 h1 hM h M h M h M h0 0 h0 hM Duong Anh Duc - Digital Image Processing h0 Matrix Formulation of Image Restoration Problem However, since the arrays f and h are zeropadded, we can equivalently set: H H2 h0 h1 h2 hM hM h0 h1 hM hM hM h0 hM h1 h2 h3 h0 Notice that the (second) matrix H is circulant; i.e., each row of H is a circular shift of the previous row 21/11/15 Duong Anh Duc - Digital Image Processing Matrix Formulation of Image Restoration Problem Example: A = length of array f = B = length of array h = M A + B – = 4, say M = f 21/11/15 f f f h h0 h1 0 Duong Anh Duc - Digital Image Processing Matrix Formulation of Image Restoration Problem H1 21/11/15 h0 h1 h2 h3 h h0 h1 h2 h0 h1 h2 h3 h0 h1 h2 h h h0 h1 0 h0 h1 h h h h 0 h0 h0 h1 0 Duong Anh Duc - Digital Image Processing h0 h1 0 h0 h1 0 h0 Matrix Formulation of Image Restoration Problem H2 h0 h1 h2 h3 hM h0 h1 h2 h0 h1 h2 h3 h3 h0 h1 h2 h2 h3 h0 h1 hM hM h0 h1 h1 h2 h3 h0 hM hM hM h0 h0 h1 0 h0 h1 0 h0 h1 h1 0 h0 Notice that H1f = H2f Indeed 21/11/15 Duong Anh Duc - Digital Image Processing Matrix Formulation of Image Restoration Problem H1f h0 h1 0 h0 h1 0 h0 h1 0 h0 f f f h0 0 h1 f h1 h 0 f H 2f h1 h 0 f 0 h1 h 0 Henceforth, we will use H = H2 , so that we can apply properties of circulant matrices to H 21/11/15 Duong Anh Duc - Digital Image Processing Matrix Formulation of Image Restoration Problem 2-D Case: Suppose g, f, h, are M N arrays (after zeropadding) The degradation equation can be written in matrix-vector format as follows: g = Hf + n, where 21/11/15 Duong Anh Duc - Digital Image Processing Matrix Formulation of Image Restoration Problem g g 0,0 f 0,0 0,0 g 0, N g 1,0 f 0, N f 1,0 0, N 1,0 g 1, N f 1, N 1, N f n g M 1,0 f M 1,0 M 1,0 g M 1, N f M 1, N M 1, N 21/11/15 MN MN Duong Anh Duc - Digital Image Processing MN 10 Constrained Least Squares Restoration C0 C1 C Ci C M1 C0 C2 C1 C M1 C M2 p i,0 p i,1 C M2 C1 CM C2 C0 C M3 C3 C0 p i, N p i ,0 p i,1 p i ,2 p i, N p i, N p i,0 is a “smoothing matrix” and ˆf is a vector representing the restored image 21/11/15 Duong Anh Duc - Digital Image Processing 52 Constrained Least Squares Restoration Notice that C is a block circulant matrix As before, the solution to the above optimization problem is given by ^f = (HTH + CT C )-1HTg 21/11/15 Duong Anh Duc - Digital Image Processing 53 Constrained Least Squares Restoration Using properties of the block circulant matrix C, we get the following implementation of this filter: Fˆ u , v H * u, v H u, v where R u , v 21/11/15 P u, v G u, v R u, v G u , v H * u, v H u, v P u, v Duong Anh Duc - Digital Image Processing 54 Constrained Least Squares Restoration Here P(u,v) is the 2D-DFT of matrix p(m,n), after appropriate zeropadding Compare this with the parametric Wiener filter: R u, v H * u, v H u, v S u, v / S f u, v no power spectrum information is required in the constrained leastsquares restoration! 21/11/15 Duong Anh Duc - Digital Image Processing 55 Constrained Least Squares Restoration However, for the new filter to be optimal, the parameter must be chosen to satisfy the constraint ||g-Hˆf||= ||n|| Define the residual vector r = g-Hˆf = g - H (HTH + CT C )-1HTg Therefore, we need to choose such that ||r|| = ||n|| It can be shown that the function ( )= rTr = ||r||2 is a monotonically increasing function of We want to adjust so that ( ) = ||r||2 = ||n||2 ± a for some accuracy factor a 21/11/15 Duong Anh Duc - Digital Image Processing 56 Constrained Least Squares Restoration Since ( ) is monotonically increasing, this can be accomplished by the following procedure: Specify an initial value of = For k = 1, , …, compute ^fk = (HTH + kCT C )-1HTg This can be done using a frequency domain implementation: ^ Fk(u,v) = Rk(u,v)G(u,v), where Rk u, v 21/11/15 H * u, v H u, v k P u, v Duong Anh Duc - Digital Image Processing 57 Constrained Least Squares Restoration Compute k g Hfˆk If ( k)||n||2+a, k+1 MN G u, v v H u , v Fˆk u, v u = k+b, set k=k+1, return to step = k-b, set k=k+1, return to step Otherwise, STOP (current ^fk or ^Fk(u,v) is the restored image and is the optimal choice of parameter ) 21/11/15 Duong Anh Duc - Digital Image Processing 58 Constrained Least Squares Restoration Implementation of this procedure requires knowledge of ||n||2, which denotes the strength of noise If 2 η E η m, n and η E η m, n η Var η m, n are the noise mean and variance, respectively, then η 21/11/15 MN η m, n and m,n η MN η m, n m,n Duong Anh Duc - Digital Image Processing η n MN η2 59 Constrained Least Squares Restoration Therefore n MN η η which can be computed from knowledge of the mean and variance of noise 21/11/15 Duong Anh Duc - Digital Image Processing 60 Constrained LS Example f(m,n) 21/11/15 g(m,n) Duong Anh Duc - Digital Image Processing 61 Constrained LS Example ^ f(m,n), = 0.01 21/11/15 ^ f(m,n), = 0.442 Duong Anh Duc - Digital Image Processing ^ f(m,n), = 1 62 Geometric Distortion 21/11/15 Duong Anh Duc - Digital Image Processing 63 Gray-level Interpolation 21/11/15 Duong Anh Duc - Digital Image Processing 64 Example 21/11/15 Duong Anh Duc - Digital Image Processing 65 Example 21/11/15 Duong Anh Duc - Digital Image Processing 66 ... 21/11/15 Duong Anh Duc - Digital Image Processing g(m,n) MSE = 0.01 26 Pseudo-inverse Filtering ^f(x,y) 0076 MSE = 0.075 21/11/15 001 MSE = 0.3308 Duong Anh Duc - Digital Image Processing 27 Pseudo-inverse... MN block-circulant matrix with M M blocks 21/11/15 Duong Anh Duc - Digital Image Processing 11 Matrix Formulation of Image Restoration Problem Each block Hj is itself an N N circulant matrix. .. zero-padding The degradation equation: can be written in matrix- vector form as follows: g = Hf + n, where 21/11/15 Duong Anh Duc - Digital Image Processing Matrix Formulation of Image Restoration