A Novel Blurring and Sharpening Techniques Using Different Images Based on Heat Equations

This paper is dedicated to show the practical part of the heat equation and its influence on images from real-life. Examples of one dimension and two dimensions are given in this paper to show how applying the forward and backward time steps on an image that is inserted as a pixel matrix in the well-known heat equation with certain parameters can make the blurring, noising


Introduction
Many images that are taken by cameras or gotten from some experiments might have some issues with their resolution.For example, the unexpected movement of a photographer during taking pictures can end up with some initial distortion or equipment noise associated with those pictures.Moreover, there are some factors can affect images in the medical field such that the divergence of the x-ray photons, minimizing magnification, the size of the projected object ...etc.One usually can look at those undesirable issues in the image trying to get rid of them, or at least trying to reduce them in a certain way or another.Many authors suggested a variety of methods and using different techniques for enhancing images [1][2][3][4][5].The main purpose of doing such modifications on images is to get some details that are impossible to be seen without modifying the images.For example Figure 1, the result of a CT scan for a brain [6].In the left side, the original image with some unclear details due to a technical problem in the machine.However, the sharpened image on the right side shows those details clearly (Stroke, or (CVA) cerebrovascular accident).Most of the effects that we can see on the images are a result of changing the angle of the view that is considered the main reason for the deflection of light rays.In a scientific view, the deflection of light rays can cause blurring and sharping in the images.Mathematically, this can be related to the heat diffusion, where the heat can go among different values of degrees.Digital images can be represented mathematically as matrices or arrays of numbers.Therefore, the general plan of this paper is to converting the images to matrices and applies our mathematical operations in the next section that associated with the Heat Equation on those images to enhance them and then reconvert them to desirable images.

Involving The Heat Equation
Consider the heat equation where: α represents the thermal diffusivity.The constant α can have different values depending on the material.The high and low values of the heat are comparable to the high and low concentration of light on an image that results in changing its resolution.More specifically, we are going to take a model of heat transfer in one dimension and two dimensions and apply the explicit method, so we can get an accurate prediction of the diffusion of the heat (where the stability condition is held).In this case, we can noise and de-noise images when the heat is changed.In other words, forward time steps can result in noising images, while the backward time steps can end up with de-noising images.To generalize this to a two-dimensional image, we need to make a model for a heat diffusion in two directions x and y.In this case, our function will be in terms of x, y, and t.
Involving PDEs in image processing opens many questions to the readers, such as:  How the PDEs arise in the image processing?
Original Image Sharpened Image  What happens if we involve the heat equation in an image?
 How can the diffusion of the heat affect the images (blurring, nosing, sharpening …etc.)?
To answer these questions, we are going to focus on a certain technique of the image processing which is sharpening or de-blurring images that can be done by using the heat equation.This technique can also give us an idea about the other mentioned techniques.In fact, sharpening images can be easily applied on the grayscale images or black and white images, and that is because most of these images can be sharpened with no other unwanted effects that might come from this processing.For instance, medical images, maps in google earth, and graphs of equations results.More specifically, sharpening image can be applied on one dimension by taking a vector that represents the onedimensional image.In addition, the same mentioned technique can be applied on a matrix that represents the twodimensional images.After that, we can generalize this technique and take some examples from different kinds of grayscale images.On the other hand, dealing with 3D array of a color image that has dimension of (m × n × 3) is not analogous.In another expression, color images are decomposed into red, green, and blue (RGB).Therefore, we will work on every m × n matrix separately, and for the three colors to deal with this type of images.Even though sharpening images is mostly used in the grayscale images, it is important to mention that using it on color image can give a good result to those who want to get fancy professional color images.

Example of One Dimension (1D)
In this example, we will create a vector with 100 components and call it U.The vector U has positive numbers on positions 30 to 50, and let this positive number be 10.In addition, there is another positive number on positions 70 to 73, and let this positive number be 15.Finally, the rest of components in U are zeros.Figure 2 shows how the vector looks like.

Fig. 2 -U vector with 100 components.
It is important to mention that the vector U here is representing the 1D image.Intuitively, we can consider this vector in MATLAB as an initial temperature within a long thin wire.Later, we can apply the forward and backward finite difference to see how it will affect this vector.
Taking the time steps k = 10 and ∆t = 0.00001 and ∆x = 0.01 to satisfy the CFL condition and to give reasonable blurring and de-blurring for the vector.Applying it within the forward time differences to see how the image gets blurred in every iteration.Figure 3 shows the result which is done by MATLAB.
Applying the forward time steps to have the forward heat diffusion model of blurring.On the other hand, the negative time steps as shown here will be used once the forward time steps be done in order to de-blur our 1D image (vector).
Fig. 3 -The burring and sharpening on the U vector.
The backward iterations will give an oscillation eventually in the 1D example.However, it is not easy to get enough information about the result of that oscillation in a physical sense completely since we are dealing with onedimensional array.Therefore, we are going to have two-dimensional array example to see how it is ended up with these iterations.

