AN IMAGE DENOISING APPROACH BASED ON A

5 downloads 0 Views 1MB Size Report
And last but not the least, we would like to thank each one of us in the group who had .... The aim of this report is to discuss the progress and elaborate the project on which I .... element method, values are calculated at discrete places on a meshed .... u^0(X) defined as defined in a domain Ω⊆ R^n under a diffusion operator ...
AN IMAGE DENOISING APPROACH BASED ON A MESHFREE METHOD AND THE DOMAIN DECOMPOSITION TECHNIQUE By MANJARI GAUTAM (2013120) VANDANA GUPTA (2013228) Supervisor DR. MANISH KUMAR BAJPAI

COMPUTER SCIENCE ENGINEERING INDIAN INSTITUTE OF INFORMATION TECHNOLOGY, DESIGN AND MANUFACTURING JABALPUR [2013 to 2017]

1

Acknowledgement We would like to begin with expressing our gratefulness to our supervisor, Dr. Manish Kumar Bajpai who provided us with their invaluable academic guidance and support during this project. We would like to thank our teaching assistant, Miss Kanchan ma’am who has helped in showing right direction. Their approach to documentation and presentation will always be a valuable learning experience for us. Their dedication, professionalism and hard work have been and shall be a source of inspiration throughout our lives. And last but not the least, we would like to thank each one of us in the group who had whole-heartedly worked hard for the proposed ideas and completion of the project. Thanking you, Vandana gupta Manjari Gautam

2

Acronyms  FDM

Finite Difference Method

 FVM

Finite Volume Method

 FPM

Finite Point Method

 PSNR

Peak Signal to Noise Ratio

 MSE

Mean Square Error

 AMSE

Absolute Mean Square Error

 PDE

Partial Differential Equation



RBF

Radial Basic Function

3

Table Of Contents Sr. no. 1. 1.1

1.2 1.3

Title Page no. Introduction …………………………………………………………... 6 Introduction……………………………………………………….. 6 1.1.1 Definition…………………………………………. 6  Image Denoising…………………… 6  Meshfree method…………………… 7  Domain Decomposition…………….. 7 1.1.2 Aim of project ……………………………………. 7 1.1.3 Scope of our project………………………………. 7 Literature Survey…………………………………………………. 8 Internship Plan…………………………………………………….. 8 Investigation …………………………………………………………..

2. 2.1 2.2

2.3

Image Enhancement………………………………………………... Types of techniques to solve PDE…………………………………. 2.2.1 Dsolve Method…………………………………… 2.2.2 Finite Difference Method…………………………. 2.2.3 Finite Volume Method…………………………… 2.2.4 Spectral Method…………………………………... 2.2.5 Domain Decomposition…………………………… 2.2.6 Multigrid Method…………………………………. 2.2.7 Method of Lines…………………………………… 2.2.8 Meshfree Method…………………………………. 2.2.9 Radial Basic Function……………………………..

9 9 10 10 11 11 12 12 13 14 14 15

Anisotropic Diffusion............................................................................. 16

4

Progress…………………………………………………………………. 17

3. 3.1 3.2 3.3 3.4 4. 4.1 4.2 4.3 4.4 4.5 4.6 4.7 4.8 4.9 5. 6. 7.

Anisotropic Diffusion using FDM…………………………………… 17 Dsolve method to solve PDE………………………………………… 18 Radial Basic Function(RBF)………………………………………….. 20 Meshfree Method TO solve PDE…………………………………… .. 23 Result and Discussion……………………………………………………. 24 PSNR…………………………………………………………………. 24 MSE…………………………………………………………………... 24 AMSE…………………………………………………………………. 25 Contrast Enhancement index…………………………………………...25 Data Set…………………………………………………………………26 Result using FDM………………………………………………………26 Result using RBF……………………………………………………….29 Result using FPM……………………………………………………….31 Result using Meshfree Anisotropic Diffision………………………… 32 Summary and Conclusion ………………………………………………..34 Appendix………………………………………………………………….35 References…………………………………………………………………43

5

1. Introduction 1.1. Introduction 1.1.1. Definition  Image Denoising Image denoising is an important image enhancement task, both as a process itself, and as a component in other processes. Very many ways to denoise an image or a set of data exists. The main properties of a good image denoising model is that it will remove noise while preserving edges. Traditionally, linear models have been used. One common approach is to use a Gaussian filter, or equivalently solving the heat-equation with the noisy image as input-data, i.e. a linear, 2nd order PDE-model.  Mesh-free Method Mesh Free Methods use a set of nodes scattered within the problem domain as well as sets of nodes scattered on the boundaries of the domain to represent (not discretize) the problem domain and its boundaries. No mesh implies no information on the relationship between the nodes is required When is a method a Mesh Free Method? • minimum requirement: A predefined mesh is not necessary (at least in field variable interpolation). • ideal requirement: No mesh is necessary at all throughout the process of solving the problem of a given arbitrary geometry governed by partial differential system equations subject to all kinds of boundary conditions. The Mesh Free Methods developed so far are not really ideal. Why the need for Mesh Free Methods? • For an engineer the concern is more the manpower time, and less the computer time, • Large deformations can deteriorate the accuracy because of element distortions, • Specific physical problems, such as breakage of a solid and stress calculations, require more flexibility. Mesh Free Methods are answers to the problems of the Finite Elements Method! • Mesh Free Methods are a respons to the limitations of Finite Element Methods. • Mesh Free Methods do not use meshes, only nodes. • The implementation of Mesh Free Methods differs from Finite Element Methods only in the shape function construction and node generation. • The ideal Mesh Free Method is not found yet.

6

 Domain Decomposition Domain decomposition methods are devoted to mathematical and computational strategies in which the computational domain is split into several subdomains in order to solve a boundary value problem faster. The splitting allows to compute parts of the solution on each sub-domain independently and thus in parallel on multiple processors. Of course, independence is only possible over a specific period of time because some communication is needed in between for the transportation of information across sub-domain boundaries. 1.1.2. Aim of the project The aim of this report is to discuss the progress and elaborate the project on which I have been assigned to. This report covers the training and the technologies I have learnt till now during my internship at IIITDM JABALPUR The aim of our project is to enhancement of an images using mesh free technique and domain decomposition techniques ,there are many method to enhancement if an image but meshfree more efficient than other method ,So our main aim is to implement meshfree method in Matlab to enhance an image using Matlab and compare and analyze output image with other methods. 1.1.3. Scope of the project Meshfree methods are the topic of recent research in many areas of computational science and approximation theory. These methods come in various flavors, most of which can be explained either by what is known in the literature as radial basis functions (RBFs), or in terms of the moving least squares (MLS) method. Over the past several years meshfree approximation methods have found their way into many different application areas ranging from artificial intelligence, computer graphics, image processing and optimization to the numerical solution of all kinds of (partial) differential equations problems. Applications in computational nanotechnology are still somewhat rare, but do exist in the literature. Originally, the motivation for two of the most common basic meshfree approximation methods (radial basis functions and moving least squares methods) came from applications in geodesy, geophysics, mapping, or meteorology. Later, applications were found in many areas such as in the numerical solution of PDEs, artificial intelligence, learning theory, neural networks, signal processing, sampling theory, statistics (kriging), finance, and optimization. 7

