- Research Article
- Open Access
- Published:

# An Interactive Procedure to Preserve the Desired Edges during the Image Processing of Noise Reduction

*EURASIP Journal on Advances in Signal Processing*
**volume 2010**, Article number: 923748 (2010)

## Abstract

The paper propose a new procedure including four stages in order to preserve the desired edges during the image processing of noise reduction. A denoised image can be obtained from a noisy image at the first stage of the procedure. At the second stage, an edge map can be obtained by the Canny edge detector to find the edges of the object contours. Manual modification of an edge map at the third stage is optional to capture all the desired edges of the object contours. At the final stage, a new method called Edge Preserved Inhomogeneous Diffusion Equation (EPIDE) is used to smooth the noisy images or the previously denoised image at the first stage for achieving the edge preservation. The Optical Character Recognition (OCR) results in the experiments show that the proposed procedure has the best recognition result because of the capability of edge preservation.

## 1. Introduction

Digital images are noisy due to environmental disturbances. To ensure image quality, image processing of noise reduction is a very important step before analysis or using images. Optical Character Recognition (OCR) system is an example that is very sensitive to noise. The quality of documents influences the results of recognition. Image noise decreases the accuracy of the recognition of documentations by OCR (optical character recognition) software because of blurred edges. Great damage will be caused in defense and security applications when OCR software is used for the scanning and recognition of documents such as passports and ID cards in busy airports where speed and accuracy are critical for processing thousands of documents daily. The most important image processing technique for noise reduction is the image denoising method. The purpose of image denoising method is to increase signal-to-noise ratio (SNR) in an image. However noise reduction always induces blurred edges by an image denoising process. Development for edge-preserved image denoising method is necessary for OCR software. The paper is to develop a denoising procedure with the edge preservation capability. The OCR system is a research field in pattern recognition [1, 2] and is used to convert papers, books, and documents into electronic files [3]. Researchers developed several methods in order to remove these image noise including Gaussian noise, salt and pepper noise [4]. There are some image filters, which are used for image denoising [5, 6] and the Gaussian filter is a well-known one [7]. In the period between 1984 and 1987, Koenderink and Hummel showed how Gaussian filters removed noise that was equal to dispersion effects of the isotropic diffusion equation, so Gaussian filters are called Diffusion Filters.

Isotropic diffusion equations can reduce noise but blur the contours of images. In order to improve on this drawback, Perona and Malik improved the diffusion coefficient of isotropic diffusion filters to produce anisotropic diffusion filters (ADFs) with a function of image gradients in the 1990 [8]. The coefficients of isotropic diffusion equations are constants, but the diffusion coefficients of anisotropic diffusion equation decrease as image gradients increase. Anisotropic diffusion equations are more effective in edge preservation. Because the gradients of noises are larger, then the coefficients of anisotropic diffusion filters are smaller. This solution cannot solve the problem very well. Researches [9, 10] are continuously focusing on improving the diffusion coefficients. However, these methods may remove image noise, but edges cannot be preserved.

In this paper, we propose a new procedure including four stages. At the first stage of the procedure, any kind of denoising algorithm can be applied on an original noisy image to get a well-denoised image. At the second stage, an edge map can be obtained to find the edges of the object contours by the Canny edge detector applied on the previously denoised image at the first stage. Since the contour edges are not found completely, then the users maybe need interactively modify the edge map to keep the edges of the desired object contours. At the third stage, manually modify the edges of edge map to match the desired edges. At the final stage, a new method Edge Preserved Inhomogeneous Diffusion Equation is used to smooth the original noisy image or the previously denoised image at the first stage and achieve preserving desired edge. The proposed procedure has the edge preservation capability that makes OCR results the best in this experiment.

## 2. Mathematic Formulation

Section 2.1 introduces the digital image as a matrix, and one row can be considered as a signal. Section 2.2 introduces how to find the solutions of a one-dimensional inhomogeneous diffusion equation by using Fourier series. Section 2.3 proposed a flow chart of the EPIDE denoising method.

### 2.1. Digital Images and Signals

We defined a grayscale digital image as a function . The value of the function is an image intensity that is between 0 and 255. For a gray image, the function has grayscale values of image pixels. The coordinates are locations of the pixels in an image. The grayscale values of the row of are denoted by which can be considered as a one-dimensional signal with length . For example, the red line as shown in Figure 1(a) is the row of the image. As shown in Figure 1(b), the grayscale values profile is composed of two Box functions.

