Problems with Matlab Projects? You may face many Problems, but do not worry we are ready to solve your Problems. All you need to do is just leave your Comments. We will assure you that you will find a solution to your project along with future tips. On Request we will Mail you Matlab Codes for Registered Members of this site only, at free service...Follow Me.

Fast Algorithms for Total Variation Image Restoration

Introduction

In electrical engineering and computer science, image processing refers to any form of signal processing in which the input is an image and the output can be either an image or a set of parameters related to the image. Generally, image processing includes image enhancement, restoration and reconstruction, edge and boundary detection, classification and segmentation, object recognition and identification, compression and communication, etc. Among them, image restoration is a classical problem and is generally a preprocessing stage of higher level processing. In many applications, the measured images are degraded by blurs; e.g. the optical system in a camera lens may be out of focus, so that the incoming light is smeared out, and in astronomical imaging the incoming light in the telescope has been slightly bent by turbulence in the atmosphere. In addition, images that occur in practical applications inevitably suffer from noise, which arise from numerous sources such as radiation scatter from the surface before the image is sensed, electrical noise in the sensor or camera, transmission errors, and bit errors as the image is digitized, etc. In such situations, the image formation process is usually modeled by the following equation
f(x)=(k*u)(x)+ω(x),xΩ,


(1)
where u(x) is an unknown clean image over a region ΩR2, “*" denotes the convolution operation, k(x),n(x) and f(x) are real-valued functions from R2 to R representing, respectively, convolution kernel, additive noise, and the blurry and noisy observation. Usually, the convolution process neither absorbs nor generates optical energy, i.e., Ωk(x)normaldx=1, and the additive noise has zero mean.
Deblurring or decovolution aims to recover the unknown image u(x) from f(x) and k(x) based on (Equation 1). When k(x) is unknown or only an estimate of it is available, recoveringu(x) from f(x) is called blind deconvolution. Throughout this module, we assume that k(x) is known and ω(x) is either Gaussian or impulsive noise. When k(x) is equal to the Dirac delta, the recovery of u(x) becomes a pure denoising problem. In the rest of this section, we review the TV-based variational models for image restoration and introduce necessary notation for analysis.

Total Variation for Image Restoration

The TV regularization was first proposed by Rudin, Osher and Fatemi in [12] for image denoising, and then extended to image deblurring in [11]. The TV of u is defined as
TV(u)=Ωu(x)normaldx.


(2)
When u(x) does not exist, the TV is defined using a dual formulation [18], which is equivalent to (Equation 2) when u is differentiable. We point out that, in practical computation, discrete forms of regularization are always used where differential operators are replaced by ceratin finite difference operators. We refer TV regularization and its variants as TV-like regularization. In comparison to Tikhonov-like regularization, the homogeneous penalty on image smoothness in TV-like regularization can better preserve sharp edges and object boundaries that are usually the most important features to recover. Variational models with TV regularization and 2 fidelity has been widely studied in image restoration; see e.g. [4][3]and references therein. For 1 fidelity with TV regularization, its geometric properties are analyzed in [2][16][17]. The superiority of TV over Tikhonov-like regularization was analyzed in [1][5] for recovering images containing piecewise smooth objects.
Besides Tikhonov and TV-like regularization, there are other well studied regularizers in the literature, e.g. the Mumford-Shah regularization [9]. In this module, we concentrate on TV-like regularization. We derive fast algorithms, study their convergence, and examine their performance.

Discretization and Notation

As used before, we let · be the 2-norm. In practice, we always discretize an image defined on Ω, and vectorize the two-dimensional digitalized image into a long one-dimensional vector. We assume that Ω is a square region in R2. Specifically, we first discretize u(x) into a digital image represented by a matrix URn×n. Then we vectorize U column by column into a vector uRn2, i.e.
ui=Upq,i=1,...,n2,