1.2. Literature Survey We have studied many meshree method for denoise an image from different research papers and analyzed that which papers meet our needs. We have done lots of searching through many websites. Some research papers are followings: 1.MaryamKamranian a, Mehdi Dehghan a,n, Mehdi Tatari Engineering Analysis with BoundaryElementsDepartmentofAppliedMathematics,FacultyofMathematicsandComputerSc ience,Amirkabir University of Technology,No.424,HafezAve.,Tehran,Iran b Department of Mathematical Sciences, Isfahan UniversityofTechnology,Isfahan84156-83111,Iran : An image denoising approach based on a meshfree method and the domain decomposition technique 2.MESHFREE APPROXIMATION METHODS WITH MATLAB Gregory E. Fasshauer r_s Illinois Institute of Technology, USA 3. Image processing with partial differential equations by karol MIKULA ,Department of mathematics and descriptive geometry 4.Anisotropic Diffusion in Mesh-Free Numerical Magnetohydrodynamics Philip F. Hopkins1_ 1TAPIR & The Walter Burke Institute for Theoretical Physics, Mailcode 350-17, California Institute of Technology, Pasadena, CA 91125, USA Submitted to MNRAS, January, 2016 5.Two Dimensional Image Denoising Using Partial Differential Equations with a Constraint on High Dimensional Domains Carl Lederman1 1Department of Mathematics, University of California, Los Angeles 6. Solution to PDEs using Radial Basis Function Finite-Differences (RBF-FD) on Multiple GPUs Evan F. Bollig ,[email protected] Florida State University Natasha Flyer [email protected] NCAR ,Gordon Erlebacher [email protected] ,Florida State University July 3, 2012 Moreover we have studied a matlab library to implementation. 1.3. Internship Plan Our main goal in internship is implementing and analysing enhanced image using meshfree techniques and domain decomposition and bring improvement in them So we have studied many research papers and books to know about meshfree methods and related work, and implemented meshree method and finite difference method using anisotropic diffusion in matlab which is useful in storing results of enhance images.

8

2. Investigation We have studied some methods to solve PDE (partial difference equations) and did theoretical comparison of them.There are many techniques and method to solve .We have given the brief description of those algorithms below. 2.1 Image denoiseing( image enhancement) De-noising plays a very important role in the field of the image pre-processing. It is often done before the image data is to be analyzed. Denoising is mainly used to remove the noise that is present and retains the significant information, regardless of the frequency contents of the signal. It is entirely different content and retains low frequency content. Denoising has to be performed to recover the useful information. In this process much attention is kept on, how well the edges are preserved and how much of the noise granularity has been removed. The main purpose of an image-denoising algorithm is to eliminate the unwanted noise level while preserving the important features of an image. Image denoising is a procedure in digital image processing aiming at the removal of noise,which may corrupt an image during its acquisition or transmission, while retaining its quality. Many images are often affected by random noise arising in the image acquisition process. The presence of noise not only produces undesirable visual quality but also lowers the visibility of low contrast objects. Noise removal is essential in imaging applications in order to enhance and recover fine details that may be hidden in the data. The noise present in the images may appear as additive or multiplicative components and the main purpose of denoising is to remove these noisy components while preserving the important signal as much as possible. In image enhancement there are many studies, mainly on grayscale transform and frequency domain transform. Frequency domain filtering can be used for periodic noise reduction and removal . There are many techniques to denoise an image :    

Spatial Filtering Transform Domain Filtering Wavelet Based Thresholding Mesh free method Etc.

9

2.2 Types of techniques to solve PDEs In our PBI we have been assigned to solve PDE using meshfree method for image enhancement .There are many techniques to solve these partial differential equations : 1) DSolve method 2) Finite difference method 3) Finite element method 4) Finite volume method 5) Spectral method 6) Multi grid methods 7) Method of lines 8) Mesh-free methods 8) Domain decomposition methods 9) Radial basic function method etc.







2.2.1 Dsolve method The Wolfram Language function DSolve finds symbolic solutions to differential equations. (The Wolfram Language function NDSolve, on the other hand, is a general numerical differential equation solver.) DSolvecan handle the following types of equations: Ordinary Differential Equations (ODEs), in which there is a single independent variable and one or more dependent variables , DSolve is equipped with a wide variety of techniques for solving single ODEs as well as systems of ODEs. Partial Differential Equations (PDEs), in which there are two or more independent variables and one dependent variable. Finding exact symbolic solutions of PDEs is a difficult problem, but DSolve can solve most first-order PDEs and a limited number of the second-order PDEs found in standard books. Differential-Algebraic Equations (DAEs), in which some members of the system are differential equations and the others are purely algebraic, having no derivatives in them. As with PDEs, it is difficult to find exact solutions to DAEs, but DSolve can solve many examples of such systems that occur in applications. DSolve[eqn,y[x],x] solve a differential equation for DSolve[{eqn1,eqn2,…},{y1[x],y2[x],…},x] solve a system of differential equations for

10

2.2.2 Finite Difference method Finite-difference methods (FDM) are numerical methods for solving differential equations by approximating them with difference equations, in which finite differences approximate the derivatives. FDMs are thus discretization methods. The finite difference method(FDM) works by replacing the region over which the independent variables in the PDE are defined by a finite grid also called a mesh of points at which the dependent variables is approximated. The partial derivatives in the PDE at each grid point are approximated from neighbouring values by using Taylor’s theorem. In this method, functions are represented by their values at certain grid points and derivatives are approximated through differences in these values. Taylor’s Theorem Let U(x) has N continuous derivatives over the interval (a, b). Then for a < 𝑥0 , 𝑥0 +h < b, U(𝑥0 +h)=U(𝑥0 )+h U𝑥 (𝑥0 )+ h2

U 𝑥𝑥 2!

(𝑥0 ) +…+ hn−1

U (𝑛 −1) (𝑛 −1)!

(𝑥0 )+O(hn )………………1.1

Where *

U𝑥 =

𝑑U 𝑑x

,

U𝑥𝑥 =

d2 U 𝑑x 2

,…,

U(𝑛−1) =

d n −1 U 𝑑x n −1

.

* U𝑥 (x0 ) is the derivative of U with respect to x evaluated at x = x0 . * O(hn ) is an unknown error term . The usual interpretation of Taylor’s theorem says that if we know the value of U and the value of its derivatives at point x0 then we can write down the equation (1.1) for its value at the (nearby) point x0 +h. This expression contains an unknown quantity which is written in as O(hn ) and “pronounced as order h to the n”. If we discard the term O(hn ) in (1.1) (i.e truncate the right hand side of (1.1)) we get an approximation to U(x0 +h). The error in this approximation is O(hn ). 2.2.3 Finite Volume method The finite volume method (FVM) is a discretization technique for partial differential equations, especially those that arise from physical conservation laws. FVM uses a volume integral formulation of the problem with a finite partitioning set of volumes to discretize the equations.

11

The finite-volume method is a method for representing and evaluating partial differential equations in the form of algebraic equations . Similar to the finite difference method or finite element method, values are calculated at discrete places on a meshed geometry. "Finite volume" refers to the small volume surrounding each node point on a mesh. In the finite volume method, volume integrals in a partial differential equation that contain a divergence term are converted to surface integrals, using the divergence theorem. These terms are then evaluated as fluxes at the surfaces of each finite volume. Because the flux entering a given volume is identical to that leaving the adjacent volume, these methods are conservative. Another advantage of the finite volume method is that it is easily formulated to allow for unstructured meshes. The method is used in many computational fluid dynamics packages. 2.2.4 Spectral method Spectral methods are techniques used in applied mathematics and scientific computing to numerically solve certain differential equations, often involving the use of the Fast Fourier Transform. The idea is to write the solution of the differential equation as a sum of certain "basis functions" (for example, as a Fourier series which is a sum of sinusoids) and then to choose the coefficients in the sum in order to satisfy the differential equation as well as possible. Spectral methods and finite element methods are closely related and built on the same ideas; the main difference between them is that spectral methods use basis functions that are nonzero over the whole domain, while finite element methods use basis functions that are nonzero only on small subdomains. In other words, spectral methods take on a global approach while finite element methods use a local approach. Partially for this reason, spectral methods have excellent error properties, with the so-called "exponential convergence" being the fastest possible, when the solution is smooth. However, there are no known three-dimensional single domain spectral shock capturing results. In the finite element community, a method where the degree of the elements is very high or increases as the grid parameter h decreases to zero is sometimes called a spectral element method. 2.2.5 Domain Decomposition In mathematics, numerical analysis, and numerical partial differential equations, domain decomposition methods solve a boundary value problem by splitting it into smaller boundary value problems on subdomains and iterating to coordinate the solution between adjacent subdomains. A coarse problem with one or few unknowns per subdomain is used to further coordinate the solution between the subdomains globally 12