#### 2.1.1. One-Dimensional Signals

One-dimensional signals can be considered as piecewise constant functions, Heaviside function is suitable to discrete piecewise constant functions [11]. Heaviside function is defined as:

The Heaviside function is discontinuous at , and the value is usually defined by at . If the Heaviside function is shifted , then Heaviside function is . Box Function can be represented by Heaviside function as . The Box function can be represented as follows:

As shown in Figure 1(b), the row of is and the profile of the row is represented by two Box functions as in the following equation:

One signal can be superimposed by two signals. Figure 2 shows how to use two box functions to superimpose the signal in Figure 1(b).

If there are Box functions in the row of , the profile of can be represented as follows:

The letter is the left-location value of the Box Function and is value of the right location of the Box Function. The letter denotes the total number of Box functions and the symbol are coefficient constants.

#### 2.1.2. Fourier Series of Box Function

According to (4), the function as one signal can be represented by summation of the finite Box functions. If is an integrable function on , then can approximate the continuous Fourier series [12] as follows:

where the coefficients are represented by and equations.

For example as shown in Figure 3, the grayscale value of the row of Figure 1(a) is shown in Figure 3(a). Figure 3(b) shows a profile to approximate signal of Figure 3(a) by using Fourier series with 300 terms. Figure 3(c) shows defused result at where the variable will be explained in Section 2.2.1.

### 2.2. One-Dimensional Inhomogeneous Diffusion Equation

We want to solve the problem of finding the intensity of every row in an image. At both sides of the interval , the intensity values are set to be zero. By adding the inhomogeneous terms into the diffusion equation with the derivative of Delta functions, the proposed denoising method is called the Edge Preserved Inhomogeneous Diffusion Equation (EPIDE) method.

#### 2.2.1. Diffusion Equation Formulation

Consider the inhomogeneous differential equation [13] as follows:

where the variables are spatial coordinates and is time, but the temperature now is replaced by the intensity in an image that is function of the position and time , and is a constant called the "thermal diffusivity" of the material. The function is an inhomogeneous term that will be explained in (7).

The function is used to have the effect of preserving edges and can be obtained from derivative of the right side of (4):

The function is a Dipole distribution and is derivative of the Delta (or impulse) function .

The relation of the Delta function and step function is as follows:

where step function can be approximated by , and , .

The and functions are shown in Figures 4(a) and 4(b).

The Delta function is a generalized function, the properties of the Delta function are as follows [14]:

where , , and are constants.

Let (7) be into (6):

Equation (10) is an inhomogeneous diffusion equation used to preserve the edges. In (4), (7), and (10), the locations of edges and can be decided by the location of edge pixels in the signal that is one row in an image. Since in the edge locations it is not easy to obtain a noisy image, some images preprocessing techniques and Canny Edge detection method [15] are used to find the edge map of the object contours. The locations and are decided by the edge map. Modifying the edge map, the user can decide to keep the contours for their requirements.

#### 2.2.2. Fourier Series Solutions

According to (6), the function can be represented by Fourier series [12] as follows:

The solution can be solved by the Fourier series and the initial condition is represented as follows:

where is the length of the signal. The solution and the function can be expanded by Fourier sine series:

where the coefficients are determined by the function and the coefficients can be decided by substituting (13) into (11):

Comparing coefficients of on both sides yields

Equation (15) can easily be solved to obtain :

Then solution is obtained by substituting this formula for into (13).

### 2.3. Proposed Procedure

The goal of the proposed procedure with four stages is to preserve the desired edges during the image processing of noise reduction, so EPIDE method plays an important role. However, the edges of object contours in an image should be extracted previously for EPIDE method. Canny edge detector can automatically find some edges in images. Since the contour edges are not all found, then the users want to interactively modify the edges capture all desired object contours.

In the first stage of the procedure, any kind of denoising algorithm can be applied on an original noisy image to obtain a denoised image. In the second stage, an edge map can be obtained to find the edges of the object contours by the Canny edge detector applied on the previously denoised image at the first stage. Since the contour edges are not found completely, then the users may be need to interactively modify the edge map to keep the edges of the desired object contours. At the third stage, users can manually modify the edges of edge map to match the desired edges. At the final stage, Edge Preserved Inhomogeneous Diffusion Equation (EPIDE) method is used to smooth the original noisy image or the previously denoised image at the first stage and achieve preserving desired edge. Two flow charts of the proposed procedure are shown in Figures 5 and 6.