(3)
where ui denotes the ith component of uUpq is the component of U at pth row and qth column, and p and q are determined by i=(q1)n+p and 1qn. Other quantities such as the convolution kernel k(x), additive noise ω(x), and the observation f(x) are all discretized correspondingly. Now we present the discrete forms of the previously presented equations. The discrete form of (Equation 1) is
f=Ku+ω,


(4)
where in this case, u,ω,fRn2 are all vectors representing, respectively, the discrete forms of the original image, additive noise and the blurry and noisy observation, and KRn2×n2 is a convolution matrix representing the kernel k(x). The gradient u(x) is replaced by certain first-order finite difference at pixel i. Let DiR2×n2 be a first-order local finite difference matrix at pixel i in horizontal and vertical directions. E.g. when the forward finite difference is used, we have
Diu=(
ui+nui
ui+1ui
)R2,


(5)
for i=1,...,n2 (with certain boundary conditions assumed for i>n2n). Then the discrete form of TV defined in (Equation 2) is given by
TV(u)=
n2
i=1
 Diu.


(6)
We will refer to
minTV(u)+
μ
2
 Kuf2
(7)
with discretized TV regularization (Equation 6) as TV/L2. For impulsive noise, we replace the 2 fidelity by 1 fidelity and refer to the resulted problem as TV/L1.
Now we introduce several more notation. For simplicity, we let i be the summation taken over all pixels. The two first-order global finite difference operators in horizontal and vertical directions are, respectively, denoted by D(1) and D(2) which are n2-by-n2 matrices (boundary conditions are the same as those assumed on Di). As such, it is worth noting that the two-row matrix Di is formed by stacking the ith row of D(1) on that of D(2). For vectors v1 and v2, we let v=(v1;v2)(v1,v2), i.e. v is the vector formed by stacking v1 on the top of v2. Similarly, we let D=(D(1);D(2))=((D(1)),,,(D(2))). Given a matrix T, we let diag(T) be the vector containing the elements on the diagonal of T, and F(T)=FTF1, where Fn2×n2 is the 2D discrete Fourier transform matrix.

Existing Methods

Since TV is nonsmooth, quite a few algorithms are based on smoothing the TV term and solving an approximation problem. The TV of u is usually replaced by
TVϵ(u)=\Diu2+ϵ,


(8)
where ϵ>0 is a small constant. Then the resulted approximate TV/L2 problem is smooth and many optimization methods are available. Among others, the simplest method is the gradient descent method as was used in [12]. However, this method suffers slow convergence especially when the iterate point is close to the solution. Another important method is the linearized gradient method proposed in [14] for denoising and in [15] for deblurring. Both the gradient descent and the linearized gradient methods are globally and at best linearly convergent. To obtain super linear convergence, a primal-dual based Newton method was proposed in [13]. Both the linearized gradient method and this primal-dual method need to solve a large system of linear equations at each iteration. When ϵ is small and/or K becomes more ill-conditioned, the linear system becomes more and more difficult to solve. Another class of well-known methods for TV/L2 are the iterative shrinkage/thresholding (IST) based methods [8]. For IST-based methods, a TV denoising problem needs to be solved at each iteration. Also, in [7] the authors transformed the TV/L2 problem into a second order cone program and solved it by interior point method.

A New Alternating Minimization Algorithm

In this section, we derive a new algorithm for the TV/L2 problem
minDiu+
μ
2
 Kuf2.


(9)
In (Equation 9), the fidelity term is quadratic with respect to u. Moreover, K is a convolution matrix and thus can be easily diagonalized by fast transforms (with proper boundary conditions assumed on u). Therefore, the main difficulty in solving (Equation 9) is caused by the nondifferentiability and the universal coupling of variables of the TV term. Our algorithm is derived from the well-known variable-splitting and penalty techniques in optimization. First, we introduce an auxiliary variable wiR2 at pixel i to transfer Diu out of the nondifferentiable term ·. Then we penalize the difference between wi and Diu quadratically. As such, the auxiliary variables wi's are separable with respect to one another. For convenience, in the following we letw[w1,...,wn2]. The approximation model to (Equation 9) is given by
minwi+
β
2
 wiDiu2+