Finite element simulations of moderate size models require solving linear systems with millions of unknowns. Several hours per time step is an average sequential run time, therefore, parallel computing is a necessity. Domain decomposition methods embody large potential for a parallelization of the finite element methods, and serve a basis for distributed, parallel computations. The problems on the subdomains are independent, which makes domain decomposition methods suitable for parallel computing. Domain decomposition methods are typically used as preconditioners for Krylov space iterative methods, such as the conjugate gradient method or GMRES. In overlapping domain decomposition methods, the subdomains overlap by more than the interface. Overlapping domain decomposition methods include the Schwarz alternating method and the additive Schwarz method. Many domain decomposition methods can be written and analyzed as a special case of the abstract additive Schwarz method. In non-overlapping methods, the subdomains intersect only on their interface. In primal methods, such as Balancing domain decomposition and BDDC, the continuity of the solution across subdomain interface is enforced by representing the value of the solution on all neighboring subdomains by the same unknown. In dual methods, such as FETI, the continuity of the solution across the subdomain interface is enforced by Lagrange multipliers. The FETI-DP method is hybrid between a dual and a primal method. Nonoverlapping domain decomposition methods are also called iterative substructuring methods. Mortar methods are discretization methods for partial differential equations, which use separate discretization on nonoverlapping subdomains. The meshes on the subdomains do not match on the interface, and the equality of the solution is enforced by Lagrange multipliers, judiciously chosen to preserve the accuracy of the solution. In the engineering practice in the finite element method, continuity of solutions between non-matching subdomains is implemented by multiple-point constraints.

2.2.6 Multigrid methods Multigrid (MG) methods in numerical analysis are group of algorithms for solving differential equations using a hierarchy of discretizations. They are an example of a class of techniques called multiresolution methods, very useful in (but not limited to)

13

problems exhibiting multiple scales of behavior. For example, many basic relaxation methods exhibit different rates of convergence for short- and long-wavelength components, suggesting these different scales be treated differently, as in a Fourier analysis approach to multigrid. MG methods can be used as solvers as well as preconditioners. The main idea of multigrid is to accelerate the convergence of a basic iterative method by global correction from time to time, accomplished by solving a coarse problem. This principle is similar to interpolation between coarser and finer grids. The typical application for multigrid is in the numerical solution of elliptic partial differential equations in two or more dimensions. Multigrid methods can be applied in combination with any of the common discretization techniques. For example, the finite element method may be recast as a multigrid method. In these cases, multigrid methods are among the fastest solution techniques known today. In contrast to other methods, multigrid methods are general in that they can treat arbitrary regions and boundary conditions. They do not depend on the separability of the equations or other special properties of the equation. They have also been widely used for morecomplicated non-symmetric and nonlinear systems of equations, like the Lamé system of elasticity or the Navier-Stokes equations. 2.2.7 Method of lines The method of lines (MOL, NMOL, NUMOL) is a technique for solving partial differential equations (PDEs) in which all but one dimension is discretized. MOL allows standard, general-purpose methods and software, developed for the numerical integration of ordinary differential equations (ODEs) and differential algebraic equations (DAEs), to be used. A large number of integration routines have been developed over the years in many different programming languages, and some have been published as open sourceresources. The method of lines most often refers to the construction or analysis of numerical methods for partial differential equations that proceeds by first discretizing the spatial derivatives only and leaving the time variable continuous. This leads to a system of ordinary differential equations to which a numerical method for initial value ordinary equations can be applied. The method of lines in this context dates back to at least the early 1960s.

14

2.2.8 Meshfree method The Finite Point Method (FPM) is a meshfree method for solving partial differential equations (PDEs) on scattered distributions of points In mesh-free finite point method (FPM) with domain decomposition is investigated for solving a nonlinear PDE (partial differential equation) to de-noise digital images. The obtained algorithm is parallel and ideal for parallel computers. The finite point method is a mesh-free method based on the point collocation of moving least squares approximation. This method is easily applicable to nonlinear problems due to the lack of dependence on a mesh or integration procedure. Also computer experiments indicate the efficiency of the proposed method. Mesh-free methods have gained much attention in recent years, not only in the mathematics but also in the engineering community, much of the work concerned with meshfree approximation methods is inter-disciplinary .Moreover, computation with highdimensional data is an important issue in many areas of science and engineering. Many traditional numerical methods can either not handle such problems at all, or are limited to very special (regular) situations. Mesh-free methods are often better suited to cope with changes in the geometry of the domain of interest (e.g., free surfaces and large deformations) than classical discretization techniques such as finite differences, finite elements or finite volumes. Another obvious advantage of mesh-free discretization is of course their independence from a mesh. 2.2.9 Radial Basic Function Radial basis functions (RBFs) are constructed in terms of one-dimensional distance variable and appear to have certain advantages over the traditional coordinates-based functions. In contrast to the traditional meshed-based methods, the RBF collocation methods are mathematically simple and truly meshless, which avoid trouble some mesh generation for high-dimensional problems involving irregular or moving boundary. The traditional basis functions in numerical PDEs are mostly coordinate functions, such as polynomial and trigonometric functions, which are computationally expensive in dealing with high dimensional problems due to their dependency on geometric complexity. Alternatively, radial basis functions (RBFs) are constructed in terms of one-dimensional distance variable irrespective of dimensionality of problems and appear to have a clear edge over the traditional basis functions directly in terms of coordinates. In the first part of this chapter, we introduces classical RBFs, such as globally-supported RBFs (Polyharmonic splines, Multiquadratics, Gaussian, etc.), and recently developed RBFs, such as compactly-supported 15

RBFs. Following this, several problem-dependent RBFs, such as fundamental solutions, general solutions, harmonic functions, and particular solutions, are presented. The main advantages of the RBF method are:  The method is mesh-free, which means that it is flexible with respect to the geometry of the computational domain. It also means that the method is suitable for problems where data is only available at scattered points.  The method is not more complicated for problems with many space dimensions, since the only geometrical property that is used is the pair wise distance between points.  For smooth functions, approximations with smooth RBFs can give spectral convergence 2.3 Anisotropic diffusion In image processing and computer vision, anisotropic diffusion, also called Perona– Malik diffusion, is a technique aiming at reducing image noise without removing significant parts of the image content, typically edges, lines or other details that are important for the interpretation of the image. Anisotropic diffusion resembles the process that creates a scale space, where an image generates a parameterized family of successively more and more blurred images based on a diffusion process. Anisotropic diffusion is a generalization of this diffusion process: it produces a family of parameterized images, but each resulting image is a combination between the original image and a filter that depends on the local content of the original image. APPLICATIONS OF ANISOTROPIC DIFFUSION: 1) Anisotropic diffusion function may apply on gray scaled images. 2) Anisotropic diffusion eliminates aliasing effects but improves on these other techniques by reducing blur and preserving detail at extreme viewing angles. 3) On the other hand nonlinear scale-spaces allow for the inclusion of knowledge about local criteria such as edge-strength to smooth homogeneous regions while preserving the boundaries. 4) Our project's result highlight the possible applications of anisotropic smoothing. LIMITATIONS OF ANISOTROPIC DIFFUSION: We can notice that while the diffusion process blurs the image considerably as the number of iterations increases, the edge information progressively degrades as well. This is not a desirable effect and exactly the drawback that Perona & Malik address in their work.