Figure 5 shows the flow chart of the three stages. At the first stage, any kind of denoising algorithm can be applied on a noisy image (N) to get a previously denoised image (P). At the second stage, an edge map (E) can be obtained to find the edges of the object contours by the Canny edge detector applied on the previously denoised image at the first stage. At the third stage, modified edge map (I) captures all the desired edges manually. The flow chart to get a denoised image at the final stage with EPIDE method is shown in Figure 6.

At the final stage, the EPIDE method is used to smooth the noisy image (N) or the previously denoised image (P) with the modified edge map (I). Both in -direction and -direction, two images and are generated by the EPIDE method. Finally a denoised image (D) can be obtained by an average combination of the image and .

## 3. Experimental Results

There are four test images "Nine Square Regions", "Number and Character", "Chinese Words", and "BarCode" corrupted by Gaussian noise with zero mean.

### 3.1. The Peak Signal-to-Noise Ratio (PSNR)

The performance measure by using the peak signal-to-noise ratio is defined as follows:

where RMSE is Root Mean Square Error, and it is defined as follows:

The functions and are original and denoised image, respectively. The numbers and are the size of an image.

### 3.2. Results and Discussions

Section 3.2.1 shows the denoised results of noise reduction test. Section 3.2.2 compares the denoised results of the proposed procedure with those of wavelet and ADF denoising methods. Section 3.2.3 describes the third stage in the proposed procedure. Section 3.2.4 shows the OCR application by the proposed procedure.

#### 3.2.1. Noise Reduction Test

The experiments tested the synthetic image "Nine Square Regions" with Gaussian noise, Salt-and-Pepper noise, and Poisson noise, the result are shown in Figure 7.

The test image "Nine Square Regions" is a synthetic image shown in Figure 7(a). Figure 7(b) is the test image corrupted by adding Gaussian noise with variance 0.01. Figure 7(d) is the test image corrupted by adding salt and pepper noise with the density 0.05. Figure 7(f) is the test image corrupted by adding Poisson noise. Figures 7(c), 7(e), and 7(g) are images denoised by proposed procedure to preserve edges.

#### 3.2.2. Comparison with Algorithms

In the experiments we have used the geometric images "Nine Square Regions", "Number and Character", "Chinese Words", and "BarCode" in order to demonstrate the edge preservation capability of the proposed procedure. Corresponding to three denoising methods, the values PSNR of all the denoised images are given in Table 1. These results of PSNR are 28.495, 22.495, 20.769, and 28.021 for four test images "Nine Square Regions", "Number and Character", "Chinese Words" and "BarCode" by the proposed procedure. The PSNR values of the proposed procedure are larger than those of the wavelet and ADF denoising method. The proposed procedure has better denoising capability.

The test image "Nine Square Regions" is a synthetic image shown in Figure 8(a). Figure 8(b) is the test image corrupted by adding Gaussian noise with variance 0.01. Figure 8(c) is the denoised image by wavelet denoising method. Figure 8(d) is the denoised image by ADF denoising method. Figure 8(e) is the denoised image by the proposed procedure. From the visual evaluation of images (c), (d), and (e), the proposed procedure has the best edge preservation.

The test image "Number and Character" as shown in Figure 9(a) is an image captured by camera from a car license plate. Figure 9(b) is the test image corrupted by adding Gaussian noise with a variance of 0.01. Figure 9(c) is the denoised image by wavelet denoising method. Figure 9(d) is the denoised image by ADF denoising method. Figure 9(e) is the denoised image by the proposed procedure. From the visual evaluation of images (c), (d), and (e), the proposed procedure has the best edge preservation.

The test image "Chinese Words" is an image with four Chinese characters as shown in Figure 10(a). Figure 10(b) is the test image corrupted by adding Gaussian noise with a variance of 0.05. Figure 10(c) is the denoised image by wavelet denoising method. Figure 10(d) is the denoised image by ADF denoising method. Figure 10(e) is the denoised image by the proposed procedure. From the visual evaluation of images (c), (d), and (e), the proposed procedure has the best edge preservation.

The test image "BarCode" is an image without noise as shown in Figure 11(a). Figure 11(b) is the test image corrupted by adding Gaussian noise with variance 0.05. Figure 11(c) is the denoised image by wavelet denoising method. Figure 11(d) is the denoised image by ADF denoising method. Figure 11(e) is the denoised image by the proposed procedure. From the visual evaluationof images (c), (d), and (e), the proposed procedure has the best edge preservation.

