Informatica 40 (2016) 337–342 337 Adaptive Coherence-enhancing Diffusion Flow for Color Images V. B. Surya Prasath Computational Imaging and VisAnalysis (CIVA) Lab, Department of Computer Science University of Missouri-Columbia, USA E-mail: prasaths@missouri.edu Keywords: coherence, structure tensor, anisotropic diffusion, image restoration Received: July 7, 2016 Color image restoration is one of the fundamental problems in image processing pipelines. Variational reg- ularization and diffusion partial differential equations (PDEs) are widely used in solving these low-level image smoothing and noise removal problems. In this paper, we consider a new adaptive coherence en- hancing diffusion (CED) filter which combines anisotropic diffusion and structure tensor derived diffusion functions. By exploiting isotropic smoothing in homogeneous regions and anisotropic diffusion tensor filtering in edges and corners we obtain a PDE flow which can removing noise while preserving impor- tant image details. Compared to the original CED approach our proposed adaptive CED (ACED) obtains stable smoothing results. Experimental results on synthetic and real color images show that the proposed filter has good noise removal properties and quantitative measurements indicate it obtains better structure preservation as well. Povzetek: Predlagan je nov algoritem za obnavljanje barv slik. 1 Introduction Image restoration is an important low-level image process- ing which is still an active area of research in computer sci- ence. Among a wide variety of image noise removal meth- ods two important classes of techniques are variational reg- ularization and partial differential equation (PDE) based fil- ters [1]. Perona and Malik [2] proposed an anisotropic dif- fusion filtering based on a nonlinear PDE for image denois- ing and edge detection. Though the Perona-Malik (PM) PDE obtained edge preserving restorations under noise, it is known to create blocky artifacts in homogenous (flat re- gions where the pixel values do not vary much) regions in the resultant images. Various modifications and adaptations of PM PDE in particular and other PDEs in general have been proposed in the last two decades. One of the important class of im- proved PDE based filter is due to Weickert who provided a unified theory of anisotropic diffusion [4]. The structure tensor provided better orientation estimation and edge dis- crimination for steering the diffusion process away from image discontinuities and to make smoothing strong in ho- mogenous regions. Weickert [5] proposed an elegant for- mulation which handles coherence enhancement for color images with tuning the eigenvalues of the structure tensor in a controlled manner. Structure tensors provide a geo- metric analysis of digital images via eigenvalues and vec- tors and there have been applications in edge detection and image denoising literature. In this work, we base our new PDE based filtering ap- proach on Weickert’s coherence-enhancing diffusion [5] with an adaptive choice of diffusion functions for better edge and corner preservation while smoothing out random noise. For this, we utilize structure tensor eigenvalues for controlling anisotropic smoothing according to geomet- ric content of the images. This adaptive choice facilitates isotropic diffusion in homogenous regions and anisotropic diffusion near sharp edges, corners. Our proposed filter is robust to noise and we conduct detailed experimental re- sults on noisy synthetic and real images to prove the effec- tiveness. Comparison results with related filters show that we obtain better restoration results visually as well as based on peak signal to noise ratio and structure similarity. We conduct experimental results on synthetic and vari- ous corrupted real color test images and test our method against some related filters from the literature. Our exper- iments show that both visually and quantitatively our pro- posed adaptive approach obtained better restoration results. 2 Adaptive coherence enhancing diffusion 2.1 Preliminaries We start with the basic assumptions and notations of coherence-enhancing diffusion filtering framework. Let u0 : Ω ⊂ R2 → R be the input (possibly noisy) grayscale image. Weickert [4] provided a unified tensor diffusion for- mulation which is given by the following parabolic nonlin- 338 Informatica 40 (2016) 337–342 V.B.S. Prasath (a) Input (b) CED [5] (c) Proposed ACED Figure 1: Comparison of noise-free synthetic Square color image filtering with coherence-enhancing diffusion flows at the same terminal time T = 25. (a) Inupt image, and (b) Original Weickert’s CED [5] (Eqn. (1) with (7)), and our proposed ACED (Eqn. (1) with (8)). In (b) and (c) on the left we show the residue |u(x, T )− u0| which are enhanced for better visualization. Our proposed method obtains stable salient edges of the central square and other texture regions are grouped well. ear PDE, ∂u(x, t) ∂t = div (D(Jρ(∇uσ))∇u) , x ∈ Ω, u(x, 0) = u0(x), x ∈ Ω, u(x, t) = 0, x ∈ ∂Ω. (1) The resultant sequence of images {u(·, t)}Tt=0, for a finite time T represents a nonlinear scale space. Here the diffu- sion tensorD is dependent on the image information via the structure tensor Jρ(∇uσ). Structure tensors encode local image information with first order directional derivatives and is given by, Jρ(∇uσ) = ( Gρ ? (uσ) 2 x Gρ ? (uσ)x(uσ)y Gρ ? (uσ)x(uσ)y Gρ ? (uσ) 2 y ) (2) where [(uσ)x, (uσ)y]T (XT denotes the transpose of vec- tor/matrix X) is the gradient of uσ (pre-smoothed image uσ = Gσ ? u), Gρ = (2πρ2)−1 exp (− |x|2 /2ρ2) is the Gaussian kernel and ? denotes the convolution operation. Let the eigenvalues and eigenvectors of the structure tensor be (λ+, λ−), and (v+, v−) respectively. Weickert’s unified tensor diffusion formulation is given by, D = f+(λ+, λ−)v+vT+ + f−(λ+, λ−)v−vT−, (3) where where f+, f− are the diffusivities perpendicular and parallel to structure orientations. The eigenvectors of the structure tensor Jρ matrix can be calculated as, λ± = 1 2 ( trace(Jρ)± √ trace2(Jρ) + 4det(Jρ) ) . (4) For vector valued (multichannel) images u : Ω ⊂ R2 → RN with u = (u1, u2, . . . , uN ) channels the PDE (1) can be written using a common diffusion tensor, ∂ui(x, t) ∂t = div ( D(Jρ(∇uσ))∇ui ) , x ∈ Ω, u(x, 0) = u0(x), x ∈ Ω, u(x, t) = 0, x ∈ ∂Ω. (5) For vectorial images the common structure tensor is given by, Jρ(∇uσ) = N∑ i=1 wi Jρ(∇uiσ), (6) with ∑N i=1 w i = 1, and wi > 0 are the averaging factors. Interpretation of this tensor for vectorial images in terms of eigenvalues and eigenvectors carries over from grayscale case, see [5] for more details. A simple choice is to chose wi = 1/N for all i = 1, . . . , N representing all channels have similar meaning, range and reliability. We restrict our- selves here to color images (RGB, N=3), and the formula- tion holds true for multispectral imagery as well. Weickert [5] proposed the following particular choices for steering smoothing for coherence enhancement diffu- sion (CED), f+ = { γ + (1− γ) exp (− α(λ+−λ−)2 ) if λ+ 6= λ−, γ, else, f− = γ. (7) with α > 0 is known as the coherence factor (if the co- herence is inferior to α the flux is increasing with the co- herence while if the coherence is larger then α the flux de- creases as the coherence grows), γ > 0 a small parameter added to keep the tensor diffusion matrixD in Eqn. (3) pos- itive definite. Note that (λ+−λ−)2 measures the coherence within a window of scale ρ. This particular choice obtained good diffusion results when the structures are oriented in one particular direction, however can smooth out corners and other singularities as multiple directional information is lost, see Figure 1. 2.2 Adaptive coherence-enhancing diffusion In this work, to control the filtering better and to preserve image singularities better we chose the following adaptive Adaptive Coherence-enhancing Diffusion Flow for Color Images Informatica 40 (2016) 337–342 339 (a) CED flow at T = 10, 100, 300 (b) ACED flow at T = 10, 100, 300 Figure 2: Comparison of coherence-enhancing diffusion flows at the same terminal times for StarryNight painting by van Gogh (Saint-Rémy, 1889, The Museum of Modern Art, New York, USA) color image. Top row: original Weickert’s CED [5] (Eqn. (5) with (7)). Bottom row: Our proposed ACED (Eqn. (5) with (8)) at terminal iterations T = 10, 100, 300. Note the different effect of flows on long level lines. diffusivities, f+ = exp ( − λ2+ β1 ) f− = ( 1− exp ( − λ2+ β1 )) exp ( − λ2− β2 ) (8) With this choice of diffusivities we observe the following salient points: X If either of the eigenvalues λ+ or λ− is high the dif- fusion is now in the direction of v+ or v−, which in turn means at corners (where λ± is high) anisotropic diffusion is applied. X Original CED formulation’s diffusion oriented in the direction of v+ is kept intact and the diffusivity f− is now incorporates orientation direction v− (coherence orientation). X The parameters β1, β2 control the diffusivities along v+, v−. X In homogeneous (flat regions where the pixel values do not vary) areas the diffusion is still isotropic. The diffusion PDE in Eqn. (5) where the diffusion matrix in Eqn. (3) given with this diffusivities (8) obtains adap- tive coherence enhancing diffusion (ACED) for smoothing color images with salient edges, corners better preserved as we will see in the experimental results next. 3 Experimental results 3.1 Setup and parameters The PDE based filters (CED) are implemented using the implicit finite differences method with coherence parame- ter α = 5 × 10−4, γ = 0.01 (to keep D positive definite), pre-smoothing Gaussian standard deviations σ = 4, ρ = 1, and step size ∆t = 0.24. The new parameters in our ACED β1 = 20, and β = 20 are set in all the experiments reported here. 3.2 Comparison results Figure 1 shows a comparison of Weickert’s original CED [5] (Eqn. (1) with (7)), and our proposed adaptive im- provement ACED (Eqn. (1) with (8)) at the same terminal time T = 25. We show the residue |u(x, T )− u0| to high- light the amount of noise removed in both these methods. As can be seen, our proposed ACED preserves the cen- tral square’s edges through the diffusion flow and smaller texture regions are grouped better than the original CED 340 Informatica 40 (2016) 337–342 V.B.S. Prasath Image CED [5] Ours Baboon‡ 0.6047 0.6087 Barbara‡ 0.7129 0.7964 Boat† 0.6786 0.7013 Car‡ 0.7214 0.7853 Couple† 0.7016 0.7020 F-16† 0.8699 0.8898 Girl1† 0.7081 0.7174 Girl2† 0.8210 0.8522 Girl3† 0.8020 0.8309 House† 0.7024 0.7812 IPI† 0.8335 0.8929 IPIC† 0.7899 0.8125 Lena‡ 0.7581 0.7824 Peppers‡ 0.7737 0.8026 Splash‡ 0.7938 0.8136 Tiffany‡ 0.7633 0.8107 Tree† 0.7099 0.7325 Table 1: Mean structural similarity (MSSIM) metric values for results of various schemes with noise level σn = 30 for standard test color images from USC-SIPI Miscellaneous dataset (size † = 256× 256 and ‡ = 512× 512). MSSIM value closer to one indicates the higher quality of the de- noised image. The top result in each color test image is indicated by boldface. Image CED [5] Ours Baboon‡ 20.48 20.53 Barbara‡ 24.59 25.94 Boat‡ 25.21 24.98 Car‡ 26.01 25.83 Couple† 27.18 26.97 F-16† 24.56 26.50 Girl1† 26.66 27.21 Girl2† 29.34 28.05 Girl3† 29.92 29.68 House† 28.95 28.39 IPI† 30.38 29.32 IPIC† 29.05 28.64 Lena‡ 28.56 27.89 Peppers‡ 28.61 28.03 Splash‡ 31.65 31.18 Tiffany‡ 29.67 28.99 Tree† 25.73 25.10 Table 2: PSNR (dB) values for results of various schemes with noise level σn = 20 for standard images of size † = 256× 256 (Noisy PSNR = 22.11) and ‡ = 512× 512 (Noisy PSNR = 22.09). Higher PSNR value indicate bet- ter denoising result. The top result in each color test image is indicated by boldface. (a) Noise-free (b) Noisy Figure 3: Comparison of (a) noise-free smoothing and (b) noisy Baboon color image filtering with coherence- enhancing diffusion (CED) flows at the same terminal time T = 25. Left column - original Weickert’s CED [5] (Eqn. (1) with (7)), right column - Our pro- posed ACED (Eqn. (1) with (8)). Restored image, and residue |u(x, T )− u0| (enhanced for better visualization) are shown in each case. Our proposed method obtains bet- ter noise removal and salient edges are preserved well. Bet- ter viewed online and zoomed-in. formulation. To show visually the qualitative differences of the flows we utilize the StarryNight, a painting by van Gogh Adaptive Coherence-enhancing Diffusion Flow for Color Images Informatica 40 (2016) 337–342 341 (a) Day (b) Night Figure 4: We obtain interesting non-realistic photo realistic results with our proposed ACED. We show two examples (a) daylight, and (b) night lights. Better viewed online. (Saint-Rémy, 1889, Courtesy of The Museum of Modern Art, NY, USA) color image of size 606 × 480. Figure 2 shows CED and our proposed ACED at iterations T = 10, 100, and 300. As can be seen, we obtain two different be- haviors with respect to the coherency of long level lines. CED obtains a long flowing structures whereas our ACED obtains long lines interspersed with small flowing lines in- side big structures. This property shows that our adaptive choice of diffusivities (8) helps the flow retain corners and singularities better than the original (7). Next in Figure 3 we compare CED flows on noise- free and noisy (additive Gaussian noise of standard de- viation σn = 30 added in all three channels indepen- dently) Baboon color image of size 512×512. Figure 3(a) shows comparison on noise-free image and the correspond- ing CED, proposed ACED results at the iteration T = 25. Our proposed ACED obtains better coherency as can be seen by mouth and surrounding whiskers. A similar visual analysis shows in noisy case, Figure 3(b), indicate we ob- tain better noise removal while maintaining all the salient edges and thin linear structures. These are further corrob- orated by the corresponding residue images showing how 342 Informatica 40 (2016) 337–342 V.B.S. Prasath much of structure and random noise are removed. We note that for a fair comparison to the original CED formulation we kept all the parameters in our proposed ACED the same including the terminal time T of the cor- responding PDE flows. The convergence result for the dis- cretized versions, as iterations increases t → ∞, of both CED and proposed ACED are the same and we defer the discussion of deeper theoretical results of the correspond- ing nonlinear PDEs for future. To quantitatively compare the noise removal and struc- ture preservation we use two standard error metrics utilized widely in the image processing literature. Peak signal to noise ratio (PSNR) is given by, PSNR = 20 ∗ log10 ( 3× umax√ MSE ) dB, where MSE = (mn)−1 ∑∑ (u− uO)2, mean squared er- ror, with uO is the original (noise free) image, m × n de- notes the image size, umax denotes the maximum value, for example in 8-bit images umax = 255. A difference of 0.5 dB can be identified visually. Mean structural similar- ity (MSSIM) index is in the range [0, 1] and is known to be a better error metric than traditional signal to noise ra- tio. It is the mean value of the structural similarity (SSIM) metric [6]. We use the default parameters for SSIM and the MATLAB code is available online1. The SSIM is cal- culated between two windows ω1 and ω2 of common size N ×N , and is given by, SSIM(ω1, ω2) = (2µω1µω2 + c1)(2σω1ω2 + c2) (µ2ω1 + µ 2 ω2 + c1)(σ 2 ω1 + σ 2 ω2 + c2) , where µωi the average of ωi, σ 2 ωi the variance of ωi, σω1ω2 the covariance, and c1, c2 stabilization parameters. The MSSIM value near 1 implies the optimal denoising capa- bility of a method and we used the default parameters. Table 1 and Table 2 show PSNR (dB) and MSSIM val- ues for CED and our proposed ACED methods compared on some standard color test images which are synthetically perturbed by additive Gaussian noise of standard devia- tion σn = 30. Though our proposed ACED is not the top performing method in all the tested images in terms of PSNR, we note that the purpose of adaptive CED is to obtain smoothed images with coherent structures in tact. Further, PSNR is known to be not the right metric in evalu- ating the performance of denoising methods and MSSIM is more apt. We remark that the optimal stopping time T > 0 for denoising is determined based on best possible MSSIM value in these synthetically noise added cases. Finally, we show in Figure 4 some smoothing results from mobile phone imagery (12 mega-pixel). Figure 4(a) shows a picture taken in day-light conditions with no flash and our proposed ACED obtains flow like small structures while keeping the bigger regions intact. A similar result is observed in Figure 4(b) where a night time image is cap- tured with an in-built flash. The smoothing property of our flow provides visually pleasing results in both cases. 1https://ece.uwaterloo.ca/ z70wang/research/ssim/ 4 Conclusions In this work, we considered a new PDE based filter for color image coherence enhancing smoothing and noise re- moval. By a combination of anisotropic diffusion with structure tensor driven adaptive functions, our method ob- tains edge preserving smoothing results which result in bet- ter noise removal capabilities. Experimental results on a variety of noisy images indicate the potential of our pro- posed approach and compared with other original coher- ence enhancing diffusion filter we obtained better restora- tion results as well. One of our important future work is in extending the proposed method by incorporating other adaptive diffusive regularizers and to handle mixed noise removal [3] and consider multispectral imagery [7]. References [1] G. Aubert and P. Kornprobst (2006) Mathematical problems in image processing: Partial differential equation and calculus of variations, Springer-Verlag. [2] P. Perona and J. Malik (1990) Scale-space and edge de- tection using anisotropic diffusion, IEEE Transactions on Pattern Analysis and Machine Intelligence, Vol. 12, No. 7, pp. 629–639. [3] D. N. H. Thanh, S. D. Dvoenko, D. V. Sang (2016) A mixed noise removal method based on total variation, Informatica, Vol. 40, pp. 159–167. [4] J. Weickert (1998) Anisotropic diffusion in image pro- cessing. B.G. Teubner-Verlag, Stuttgart, Germany. [5] J. Weickert (1999) Coherence-enhancing diffusion of colour images, Image and Vision Computing, pp. 201– 212. [6] Z. Wang, A. C. Bovik, H. R. Sheikh, E. P. Simoncelli (2004) Image quality assessment: from error visibil- ity to structural similarity. IEEE Transactions on Image Processing, Vol. 13, No. 4, pp. 600–612. [7] V. B. S. Prasath and A. Singh, Multispectral image de- noising by wellposed anistropic diffusion with chan- nel coupling, Inter. J. Remote Sens, Vol. 31, No. 8, pp. 2091–2099, 2010.