16

3. Progress 3.1 Anisotropic Diffusion using finite difference method The Perona Malik equation(Anisotropic Diffusion) : 1990 (Perona Malik equation provides a potential algorithm for noise removing, image segmentation, edge detection and image enhancement, Basic idea of Perona-Malik algorithm is to evolve an initial image u^0(X) defined as defined in a domain Ω⊆ R^n under a diffusion operator with the edge controlling property. u(t) - ∇. (𝑔( | ∇𝑈| )∇𝑈) = 0, where u(t,x) is an unknown function defined in I× Ω. The equations are accompanied by zero Neumann boundary conditions and the initial condition 𝑑u 𝑑𝑛

= 0, on I * d Ω ,

u(0,x) = u^0(x), in Ω where n is the unit outward normal to the boundary of Ω. 1.Scattered Data Interpolation in Euclidean space 2.Radial Basis Function Interpolation 3.Positive Definite Functions This diffusion process is a linear and space invariant transformation of the original image. Anisotropic diffusion is a generalization of this diffusion process: it produces a family of parameterized images, but each resulting image is a combination between the original image and a filter that depends on the local content of the original image. As a consequence, anisotropic diffusion is a non-linear and space-variant transformation of the original image Formally ,let   R^2 denotes a subset of the plane and I(.,t) :Ω→R be a family of gray scale image then anisotropic diffusion as define as 𝑑𝐼 = 𝑑𝑖𝑣 𝑐 𝑧, 𝑦, 𝑡 ∇𝐼 = ∇𝑐. ∇𝐼 + 𝑐 𝑥, 𝑦, 𝑡 ∆𝐼 𝑑𝑡 17

Where ∆ denotes the laplacian ,∇ denotes the gradient div(…)is the divergence operator and c(x,y,t) is diffusion coefficient c(x,y,t) control the rate of diffusion and is usually choosen as a function of image gradient so as to preserve edges in the images. The idea of an isotropic diffusion in 1990 and proposed two function for diffusion coefficient, −

2

∇𝐼 𝐾

C( ∇𝐼 ) =𝑒 And C( ∇𝐼 ) =

1 (1+(|𝛻𝐼|/𝐾))^2

The constant k controls the sensitivity to edges and is usually choosen experimentally or as a function of noise in the image. Anisotropic diffusion can be used to remove noise from digital images without blurring edges .With a constant diffusion coefficient, the anisotropic diffusion equations reduce to the heat equation which is equivalent to Gaussian blurring . This is ideal for removing noise but also indiscriminately blurs edges too. When the diffusion coefficient is chosen as an edge seeking function, such as in Perona and Malik, the resulting equations encourage diffusion (hence smoothing) within regions and prohibit it across strong edges. Hence the edges can be preserved while removing noise from the image. 3.2 Dsolve method DSolve can solve ordinary differential equations (ODEs), partial differential equations (PDEs), differential algebraic equations (DAEs), delay differential equations (DDEs), and hybrid differential equations. The output from DSolve is controlled by the form of the dependent function u or DSolve is controlled by the form of the dependent function u or DSolve [eqn,u,x]Using D to take derivatives, this sets up the c=2 transport equation, 1 𝑑𝑦 2 𝑑𝑥

𝑥, 𝑡 +

𝑑𝑦 𝑑𝑥

𝑥, 𝑡 = 0 and stores it as PDE:

18

PDE = D[y[x, t], t] + 2D[y[x, t], x] == 0 y(O,1)[ x , t] + 2y(1,O)[x, t] = = 0 Use D DSolve to solve the equation and store the solution as Soln. The first argument to DSolve is an equation, the second argument is the function to solve for, and the third argument is a list of the independent variables Soln = DSolve[PDE, y[x, t], {x, t}] 1

= {{ y [x,t] → C[1] [ (2t –x)]}} 2

The answer is given as a rule and C[1] is an arbitrary function.

Solution in form of function: f[x, t] = y[x, t]/soln[[1]] 1

= c[1] [ (2t − x)] 2

Evaluating f[x, t] like any other function: = f[x, 0] 𝑥 = c[1] [t− ] 2

Add initial condition y(0,t)= Sin(t) now solution is like Sol = DSolve[{PDE, y[0, t] == Sin[t]}, y[x, t], {x, t}] 1

= {{ y[x, t] → Sin [ (2t − x)]}}. 2

Use DSolve with the inhomogeneousm PDE

2

𝑑𝑦 𝑑𝑠

( x, t)+

𝑑𝑦 𝑑𝑠

(x, t) = Sin(x)

with initial condition

19

y(0, t) = Cos(t) Sol1 = DSolve[{D[y[x, t], t] + 2D[y[x, t], x] = = Sin[x], y[0, t] = = Cos[t]}, y[x, t], {x, t}] 1 = {{y[x, t]→ 1/2(1 + 2Cos [ (2t − x)] − Cos[x])}} 2 3.3 Redial basic function to solve PDE RBF methods have been introduced for interpolation of scattered data. Numerical methods based on radial basis functions (RBFs) are rapidly gaining popularity for the solution of partial differential equations (PDEs). With a history extending back four decades for RBF interpolation schemes and two decades for RBFs applied to solving PDEs, many avenues of research remain untouched within their realm. Being a mesh-less method, RBF methods excel at solving problems that require geometric edibility with scattered node layouts in n-dimensional space. RBFs are the natural generalization of univariate polynomial splines to a multivariate setting. The main advantage of this type of approximation is that it works for arbitrary geometry with high dimensions and it does not require a mesh at all. A RBF is a function whose value depends only on the distance from some center point. Using distance functions, RBFs can be easily implemented to reconstruct a plane or surface using scattered data in 2D, 3-D or higher dimensional spaces. Due to the uses of the distance functions, the RBFs can be easily implemented to reconstruct the surface using scattered data in 2D, 3D or higher dimensional spaces. Let r be the Euclidean distance between x* ∈ Rd i.e. ||x-x*||2 .A radial function φ∗= φ(||x-x*||2 ) depends only on the distance between x ∈ Rd and a fixed point, x* ∈ Rd . This property implies that the radial basis functions φ∗ are radials symmetric about x* and the functions globally supported, infinitely differentiable, and depend on a free parameter c.

20

Some well known functions that generates RBFs and mathematical definitions

Inverse multi-quadrics(IMQ)

φ (r) = exp(−cr2) 2 φ (r) = √r 2 + c 2 φ (r) = ( √r2 + c2)2

Inverse quadrics(IQ)

2+ ( √2r+ )2 φ (r) = (r c2c)2−1

Gaussian(GA) Hardy multi-quadrics(MQ)

Let x1, x2, … , xn be a given set of distinct points in Rd . The idea behind the use of RBFs is interpolation with a linear combination of RBFs of the same type as follows: n F(x) = ∑ λjφj(x) j−1 where φ j(x) = φ (∥ x − xi ∥) and λj are unknown scalars for i=1 ,…,n. Assume that we want interpolate the given values fi = f(xj), i = 1. . , n.The unknown scalars λj are chosen, so that F(xj) = fj for j = 1, … , n which results in the following linear system of equations: Az = f A depends on the shape parameter c, support of the RBFs and the separation distance of interpolation points. Also, the condition number grows with N for fixed values of the shape parameter c. PROCESS TO SOLVE: let us considered the initial equation of PDE, Lu(x, t) = q(x, t),

(x, t) ϵ(a, b) × (0, T) ........................................1.1

Where (a, b) ⊂ Ran open spatial interval and L is is a second order linear parabolic operator, with the following initial and boundary conditions: 21

u(x, 0) = f(x),

x ϵ (a, b) ................................................... 1.2

u(a, t) = g1(t),

t ϵ (0, T) ....................................................... .1.3

u(b, t) = g2(t),

t ϵ (0, T)…………………………...……….1.4

At first, the domain Ω = [a, b] × [0, T] is decomposed as Ω= ⋃j=1 Ωj………………………………………...1.5 Where Ωi = [a, b] × [(i − 1)T1, T1] for a sufficiently small value of T1 =T/ s and positive integer s. in each sub-domain Ωi using the collocation technique.

E1 = ({(xi, ti)} ∀i = 1 to n )Ω1,……………………………………….1.6 be a set of scattered nodes. Using the radial basis collocation method, the solution of the problem in [a, b] × [0, T1] is looked for as u1 = ∑nαi, φi,(x, t)………………………………………………….1.7 i=1

Where φ i(x, t) = φ (∥ (x, t) − (xi, ti) ∥) for a given radial function φ and α1i ,I = 1, . . n are unknown. In fact, the RBFs are used for discretization of both time and space variables in [a, b] × [0, T1]. Now, by the collocation approach, we impose the approximation solution to satisfy the given differential equation with initial and boundary conditions at(xi, ti), i = 1, … , n. Therefore, we have Lu1(xj, tj) = q(xj, tj) u1( xj, tj) = f(xj),

(xj tj) ∈ [a, b] × (0, T1],.............................1.8 (xj tj) ∈ [a, b] × (0, T1],…………………..1.9

u1( xj, tj) = g1(tj),

(xj, tj) ∈ [a] × (0, T1)]…………………..1.10