#### 3.2.3. Interactively Modified Edge Map

The edge-preserved performance of the EPIDE method depends on the edge detection. A noisy image is difficult to find all edges by Canny edge detector because of the noise interference. However, Canny edge detector has the same function as the Gaussian filter, but it is better to use any kind of denoising algorithm in the first stage of proposed algorithm. The following experiment is used to show how to modify the edge map by Canny edge detector and the results of denoised image by EPIDE method. Figure 12(a) is a synthetic image and Figure 12(b) is the noisy image with Gaussian noise with . Figure 12(c) is an edge map obtained by Canny edge detector applied on Figure 12(b). Figure 12(d) is the denoised image by EPIDE method applied on Figure 12(b) with the edge map in Figure 12(c). Figure 12(e) is a denoised image by neighborhood filters applied on Figures 12(b) and 12(f) is an edge map by Canny edge detector applied on Figure 12(e). Figure 12(g) is a manually modified edge from the edge map of Figure 12(f). Figure 12(h) is the denoised image by EPIDE method with the edge map in Figure 12(g) applied on image in Figure 12(e), but Figure 12(i) is the denoised image by EPIDE method with the same edge map applied on image in Figure 12(b). By the visual evaluations, Figure 12(i) is better than Figure 12(h). From Table 2, the PSNR values of image of Figure 12(i) is higher than Figure 12(h). The first stage of proposed procedure can be an option for different images denoising cases.

#### 3.2.4. The Proposed Procedure Applications

Now, the experiment is to demonstrate that the denoised images with a good edge-preserved can have better OCR result. The noise image is corrupted with Gaussian noise with variance of 0.08 as shown in Figure 12(a). In Figure 13, the left column the denoised image by Figures 13(c) wavelet 13(e) ADF 13(g) EPIDE method right column 13(b), 13(d), 13(f) and 13(h) are OCR results. Figure 13(a) is an image with Gaussian noise and it's variance is 0.08. The denoised images are shown in Figures 13(c), 13(e) and 13(g) and they are denoised by wavelet, ADF and EPIDE methods. Figures 13(b), 13(d), 13(f) and 13(h) are OCR results of images in the left column. To evaluate the denoising performance of wavelet, ADF and EPIDE methods, it is suitable to use the character recognition software JOCR [16] to obtain the words in noised and denoised images. The experimental results show that the image denoised by EPIDE can have the best recognition results in Figure 13(h). All the characters in two sentences "I Love You" and "Please Give Me Your Favor" are correctly recognized in the image denoised by EPIDE method. There are some errors for character recognition are in Figures 13(b), 13(d) and 13(f). These results are obtained by JOCR software on the noisy and denoised images by wavelet and ADF methods.

The results of the above experiments demonstrate the effective of our proposed denoising procedure. In next section, theoretical explanations are described to show why the proposed denoising procedure works well for any kind of noise.

#### 3.2.5. The Denoising Capability of the Diffusion Equation

There are many types of image noise, such as Gaussian noise, Salt-and-pepper noise, Shot noise and Uniform noise. Noises are randomly distributed in image intensity value. At different pixels, the intensity values are independent of one another. For example, Gaussian noise, Shot noise and Uniform noise separately follow a Gaussian, Poisson, Fat-tail and Uniform distribution. The row of of the image "Nine Square Regions" in Figure 7 with Gaussian noise, Salt and Pepper noise and Poisson noise has three profiles as in Figures 14(a), 14(c), and 14(e). The three profiles of the denoised image are shown in Figures 14(b), 14(d), and 14(f). Three profiles as in Figures 14(a), 14(c), and 14(e) are the initial conditions of the diffusion equation (6). Three profiles as in Figures 14(b), 14(d), and 14(f) are the steady-state solutions of the steady-state diffusion equation (19)

The image denoising results in Figures 14(b), 14(d), and 14(f) are consistent with the theoretical explanation of (19).

## 4. Conclusion