μ
2
 Kuf2,


(10)
where β0 is a penalty parameter. It is well known that the solution of (Equation 10) converges to that of (Equation 9) as β. In the following, we concentrate on problem (Equation 10).

Basic Algorithm

The benefit of (Equation 10) is that while either one of the two variables u and w is fixed, minimizing the objective function with respect to the other has a closed-form formula that we will specify below. First, for a fixed u, the first two terms in (Equation 10) are separable with respect to wi, and thus the minimization for w is equivalent to solving
minwi+
β
2
 wiDiu2,i=1,2,...,n2.


(11)
It is easy to verify that the unique solutions of (Equation 11) are
wi=max{,Di,u,
1
β
 ,,,0
}
Diu
Diu
 ,i=1,...,n2,


(12)
where the convention 0·(0/0)=0 is followed. On the other hand, for a fixed w, (Equation 10) is quadratic in u and the minimizer u is given by the normal equations
(,Di,Di,+,
μ
β
 ,K,K
)u=Diwi+
μ
β
 Kf.


(13)
By noting the relation between D and Di and a reordering of variables, (Equation 13) can be rewritten as
(D,D,+,
μ
β
 ,K,K
)u=Dw+
μ
β
 Kf,


(14)
where
w(
w1
w2
)R2n2andwj(
(w1)j
(wn2)j
),j=1,2.


(15)
The normal equation (Equation 14) can also be solved easily provided that proper boundary conditions are assumed on u. Since both the finite difference operations and the convolution are not well-defined on the boundary of u, certain boundary assumptions are needed when solving (Equation 14). Under the periodic boundary conditions for u, i.e. the 2D image u is treated as a periodic function in both horizontal and vertical directions, D(1)D(2) and K are all block circulant matrices with circulant blocks; see e.g. [10][6]. Therefore, the Hessian matrix on the left-hand side of (Equation 14) has a block circulant structure and thus can be diagonalized by the 2D discrete Fourier transform F, see e.g. [6]. Using the convolution theorem of Fourier transforms, the solution of (Equation 14) is given by
u=F1(
F(D,w,+,(μ/β),K,f)
diag(F,(,D,D,+,(μ/β),K,K,))
 
),


(16)
where the division is implemented by componentwise. Since all quantities but w are constant for given β, computing u from (Equation 16) involves merely the finite difference operation on w and two FFTs (including one inverse FFT), once the constant quantities are computed.
Since minimizing the objective function in (Equation 10) with respect to either w or u is computationally inexpensive, we solve (Equation 10) for a fixed β by an alternating minimization scheme given below.
Algorithm :
  • Input fK and μ>0. Given β>0 and initialize u=f.
  • While “not converged”, Do
    1. Compute w according to (Equation 12) for fixed u.
    2. Compute u according to (Equation 16) for fixed w (or equivalently w).
  • End Do

Optimality Conditions and Convergence Results