u1( xj, tj) = g2(tj),

(xj, tj) ∈ [b] × (0, T1)]…………………..1.11

which result in a linear system of equations Aa1=b1………………………………………………………………….1.12 22

Here, A is a N×N matrix, If T1 is chosen such that a small number of the collocation points provide an accurate approximation in [a, b] × [0, T1], A will be a low- dimensional matrix and therefore, finding the PLU decomposition of A is easy. So, we have PLU a1=b1…………………………………………………………….….1.13 Where L = [�ij] and U= [uij] are lower and upper triangular matrices, respectively, with lii = 1 for i = 1, … , N and P is a permutation matrix.This factorization needs O(n 3 )number of operations. Since P is a permutation matrix, we have P - 1 = P. Therefore LUα1= Pb1………………………………………..…………………1.14 We are using the forward substitution with order of (n2 ) solutions. 3.4 Meshfree methods for PDEs: Meshfree methods are a means by which partial differential equations can be numerically implemented. Two main advantages of these methods is that they can work in high dimensional spaces and that they are less restricted by a preset domain on which the PDEs are run. Meshfree methods are chosen here because finite difference and finite element methods are impractical in high dimensional spaces. Two main drawbacks of meshfree methods are the difficulty associated with creating an approximation to an arbitrary function and imposing boundaries constraints. Both of the issues are trivial in the simplest finite difference and finite element situations. But as is explained in the methods section, neither of these significant difficulties come into play for the proposed denoising approach. Meshfree methods are not common in image processing applications Meshless methods are uniquely simple, yet provide solution accuracies for certain classes of equations that rival those of finite elements and boundary elements without requiring the need for mesh connectivity. Ease in programming, no domain or surface discretization, no numerical integration, and similar formulations for 2-D and 3-D make these methods very attractive. There exist several types of meshless methods. The more common techniques include kernel methods, moving least square method, meshless Petrov- Galerkin, partition of unity methods, smooth-particle hydrodynamics, and radial basis functions. Each technique has particular traits and advantages for specific classes of problems. Generally the simplest and easiest to implement is the radial basis function approach. The examples illustrated here are based on radial basis functions (RBFs) and Kansa’s approach. Meshless methods utilizing RBFs create mesh-free algorithms that are significantly simpler to employ than FDM/FVM, FEM, and BEM approaches, and truly eliminate the need for meshes requiring connectivity and optimization. 23

4. Results and Discussions For image enhancement using anisotropic diffusion using finite difference method initially we filtered our image for 1 iteration we don’t find not to much effective result we increase no of iterations from 1to 10 and find little bit change , so we iterate it 10 times and collect the data in form of original image and filtered image. We have done 3D anisotropic diffusion using Finite difference method for enhance the images and calculate MSE and PSNR of these images. 4.1 PEAK SIGNAL TO NOISE RATIO (PSNR) PSNR(Peak signal-to-noise ratio): PSNR is most commonly used to measure the quality of reconstruction of lossy compression codecs e.g., for image compression. The signal in this case is the original data, and the noise is the error introduced by compression. When comparing compression codecs, PSNR is an approximation to human perception of reconstruction quality. a higher PSNR generally indicates that the reconstruction is of higher quality, in some cases it may not. One has to be extremely careful with the range of validity of this metric; it is only conclusively valid when it is used to compare results from the same codec (or codec type) and same content. PSNR is most easily defined via the mean squared error ( MSE{mean square error}), The PSNR (in dB) is defined as: PSNR=10*𝑙𝑜𝑔10 𝑀𝐴𝑋𝑖² ∕ 𝑀𝑆𝐸 =20*𝑙𝑜𝑔10 (MAXi)/√MSE = 20*𝑙𝑜𝑔10 (MAXi)-10*𝑙𝑜𝑔10 (MSE) Here, MAXi is the maximum possible pixel value of the image. 4.2 MEAN SQUARE ERROR (MSE): MSE (mean square error) also known as MSD (mean squared deviation ) The MSE assesses the quality of an estimator (i.e., a mathematical function mapping a sample of data to a parameter of the population from which the data is sampled) or a predictor (i.e., a function mapping arbitrary inputs to a sample of values of some random variable). Definition of an MSE differs according to whether one is describing an estimator or a predictor.

24

In statistics, the mean squared error (MSE) or mean squared deviation (MSD) of an estimator measures the average of the squares of the errors or deviations, that is, the difference between the estimator and what is estimated. MSE is a risk function, corresponding to the expected value of the squared error loss or quadratic loss. The difference occurs because of randomness or because the estimator doesn't account for information that could produce a more accurate estimate The MSE is the second moment (about the origin) of the error, and thus incorporates both the variance of the estimator and its bias. For an unbiased estimator, the MSE is the variance of the estimator. Like the variance, MSE has the same units of measurement as the square of the quantity being estimated. In an analogy to standard deviation, taking the square root of MSE yields the root-mean-square error or root-mean-square deviation (RMSE or RMSD) Given a noise-free m*n monochrome image I and its noisy approximation K, MSE is defined as: MSE=1∕mn Σ [ I( i, j )-K( i , j )]² ∀ i =0 to m-1 ∀ j =0 to n-1 4.3 ABSOLUTE MEAN SQUARE ERROR (AMSE) In statistics, the mean absolute error (MAE) is a quantity used to measure how close forecasts or predictions are to the eventual outcomes. The mean absolute error is given by MAE= 1/n =1/n

𝑛 𝑖=1 |𝑓(𝑖) − 𝑛 𝑖=1 |𝑒(𝑖) |

𝑦(𝑖) |

As the name suggests, the mean absolute error is an average of the absolute errors |e(i)|=|f(i)y(i)| where f(i) is the prediction and y(i) is the true value. Note that alternative formulations may include relative frequencies as weight factors. The mean absolute error is on same scale of data being measured. This is known as a scaledependent accuracy measure and therefore cannot be used to make comparisons between series on different scales.

25