The contribution of the paper is to propose a procedure to smooth the noisy or denoised image with any kind of denoising algorithm for desired edge preservation. To achieve preservation of designed edges, the inhomogeneous terms of the diffusion equation are formulated by the derivative of the Delta function. Fourier series is used to obtain the exact solution of the diffusion equation. The exact solution is a function of time and its value is the intensity of each pixel in an image. The Delta functions in the diffusion equation are used to locate the positions of edge pixels for each object in the image. To locate contour pixels for each object, it is necessary to use some image preprocessing methods and an edge detection method to find the edges of the object contours. Since the contour edges are not all found, then the user can interactively modify the edge map to keep the desired object contours. The proposed denoising method with edge preservation capability has the best OCR result in the experiment compared to the results from the wavelet denoising method and anisotropic diffusion filters.

## References

- 1.
Weideman WE, Manry MT, Yau HC: A comparison of nearest neighbor classifier and a neural network for numeric handprint character recognition.

*Proceedings of the IEEE International Conference on Neural Networks, 1989, Washington, DC, USA* - 2.
Tappert CC: Recognition System for Run-on Handwritten Characters. US patent no. 4731857, International Business Machines Corporation, Armonk, NY, USA, March 1988

- 3.
Hahn S-H, Lee J-H, Kim J-H: A study on utilizing OCR technology in building text database.

*Proceedings of the 10th International Workshop on Database and Expert Systems Applications, 1999*582-586. - 4.
Gonzalez RC, Woods RE:

*Digital Image Processing*. Prentice-Hall, Upper Saddle River, NJ, USA; 2002. - 5.
Welk M, Weickert J: Semidiscrete and discrete well-posedness of shock filtering. In

*Mathematical Morphology*. Springer, Berlin, Germany; 2005. - 6.
Guillon S, Baylou P, Najim M, Keskes N: Adaptive nonlinear filters for 2D and 3D image enhancement.

*Signal Processing*1998, 67(3):237-254. 10.1016/S0165-1684(98)00042-5 - 7.
Yuan YB, Vorburger TV, Song JF II, Renegar TB: A simplified realization for the Gaussian filter in surface metrology. In

*Proceedings of the 10th International Colloquium on Surfaces, January-February 2000, Chemnitz, Germany*. Edited by: Dietzsch M, Trumpold H. Shaker; 133. - 8.
Perona P, Malik J: Scale-space and edge detection using anisotropic diffusion.

*IEEE Transactions on Pattern Analysis and Machine Intelligence*1990, 12(7):629-639. 10.1109/34.56205 - 9.
Weeratunga SK, Kamath C: A comparison of PDEbased non-linear anisotropic diffusion techniques for image denoising.

*Image Processing: Algorithms and Systems II, January 2003, Santa Clara, Calif, USA, Proceedings of SPIE* - 10.
Gerig G, Kubler O, Kikinis R, Jolesz FA: Nonlinear anisotropic filtering of MRI data.

*IEEE Transactions on Medical Imaging*1992, 11(2):221-232. 10.1109/42.141646 - 11.
Kanwal RP:

*Generalized Functions: Theory and Applications*. 3rd edition. Birkhäuser, Boston, Mass, USA; 2004. - 12.
Folland GB:

*Fourier Analysis and Its Applications*. Brooks/Cole, Pacific Grove, Calif, USA; 1992. - 13.
Sen M:

*Analytical Heat Transfer*. Department of Aerospace and Mechanical, Engineering University of Notre Dame, Notre Dame, Ind, USA; 2008. - 14.
Bracewell R:

*The Fourier Transform and Its Applications*. 2nd edition. McGraw-Hill, New York, NY, USA; 1986. - 15.
Canny J: A computational approach to edge detection.

*IEEE Transactions on Pattern Analysis and Machine Intelligence*1986, 8(6):679-698. - 16.

## Acknowledgment

The authors thank National Science Council (NSC) for partial financial support (NSC 97-2115-M-324-001) and (NSC 98-2115-M-324-001).

## Author information

### Affiliations

### Corresponding author

## Rights and permissions

**Open Access** This article is distributed under the terms of the Creative Commons Attribution 2.0 International License (https://creativecommons.org/licenses/by/2.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

## About this article

### Cite this article

Hsu, CY., Huang, HY. & Lee, LT. An Interactive Procedure to Preserve the Desired Edges during the Image Processing of Noise Reduction.
*EURASIP J. Adv. Signal Process.* **2010, **923748 (2010). https://doi.org/10.1155/2010/923748

Received:

Revised:

Accepted:

Published:

### Keywords

- Optical Character Recognition
- Denoised Image
- Chinese Word
- Denoising Method
- Canny Edge Detector