Example of Two Dimension (2D)
In this example, we will simulate the alphabetical letters from ( × ) matrices.For example, the letter  can be represented by creating ( × ) matrix of zeros, then nonzero components to form the letter.In other words, this will create the letter as in the binary system that is known by 0 for the idle position, and 1 for the busy position.Figure 4 shows the visualize sparsity pattern that can be done by using the command spy(matrix), and a 3D view for the letter in MATLAB.

Fig. 4 -The simulation of the letter "W".
With the same argument, we can create the any combination of letters to represent any word or acronym of our choice.Working on these matrices can show us how the heat equation finite difference can affect these letters.More specifically, the matrix is a good example of two dimensions, and using it in MATLAB can clearly display the changes that are going to happen within the iterations of the forward and backward differences.Figure 5 shows the final form of the three letters WSU combined.Applying the forward time steps (FTS) in two dimensions on those matrices (letters) would be in this form: Viewing these letters by using the command (mesh) in MATLAB to view it as an initial temperature within a thin plate.After that, we apply the FTS by taking these numbers for the time steps k = 10 and ∆t = 0.00001, ∆x = 0.02, and ∆y = 0.02.We can apply different values, but we should satisfy the CFL condition to see clearly by MATLAB how the letters get blurred after each iteration gradually.
With the same argument above, but this time, we will apply the negative time steps (NTS) that has the form as shown in Figure 6 Fig. 6 -The burring on the "WSU" letters.

Original Image
Blurred Image by FTS Fig. 7 -The sharpening on the "WSU" letters.
To see the real effects on the image of the letters (WSU), MATLAB has a good option for converting matrices to images.In other words, we can use the command imwrite(matrix) to convert those alphabetical matrices to a real image, and we can see how far we affected those letters.Figure 8 shows the results as images.

Grayscale Images
Blurring and sharpening black and white images both are considered ways of enhancing images.For example, Blurring is a very affective and nice way to smooth the image and get rid of the noise on the image.However, we do not want to blur the edges of the image.Therefore, sharpening images plays and important role here to control those grayscale images and has many uses in many fields.For example, in medical imaging as shown in Figure 9 sharpening images may help define some semi-hidden shapes and objects.Moreover, it can give a better spectacle for some object such as a relief in a painting or details of buildings in Google maps…etc.Figure 10 shows how sharpening images affects the sight of the moon by taking Alpha = dt/dx 2 = dt/dy 2 = 1 in the negative time steps to have a good sharpening, and the intensity = 1.5 to bright the image by more than 20%.newu (i,j) = 1.5 * u (i,j) − 1 * (u (i−1,j) − 2u (i,j) + u (i+1,j) ) − 1 * (u (i,j−1) − 2u (i,j) + u (i,j+1) ) Fig. 10 -Sharpening grayscale Images with 1.5 intensity.

Colorful Images
To work on color images, we have to deal with three matrices for every image.The reason behind that is the color images are decomposed into three colors, red, green, and blue (RGB).Therefore, we will have a matrix of size of (m × n × 3).In Matlab, we need to run the diffusion on each of the 3 RGB bands, so we will deal with the red color by dealing with the matrix (: , : ,1), and (: , : ,2) for the green color, and finally (: , : ,3) for the blue color.However, sharpening color images is not always a good way to enhance images in comparison with grayscale images.In fact, it converts images into cartoons or comic images if you will.Figure 11 shows the results of sharpening and blurring a color image.

Images From Physical Laboratory
We apply here the blurring and sharpening techniques on some images that were carried out in a physical laboratory in some experiments.In fact, one can deal with these images in the same way of dealing with colorful images in the previous subsection by dealing with the matrix (: , : ,1), and (: , : ,2) for the green color, and finally (: , : ,3) for the blue color.On the contrary, of the colorful images, sharpening the images that we obtained from some physics experiments was better than the previous mentioned images.Figure 12 is showing the comparison of the three images "a, b, and c" from left to right, the original, blurred, and sharpened images, respectively .In addition, blurring color images has the same process of the grayscale image, but we need to apply the forward time steps on every layer of the three colors of RGB.After applying the forward time steps on the reed, green, and blue layer, we combine the blurred layer together again, and not surprisingly the result will be a blurred color image without any other effects.Moving to the sharpening technique, the result of sharpening is not the same of the grayscale images.However, backward time steps can convert the color images to cartoons, or comic images.Therefore, sharpening color image is not always considered a way of enhancing images.The reason behind that is the way of sharpening any object in an image will be applied three times because of the RGB colors.Figure 13 shows how the color image is decomposed into three layers.

Conclusion
In conclusion, sharpening and blurring techniques can be done by using the Heat Equation.We can blur images by applying the forward time steps in the discretization of the heat equation to get rid of some undesired details in an image, or just to reduce the distinction of the image.On the other hand, sharpening images can be done by applying the backward time steps in the discretization of the heat equation to get a better view for the grayscale images, and to increase the brightness of the edges of every object in the image.

Fig. 1 -
Fig. 1 -A normal CT scan of a brain.

Fig. 8 -
Fig. 8 -The real effects on the image of the letters "WSU".