The mean absolute error is a common measure of forecast error in time ,series analysis, where the terms "mean absolute deviation" is sometimes used in confusion with the more standard definition of mean absolute deviation. The same confusion exists more generally. 4.4 CONTRAST ENHANCEMENT INDEX Contrast enhancement is an important area in the field of digital image processing for human visual perception and computer vision. It is extensively used for medical image processing and as a preprocessing step in speech recognition, texture synthesis, and many other image/video processing applications . There are many different methods have been developed for image contrast enhancement . Here we discussed some popular image contrast enhancement. Contrast Enhancement is a specific characteristics enhancement in the image enhancement processing. In which histogram equalization (HE) is the one of the popular method of image contrast enhancement . The histogram of the discrete gray-level image represent the frequency of occurrence of all gray-levels in the image . Histogram equalization well distributes the pixels intensity over the full intensity range. But HE has "mean-shift" problem , it shifts the mean intensity value to the middle gray level of the intensity range. So this technique is not useful where brightness preservation is required. 4.5 Data set we have data set of 300 images which are medical images and we have done experiment on few of them . 4.6 Result using finite difference method We have done 3D anisotropic diffusion using Finite difference method for enhance the images and calculate MSE and PSNR of these images.

26

Mdb001

Mdb002

27

Mdb005

Mdb010

28

Mdb012

Image No. Mdb001 Mdb002 Mdb005 Mdb010 Mdb012

MSE 0.08 0.14 0.16 0.10 0.14

PSNR(dB) 58.8853064 dB 56.6030023dB 55.5021124dB 57.8843003dB 56.6304123dB

4.7 Result using radial basic function to solve PDE We have tried to solve partial differential equation(PDE) and implement this in matlab After implementation following output come:

29

Fig shows graph of our output:

Numerical integration=2.088578e-001 Analytical integration=2.088564e-001 From starting we explore this topic and do literature review find different techniques to do image enhancement by mesh free approximation. Derived mathematical equations for mess free approximation by all these we are collecting few important data regarding our project these points are : 1.1 Anisotropic diffusion techniques for image enhancement. 1.2 We explore finite difference methods is investigated for solving a nonlinear PDE (partial differential equation) to de-noise digital images 1.3 The method is mesh-free, which means that it is flexible with respect to the geometry of the computational domain. It also means that the method is suitable for problems where data is only available at scattered points. 1.4 The method is not more complicated for problems with many space dimensions, since the only geometrical property that is used is the pair wise distance between points. 1.5 For smooth functions, approximations with smooth RBFs can give spectral convergence.

30

   

Accuracy Comparison for RBFs against Some Other Techniques.We have read many research papers on mesh free approximation via radial basic functions and solving PDEs in 1D , 2D and 3D for many images. we are trying to change efficiency of the existing process and performance measurement. In this report we are little bit work on comparison RBF with other technologies. we already proposed a numerical method based on the radial basis functions (RBFs) method for the solution of nonlinear two-dimensional integral equations of the second kind on the non-rectangular domains, and we are focusing on this method because of there are many advantages .... The method does not require domain elements or background cells for interpolation or approximation. The distribution of nodes could be selected regularly or randomly in the analyzed domain so the method does not depend to the geometry of domain. The method could be easily extended to the higher dimension problems and it does not increase the difficulty for these problems due to the easy adaption of RBFs. It is easy to implement the technique on computer and is more flexible for most classes of integral equations. 4.8 Result of finite point method to solve

31

4.9 Result of Anisotropic diffusion Meshfree Method image with iteration 2

Iteration 4

Iteration 10

Mdb306.pgm

Mdb306.pgm

Mdb306.pgm

image with iteration 2

Iteration 4

Iteration 10

Mdb305.pgm

Mdb305.pgm

Mdb305.pgm

image with iteration 2

Iteration 4

Iteration 10

Mdb304.pgm

Mdb304.pgm

Mdb304.pgm

32

image with iteration 2

Iteration 4

Iteration 10

Mdb302.pgm

Mdb302.pgm

Mdb302.pgm

image with iteration 2

Iteration 4

Iteration 10

Mdb301.pgm

Mdb301.pgm

Mdb301.pgm

Image No.

MSE

PSNR(dB)

Mdb306

0.15

51.3451026dB

Mdb305

0.12

56.6030023dB

Mdb304

0.10

57.2051026dB

Mdb302

0.16

52.4842005dB

Mdb301

0.09

59.8735046dB

33

4. Summary and Conclusion Our main goal in internship is implementing and analysing enhanced image using meshfree techniques and domain decomposition and bring improvement in them So we have studied many research papers and books to know about meshfree methods and related work, and implemented meshree method and finite difference method using anisotropic diffusion in matlab which is useful in storing results of enhance images In recent years, the main focus of the applications of RBFs seems to have shifted from scattered data interpolation to the numerical solution of partial differential equations (PDEs). One of the domain-type meshless methods, the so-called Kansa’s method developed by Kansa in 1990 and is obtained by directly collocating RBFs, particularly the multiquadratic (MQ), for the numerical approximation of the solution. We have read research papers on mesh free approximation, image enhancement, mesh free anisotropic diffusion and collect information about image enhancement. How to reduce noise of any image and also learn about many techniques to reduce noise from any image. For image enhancement initially we filtered our image for 1 iteration we don’t find not to much effective result we increase no of iterations from 1to 10 and find little bit change , so we iterate it 10 times and collect the data in form of original image and filtered image. We have done 3D anisotropic diffusion using Finite difference method for enhance the images and calculate MSE and PSNR of these images. RBF methods have been introduced for interpolation of scattered data. Numerical methods based on RBFs appear very efficient for isotropic problems In contrast to the traditional meshed-based methods such as finite difference, finite element, and boundary element methods, the RBF collocation methods are mathematically very simple to implement and truly meshless, which avoid troublesome mesh generation for high-dimensional problems involving irregular or moving boundary We are using the forward substitution with order of (n2 ) solutions

34

5. Appendix Matlab code for solveing PDE to Finite Difference Method: function diff_vol = anisodiff3D(vol, num_iter, delta_t, kappa, option, voxel_spacing) % Convert input volume to double. vol = double(vol); % Useful variables. [rows cols pags] = size(vol); % PDE (partial differential equation) initial condition. diff_vol = vol; clear vol % Center voxel distances. x = voxel_spacing(1); y = voxel_spacing(2); z = voxel_spacing(3); dx = 1; dy = 1; dz = z/x; dd = sqrt(dx^2+dy^2); dh = sqrt(dx^2+dz^2); dc = sqrt(dd^2+dz^2); % 3D h1 = h2 = h3 = h4 = h5 = h6 =

convolution masks - finite differences. zeros(3,3,3); h1(2,2,2) = -1; h1(2,2,1) zeros(3,3,3); h2(2,2,2) = -1; h2(2,2,3) zeros(3,3,3); h3(2,2,2) = -1; h3(2,1,2) zeros(3,3,3); h4(2,2,2) = -1; h4(2,3,2) zeros(3,3,3); h5(2,2,2) = -1; h5(3,2,2) zeros(3,3,3); h6(2,2,2) = -1; h6(1,2,2)

h7 = zeros(3,3,3); h7(2,2,2) = h8 = zeros(3,3,3); h8(2,2,2) = h9 = zeros(3,3,3); h9(2,2,2) = h10 = zeros(3,3,3); h10(2,2,2) h11 = zeros(3,3,3); h11(2,2,2) h12 = zeros(3,3,3); h12(2,2,2) h13 = zeros(3,3,3); h13(2,2,2) h14 = zeros(3,3,3); h14(2,2,2)

= = = = = =

1; 1; 1; 1; 1; 1;

-1; h7(3,1,1) = 1; -1; h8(2,1,1) = 1; -1; h9(1,1,1) = 1; = -1; h10(3,2,1) = = -1; h11(1,2,1) = = -1; h12(3,3,1) = = -1; h13(2,3,1) = = -1; h14(1,3,1) =