To present the convergence results of Algorithm "Basic Algorithm" for a fixed β, we make the following weak assumption.
Assumption 1 N(K)N(D)={0{, where N(·) represents the null space of a matrix.
Define
M=DD+
μ
β
 KKandT=DM1D.


(17)
Furthermore, we will make use of the following two index sets:
L={i:,Di,u*,<,
1
β
 
}andE={1,...,n2{L.


(18)
Under Assumption 1, the proposed algorithm has the following convergence properties.
Theorem 1 For any fixed β>0, the sequence {(wk,uk){ generated by Algorithm "Basic Algorithm" from any starting point (w0,u0) converges to a solution (w*,u*) of (Equation 10). Furthermore, the sequence satisfies
  1. wEk+1wE*\ρ((T2)EE)wEkwE*;
    (19)
  2. uk+1u*M\ρ(TEE)uku*M;
    (20)
for all k sufficiently large, where TEE=[Ti,j]i,jE(n2+E) is a minor of TvM2=vMv and ρ(·) is the spectral radius of its argument.

Extensions to Multichannel Images and TV/L

The alternating minimization algorithm given in "A New Alternating Minimization Algorithm" can be extended to solve multichannel extension of (Equation 9) when the underlying image has more than one channels and TV/L1 when the additive noise is impulsive.

Multichannel image deconvolution

Let u=[u(1);...;u(m)]Rmn2 be an m-channel image, where, for each ju(j)Rn2 represents the jth channel. An observation of u is modeled by (Equation 4), in which case f=[f(1);...;f(m)] and ω=[ω(1);...;ω(m)] have the same size and the number of channels as u, and K is a multichannel blurring operator of the form
K=[
K11K12K1m
K21K22K2m
Km1Km2Kmm
]Rmn2×mn2,


(21)
where KijRn2×n2, each diagonal submatrix Kii defines the blurring operator within the ith channel, and each off-diagonal matrix Kijij, defines how the jth channel affects the ith channel.
The multichannel extension of (Equation 9) is
min(ImDi)u+
μ
2
 Kuf2,


(22)
where Im is the identity matrix of order m, and “" is the Kronecker product. By introducing auxiliary variables wiR2mi=1,...,n2, (Equation 22) is approximated by
minwi+
β
2
 wi(ImDi)u2+
μ
2
 Kuf2.


(23)
For fixed u, the minimizer function for w is given by (Equation 12) in which Diu should be replaced by (ImDi)u. On the other hand, for fixed w, the minimization for u is a least squares problem which is equivalent to the normal equations
(I3,,(DD),+,
μ
β
 ,K,K
)u=(I3D)w+
μ
β
 Kf,


(24)
where w is a reordering of variables in a similar way as given in (Equation 15). Under the periodic boundary condition, (Equation 24) can be block diagonalized by FFTs and then solved by a low complexity Gaussian elimination method.

Deconvolution with Impulsive Noise

When the blurred image is corrupted by impulsive noise rather than Gaussian, we recover u as the minimizer of a TV/L1 problem. For simplicity, we again assume uRn2 is a single channel image and the extension to multichannel case can be similarly done as in "Multichannel image deconvolution". The TV/L1 problem is
minDiu+μKuf1.


(25)
Since the data-fidelity term is also not differentiable, in addition to w, we introduce zRn2 and add a quadratic penalty term. The approximation problem to (Equation 25) is
min(,wi,+,
β
2
 ,wiDiu2
)+μ(z1,+,
γ
2
 ,z(Kuf)2
),


(26)
where β,γ0 are penalty parameters. For fixed u, the minimization for w is the same as before, while the minimizer function for z is given by the famous one-dimensional shrinkage:
z=max{|Kuf|,
1
γ
 ,,,0
}·sgn(Kuf).


(27)
On the other hand, for fixed w and z, the minimization for u is a least squares problem which is equivalent to the normal equations
(D,D,+,
μγ
β
 ,K,K
)u=Dw+
μγ
β
 K(f+z).


(28)
Similar to previous arguments, (Equation 28) can be easily solved by FFTs.

Experiments

In this section, we present the practical implementation and numerical results of the proposed algorithms. We used two images, Man (grayscale) and Lena (color) in our experiments, seeFigure 1. The two images are widely used in the field of image processing because they contain nice mixture of detail, flat regions, shading area and texture.
Figure 1: Test images: Man (left, 1024×1024) and Lena (right, 512×512).
Figure 1 (ManLen.png)
We tested several kinds of blurring kernels including Gaussian, average and motion. The additive noise is Gaussian for TV/L2 problems and impulsive for TV/L1 problem. The quality of image is measured by the signal-to-noise ratio (SNR) defined by
SNR10*log10
uE(u)2
uu2
 ,
(29)
where u is the original image and E(u) is the mean intensity value of u. All blurring effects were generated using the MATLAB function “imfilter " with periodic boundary conditions, and noise was added using “imnoise ". All the experiments were finished under Windows Vista Premium and MATLAB v7.6 (R2008a) running on a Lenovo laptop with an Intel Core 2 Duo CPU at 2 GHz and 2 GB of memory.

Practical Implementation

Generally, the quality of the restored image is expected to increase as β increases because the approximation problems become closer to the original ones. However, the alternating algorithms converge slowly when β is large, which is well-known for the class of penalty methods. An effective remedy is to gradually increase β from a small value to a pre-specified one.Figure 2 compares the different convergence behaviors of the proposed algorithm when with and without continuation, where we used Gaussian blur of size 11 and standard deviation 5 and added white Gaussian noise with mean zero and standard deviation 103.
Figure 2: Continuation vs. no continuation: u* is an “exact” solution corresponding to β=214. The horizontal axis represents the number of iterations, and the vertical axis is the relative errorek=uku*/u*.
Figure 2 (Continuation_relative_error_u14.png)
In this continuation framework, we compute a solution of an approximation problem which used a smaller beta, and use the solution to warm-start the next approximation problem corresponding to a bigger β. As can be seen from Figure 2, with continuation on β the convergence is greatly sped up. In our experiments, we implemented the alternating minimization algorithms with continuation on β, which we call the resulting algorithm “Fast Total Variation de-convolution” or FTVd, which, for TV/L2, the framework is given below.
[FTVd]:
  • Input fK and μ>0. Given βmax>β0>0.
  • Initialize u=fup=0β=β0 and ϵ>0.
  • While ββmax, Do
    1. Run Algorithm "Basic Algorithm" until an optimality condition is met.
    2. β2*β.
  • End Do
Figure 3: SNRs of images recovered from () for different β.
Figure 3 (SNR_sequence_Beta.png)
Figure 4: Results recovered from TV/L2. Image Man is blurred by a Gaussian kernel, while image Lena is blurred by a cross-channel kernel. Gaussian noise with zero mean and standard deviation 103is added to both blurred images. The left images are the blurry and noisy observations, and the right ones are recovered by FTVd.
(a)
Figure 4(a) (ManBnR.png)
(b)
Figure 4(b) (LenaBnR.png)
Generally, it is difficult to determine how large β is sufficient to generate a solution that is close to be a solution of the original problems. In practice, we observed that the SNR values of recovered images from the approximation problems are stabilized once β reached a reasonably large value. To see this, we plot the SNR values of restored images corresponding toβ=20,21,,218 in Figure 3. In this experiment, we used the same blur and noise as we used in the testing of continuation. As can be seen from Figure 3, the SNR values on both images essentially remain constant for β27. This suggests that β need not to be excessively large from a practical point of view. In our experiments, we set β0=1 and βmax=27 in Algorithm "Practical Implementation". For each β, the inner iteration was stopped once an optimality condition is satisfied. For TV/L1 problems, we also implement continuation on γ, and used similar settings as used in TV/L2.

Recovered Results

In this subsection, we present results recovered from TV/L2 and TV/L1 problems including (Equation 9), (Equation 25) and their multichannel extensions. We tested various of blurs with different levels of Gaussian noise and impulsive noise. Here we merely present serval test results. Figure 4 gives two examples of blurry and noisy images and the recovered ones, where the blurred images are corrupted by Gaussian noise, while Figure 5 gives the recovered results where the blurred images are corrupted by random-valued noise. For TV/L1problems, we set γ=215 and β=210 in the approximation model and implemented continuation on both β and γ.
Figure 5: Results recovered from TV/L1. Image Lena is blurred by a cross-channel kernel and corrupted by 40% (left) and 50% (right) random-valued noise. The top row contains the blurry and noisy observations and the bottom row shows the results recovered by FTVd.
(a)
Figure 5(a) (LenaBn.png)
(b)
Figure 5(b) (LenaR.png)

Concluding Remarks

We proposed, analyzed and tested an alternating algorithm FTVd which for solving the TV/L2 problem. This algorithm was extended to solve the TV/L1 model and their multichannel extensions by incorporating an extension of TV. Cross-channel blurs are permitted when the underlying image has more than one channels. We established strong convergence results for the algorithms and validated a continuation scheme. Numerical results are given to demonstrate the feasibility and efficiency of the proposed algorithms.

REFERENCES


  1. Acar, R. and Vogel, C. R. (1994). Analysis of total variation penalty methods. Inv. Probl.10, 1217-1229.
  2. Chan, T. F. and Esedoglu, S. (2005). Aspects of total variation regularized function approximation. SIAM Journal on Applied Mathematics65(5), 1817–1837.
  3. Chan, T. F. and Esedoglu, S. and Park, F. and Yip, A. (2004). Recent Developments in Total Variation Image Restoration. (05-01). CAM Report. Department of Mathematics, UCLA.
  4. Chambolle, A. and Lions, P. L. (1997). Image Recovery via Total Variation Minimization and Related Problems. Numer. Math.76(2), 167-188.
  5. Dobson, D. C. and Santosa, F. (1996). Recovery of blocky images from noisy and blurred data. SIAM J. Appl. Math.56, 1181–1198.
  6. Gonzalez, R. and Woods, R. (1992). Digital Image Processing. Addison-Wesley.
  7. Goldforb, D. and Yin, W. (2005). Second-Order Cone Programming Methods for Total Variation-based Image Restoration. SIAM J. Sci. Comput.27(2), 622-645.
  8. I. Daubechies, M. Defriese and Mol, C. De. (2004). An iterative thresholding algorithm for linear inverse problems with a sparsity constraint. Commun. Pure Appl. Math.LVII, 1413-1457.
  9. Mumford, D. and Shah, J. (1989). Optimal approximations by piecewise smooth functions and associated variational problems. Comm. Pure Appl. Math.42, 577-685.
  10. NG, Michael K. and Chan, Raymond H. and Tang, Wuncheung. (1999). A fast algorithm for deblurring models with neumann boundary conditions. SIAM J. Sci. Comput.21(3), 851–866.
  11. Rudin, L. and Osher, S. (1994). Total Variation Based Image Restoration with Free Local Constraints. Proc. 1st IEEE ICIP1, 31-35.
  12. Rudin, L. and Osher, S. and Fatemi, E. (1992). Nonlinear Total Variation Based Noise Removal Algorithms. Phys. D60, 259-268.
  13. T. F. Chan, G. H. Golub and Mulet, P. (1999). A nonlinear primal dual method for total variation based image restoration. SIAM J. Sci. Comput.20, 1964-1977.
  14. Vogel, C. R. and Oman, M. E. (1996). Iterative Methods for Total Variation Denoising. SIAM J. Sci. Comput.17(1), 227-238.
  15. Vogel, C. and Oman, M. (1998). Fast, robust total variation-based reconstruction of noisy, blurred images. IEEE Trans. Image processing7(6), 813–824.
  16. Yin, W. and Goldfarb, D. and Osher, S. (2005). Image cartoon-texture decomposition and feature selection using the total variation regularized functional. In Leture Notes in Computer Science: Vol. 3752Variational, Geometric, and Level Set Methods in Computer Vision. (pp. 73-84). Springer.
  17. Yin, W. and Goldfarb, D. and Osher, S. (2006). The total variation regularized model for multiscale decomposition. SIAM Journal on Multiscale Modeling and Simulation6(1), 190–211.
  18. Ziemer, W. P. (1989). Graduate Texts in Mathematics: Weakly Differentiable Functions: Sobolev Spaces and Functions of Bounded Variation. Springer

0 comments:

Post a Comment

Recent Comments

Popular Matlab Topics

Share your knowledge - help others

Crazy over Matlab Projects ? - Join Now - Follow Me

Sites U Missed to Visit ?

Related Posts Plugin for WordPress, Blogger...

Latest Articles

Special Search For Matlab Projects

MATLAB PROJECTS

counter

Bharadwaj. Powered by Blogger.