1; 1; 1; 1; 1; 35

h15 h16 h17 h18

= = = =

zeros(3,3,3); zeros(3,3,3); zeros(3,3,3); zeros(3,3,3);

h15(2,2,2) h16(2,2,2) h17(2,2,2) h18(2,2,2)

= = = =

-1; -1; -1; -1;

h15(3,1,2) h16(1,1,2) h17(3,3,2) h18(1,3,2)

= = = =

1; 1; 1; 1;

h19 h20 h21 h22 h23 h24 h25 h26

= = = = = = = =

zeros(3,3,3); zeros(3,3,3); zeros(3,3,3); zeros(3,3,3); zeros(3,3,3); zeros(3,3,3); zeros(3,3,3); zeros(3,3,3);

h19(2,2,2) h20(2,2,2) h21(2,2,2) h22(2,2,2) h23(2,2,2) h24(2,2,2) h25(2,2,2) h26(2,2,2)

= = = = = = = =

-1; -1; -1; -1; -1; -1; -1; -1;

h19(3,1,3) h20(2,1,3) h21(1,1,3) h22(3,2,3) h23(1,2,3) h24(3,3,3) h25(2,3,3) h26(1,3,3)

= = = = = = = =

1; 1; 1; 1; 1; 1; 1; 1;

% Anisotropic diffusion. for t = 1:num_iter % Finite differences. [imfilter(.,.,'conv') can be replaced by convn(.,.,'same')] for p = 1:pags-2 diff3pp = diff_vol(:,:,p:p+2); aux = imfilter(diff3pp,h1,'conv'); nabla1 = aux = imfilter(diff3pp,h2,'conv'); nabla2 = aux = imfilter(diff3pp,h3,'conv'); nabla3 = aux = imfilter(diff3pp,h4,'conv'); nabla4 = aux = imfilter(diff3pp,h5,'conv'); nabla5 = aux = imfilter(diff3pp,h6,'conv'); nabla6 = aux = imfilter(diff3pp,h7,'conv'); nabla7 = aux = imfilter(diff3pp,h8,'conv'); nabla8 = aux = imfilter(diff3pp,h9,'conv'); nabla9 = aux = imfilter(diff3pp,h10,'conv'); nabla10 aux = imfilter(diff3pp,h11,'conv'); nabla11 aux = imfilter(diff3pp,h12,'conv'); nabla12 aux = imfilter(diff3pp,h13,'conv'); nabla13 aux = imfilter(diff3pp,h14,'conv'); nabla14 aux = imfilter(diff3pp,h15,'conv'); nabla15 aux = imfilter(diff3pp,h16,'conv'); nabla16 aux = imfilter(diff3pp,h17,'conv'); nabla17 aux = imfilter(diff3pp,h18,'conv'); nabla18 aux = imfilter(diff3pp,h19,'conv'); nabla19 aux = imfilter(diff3pp,h20,'conv'); nabla20 aux = imfilter(diff3pp,h21,'conv'); nabla21 aux = imfilter(diff3pp,h22,'conv'); nabla22 aux = imfilter(diff3pp,h23,'conv'); nabla23 aux = imfilter(diff3pp,h24,'conv'); nabla24 aux = imfilter(diff3pp,h25,'conv'); nabla25 aux = imfilter(diff3pp,h26,'conv'); nabla26

aux(:,:,2); aux(:,:,2); aux(:,:,2); aux(:,:,2); aux(:,:,2); aux(:,:,2); aux(:,:,2); aux(:,:,2); aux(:,:,2); = aux(:,:,2); = aux(:,:,2); = aux(:,:,2); = aux(:,:,2); = aux(:,:,2); = aux(:,:,2); = aux(:,:,2); = aux(:,:,2); = aux(:,:,2); = aux(:,:,2); = aux(:,:,2); = aux(:,:,2); = aux(:,:,2); = aux(:,:,2); = aux(:,:,2); = aux(:,:,2); = aux(:,:,2);

% Diffusion function. if option == 1 36

c1 = exp(-(nabla1/kappa).^2); c2 = exp(-(nabla2/kappa).^2); c3 = exp(-(nabla3/kappa).^2); c4 = exp(-(nabla4/kappa).^2); c5 = exp(-(nabla5/kappa).^2); c6 = exp(-(nabla6/kappa).^2); c7 = exp(-(nabla7/kappa).^2); c8 = exp(-(nabla8/kappa).^2); c9 = exp(-(nabla9/kappa).^2); c10 = exp(-(nabla10/kappa).^2); c11 = exp(-(nabla11/kappa).^2); c12 = exp(-(nabla12/kappa).^2); c13 = exp(-(nabla13/kappa).^2); c14 = exp(-(nabla14/kappa).^2); c15 = exp(-(nabla15/kappa).^2); c16 = exp(-(nabla16/kappa).^2); c17 = exp(-(nabla17/kappa).^2); c18 = exp(-(nabla18/kappa).^2); c19 = exp(-(nabla19/kappa).^2); c20 = exp(-(nabla20/kappa).^2); c21 = exp(-(nabla21/kappa).^2); c22 = exp(-(nabla22/kappa).^2); c23 = exp(-(nabla23/kappa).^2); c24 = exp(-(nabla24/kappa).^2); c25 = exp(-(nabla25/kappa).^2); c26 = exp(-(nabla26/kappa).^2); elseif option == 2 c1 = 1./(1 + (nabla1/kappa).^2); c2 = 1./(1 + (nabla2/kappa).^2); c3 = 1./(1 + (nabla3/kappa).^2); c4 = 1./(1 + (nabla4/kappa).^2); c5 = 1./(1 + (nabla5/kappa).^2); c6 = 1./(1 + (nabla6/kappa).^2); c7 = 1./(1 + (nabla7/kappa).^2); c8 = 1./(1 + (nabla8/kappa).^2); c9 = 1./(1 + (nabla9/kappa).^2); c10 = 1./(1 + (nabla10/kappa).^2); c11 = 1./(1 + (nabla11/kappa).^2); c12 = 1./(1 + (nabla12/kappa).^2); c13 = 1./(1 + (nabla13/kappa).^2); c14 = 1./(1 + (nabla14/kappa).^2); c15 = 1./(1 + (nabla15/kappa).^2); c16 = 1./(1 + (nabla16/kappa).^2); c17 = 1./(1 + (nabla17/kappa).^2); c18 = 1./(1 + (nabla18/kappa).^2); c19 = 1./(1 + (nabla19/kappa).^2); c20 = 1./(1 + (nabla20/kappa).^2); c21 = 1./(1 + (nabla21/kappa).^2); c22 = 1./(1 + (nabla22/kappa).^2); c23 = 1./(1 + (nabla23/kappa).^2); c24 = 1./(1 + (nabla24/kappa).^2); c25 = 1./(1 + (nabla25/kappa).^2); 37

c26 = 1./(1 + (nabla26/kappa).^2); end % Discrete PDE solution. diff_vol(:,:,p+1) = diff_vol(:,:,p+1) + ... delta_t*(... (1/(dz^2))*c1.*nabla1 + (1/(dx^2))*c3.*nabla3 + (1/(dy^2))*c5.*nabla5 + ... (1/(dc^2))*c7.*nabla7 + (1/(dc^2))*c9.*nabla9 + (1/(dh^2))*c11.*nabla11 (1/(dh^2))*c13.*nabla13 ... (1/(dd^2))*c15.*nabla15 (1/(dd^2))*c17.*nabla17 ... (1/(dc^2))*c19.*nabla19 (1/(dc^2))*c21.*nabla21 (1/(dh^2))*c23.*nabla23 (1/(dh^2))*c25.*nabla25

(1/(dz^2))*c2.*nabla2 + ... (1/(dx^2))*c4.*nabla4 + ... (1/(dy^2))*c6.*nabla6 + ... (1/(dh^2))*c8.*nabla8 + ... (1/(dh^2))*c10.*nabla10 + ... + (1/(dc^2))*c12.*nabla12 + ... + (1/(dc^2))*c14.*nabla14 + ... + (1/(dd^2))*c16.*nabla16 + ... + (1/(dd^2))*c18.*nabla18 + ... + + + +

(1/(dh^2))*c20.*nabla20 + ... (1/(dh^2))*c22.*nabla22 + ... (1/(dc^2))*c24.*nabla24 + ... (1/(dc^2))*c26.*nabla26);

end % Iteration warning. fprintf('\rIteration %d\n',t); beep on beep, pause(0.2), beep beep off end % "End of Program" warning. beep on; beep, pause(0.5), beep, pause(0.5), beep, pause(0.5), beep, pause(0.5), beep, pause(0.5), beep, pause(0.5); vol=imread('mdb001.pgm'); num_iter = 10; delta_t = 3/44; kappa = 70; option = 2; voxel_spacing = ones(3,1); diff_vol = anisodiff3D(vol, num_iter, delta_t, kappa, option, voxel_spacing); result=uint8(diff_vol); subplot(1,2,1) imshow(vol) title('orignal'); subplot(1,2,1) 38

imshow(result) title('filtered');

Code for Radial Basic Function to solve PDE: rng(0); N_dim=2;%number of dimensions in input (1 or 2 for this example) N_t=10;%number of training points X_t=rand(N_t,N_dim);%training input Y_t=rand(N_t,1);%training output basisfunction='polyharmonicspline';%'gaussian' or 'polyharmonicspline' samecentres=true;%use the training data from the RBF centres? %This is advisable for polyharmonic splines if samecentres X_c=X_t; N_r=size(X_c,1);%number of RBF centres else N_r=6; X_c=rand(N_r,N_dim);%pick RBF centres end k_i=3*ones(N_r,1);%this is a prescaler if Gaussian, %otherwise it is the polyharmonic function order [W]=train_rbf(X_t,Y_t,X_c,k_i,basisfunction);%train weights N_plot=100*ones(1,N_dim);%number of points to calculate at switch N_dim case 1 X_plot=linspace(0,1,N_plot(1))';%points to calculate at case 2 x_plot=linspace(0,1,N_plot(1))'; y_plot=linspace(0,1,N_plot(2))'; [x_mesh, y_mesh]=meshgrid(x_plot,y_plot); X_plot=[reshape(x_mesh,[],1) reshape(y_mesh,[],1)]; end [Y_hat, phi]=sim_rbf(X_c,X_plot,W,k_i,basisfunction); if (N_dim==2)&&(strcmp(basisfunction,'gaussian')||( strcmp(basisfunction,'polyharmonicspline')&&(all(k_i==1|k_i==3)))) %check line integral int_flag=true; 39

X1=rand(1,N_dim);%endpoints of line X2=rand(1,N_dim);

N_numsoln=10000;%number of points in numerical solution X_numsoln=[linspace(X1(:,1),X2(:,1),N_numsoln)' linspace(X1(:,2),X2(:,2),N_numsoln)']; Y_num=sim_rbf(X_c,X_numsoln,W,k_i,basisfunction);%calculate points along line d=sqrt(sum((X1-X2).^2));%distance along line Y_int_num=mean(Y_num)*d;%numerical integration along line Y_int_anal=rbfn_integral(X_c,X1,X2,W,k_i,basisfunction);%analytical integration fprintf('Numerical integration=%e\nAnalytical integration=%e\n',Y_int_num,Y_int_anal) else int_flag=false; end figure(1) clf switch N_dim case 1 plot(X_plot,Y_hat) hold on plot(X_t,Y_t,'k*') hold off case 2 surf(x_plot,y_plot,reshape(Y_hat,N_plot(1),[])) shading interp hold on plot3(X_t(:,1),X_t(:,2),Y_t,'k*') if int_flag plot3(X_numsoln(:,1),X_numsoln(:,2),Y_num,'k') plot3([X1(:,1) X2(:,1)],[X1(:,2) X2(:,2)],Y_num([1 end]),'ko') end hold off end 40

Matlab code for Finite point method to solve PDE: function [u, energy] = Poisson(mesh, f, g_D, g_N) % POISSON solve the 2-D Poisson equation % -\Delta u = f, % % INPUT % mesh: current mesh % f: right side or data % g_D: Dirichelet condition % g_N: Neumann condition % % Initialize the data N = size(mesh.node,1); A = sparse(N,N); u = zeros(N,1); % Compute vedge: edge as a vector and area of each element ve(:,:,1) = mesh.node(mesh.elem(:,3),:)-mesh.node(mesh.elem(:,2),:); ve(:,:,2) = mesh.node(mesh.elem(:,1),:)-mesh.node(mesh.elem(:,3),:); ve(:,:,3) = mesh.node(mesh.elem(:,2),:)-mesh.node(mesh.elem(:,1),:); area = 0.5*abs(-ve(:,1,3).*ve(:,2,2)+ve(:,2,3).*ve(:,1,2)); % Assemble Stiffness matrix for i = 1:3 for j = 1:3 Aij = (ve(:,1,i).*ve(:,1,j)+ve(:,2,i).*ve(:,2,j))./(4*area); A = A + sparse(mesh.elem(:,i),mesh.elem(:,j),Aij,N,N); end end % Assemble Mass matrix M = sparse(mesh.elem(:,[1,1,1,2,2,2,3,3,3]), ... mesh.elem(:,[1,2,3,1,2,3,1,2,3]), ... area*[2,1,1,1,2,1,1,1,2]/12, N, N); % Assemble right-hand-side b = M*feval(f,mesh.node); % Neumann boundary conditions 41

if (~isempty(mesh.Neumann)) bdEdge = mesh.node(mesh.Neumann(:,1),:) ... - mesh.node(mesh.Neumann(:,2),:); d = sqrt(sum(bdEdge.^2,2));

mid = (mesh.node(mesh.Neumann(:,1),:) ... + mesh.node(mesh.Neumann(:,2),:))/2; b = b + sparse(mesh.Neumann, ... ones(size(mesh.Neumann,1),2),d.*g_N(mid)/2*[1,1],N,1); end % Dirichlet boundary conditions bdNode = unique(mesh.Dirichlet); u(bdNode) = feval(g_D,mesh.node(bdNode,:)); b = b - A * u; % adjust the right hand side % Solve the linear system A * U = B for the free nodes freeNode = find(mesh.type>0); freeNode = setdiff(freeNode, bdNode); if size(freeNode)>0 u(freeNode) = A(freeNode, freeNode) \ b(freeNode); end % Compute the energy of u if (nargout > 1) energy = full(0.5*u'*(A*u)- u'*M*feval(f,mesh.node)); end

42

References  http://www.sciencedirect.com/science/article/pii/S0377042712003743?np=y  Introduction-to-Matlab-Image-Processing-By-Dhananjay-K-Theckedath  Digital Image Processing, Second Edition, Rafael C. Gonzalez, University of Tennessee, Richard E.  http://www.mathworks.in/help/images/  https://reference.wolfram.com/language/tutorial/NDSolveReferences.html  Mesh-free Approximation Method with MATAB by Gregory E.Fashauer vol6  https://reference.wolfram.com/language/tutorial/NDSolveOverview.html  Recent Advances in Radial Basis Function CollocationMethods by Wen Chen ,Zhuo- Jia Fu,C..H. Chen  http://www.mia.uni-saarland.de/weickert/Papers/book.pdf  https://en.wikipedia.org/wiki/

43