Filtering of impulse noise in digital signals using ... - Semantic Scholar

Report 5 Downloads 58 Views
Filtering of impulse noise in digital signals using logical transform Ethan E. Danahy*a, Sos S. Agaian**b, Karen A. Panetta***a a Dept. of Electrical and Computer Eng., Tufts Univ., 161 College Ave., Medford, MA, USA 02155; b Dept. of Electrical Eng., Univ. of Texas/San Antonio, 6900 N. Loop, San Antonio, TX, USA 78249 ABSTRACT Median filters excel at removing impulse noise from digital signals, with high accuracy and quick running-times. However, they have limitations if the resulting signals are to be used for feature recognition purposes, as they often remove crucial details and add unwanted noise. In this paper, an algorithm for digital filtering using the logical transform is proposed. This method is able to achieve mean-squared-error results similar to median type filters while maintaining image details. Variations of the algorithm allow for greater noise reduction, but at the cost of increased computation. Keywords: impulse noise, digital filtering, Histogram of Primary Implicants, Boolean Minimization, logical transform 1.

INTRODUCTION

Digital signals can be corrupted by impulse noise (i.e. salt and pepper noise) in a variety of ways, from errors in collection sensors to noisy transmission channels to faulty storage devices. The industry standard for eliminating impulse noise is median type filters1,2,3,4, which combine good filtering capabilities with fast computation. Further, these are flexible through variation of the window size, allowing user adaptability depending on input signal characteristics. However, there are also some limitations. Median type filters “tend to modify both noise pixels and undisturbed good pixels.”5 Further, “the median filter is far from being a perfect filtering method since it may remove fine details, sharp corners, and thin lines. The main reason is that the ordering process destroys any structural and spatial neighborhood information.”6 Neither of these is acceptable if post-filtering the data is to be processed for feature recognition.

Figure 1: Original heartbeat signal.

For example, consider the one-dimensional heartbeat signal show in Fig. 1. The addition of salt and pepper impulse noise to this original signal results in the noisy data shown in Fig. 2 (top left). The difference graph, between the noisy signal and the original, clearly indicates the locations of the noise as distinct peaks (top right). Filtering this corrupted signal with a median filter (of size 3, described in Section 5) produces the output shown in the bottom left of Fig. 2. While a large portion of the impulse noise has been removed from the signal, viewing the difference graph indicates additional noise introduced throughout the signal due to the smoothing of details.

Figure 2: Original heartbeat plus 4% salt and pepper noise (top) filtered with median filter size 3 (bottom)

This paper introduces an alternative designed to solve this weakness of median type filters, by filtering locations of impulse noise without adversely affecting other portions on the signal. The proposed algorithm is able to achieve similar mean-square-error results, while being computationally fast. Variations of the original procedure are possible, which are able to remove greater amounts of noise, although at the cost of additional complexity. The paper is organized as follows. Section 2 provides necessary background on the logical transform and bit plane decomposition, as well as introduces the Histogram of Primary Implicants. Section 3 describes the algorithm, as well as provides some alternate versions. Section 4 demonstrates the filtering capabilities with experimental results performed on one-dimensional (medical heartbeat) and two-dimensional (images) digital signals. Finally, Section 5 gives some conclusions.

2. BACKGROUND 2.1 The logical transform Often, when dealing with Boolean functions, the sum of primary implicants form is desired. This form can be achieved using Karnaugh maps or the Quine-McClusky algorithm7, although both of these can be computationally intense. A better way is through the use of a logical (binary) transform-based Boolean minimization algorithm (referred to here as the logical transform). This operation is able to quickly identify the set of primary implicants representing an input function. Further, it is much more scalable compared to the other techniques, and thus easily able to handle functions with a large number of input variables. 2.1.1 Forward transform The logical transform8,9 is defined by the following equation

>

^

@`

y G 1 B nG 0 A Tn G 0 f

(1)

where the 1D input vector f is the truth table representation of a Boolean function and y is the outputted representation of the summation of primary implicants. įp is the Kronecker Delta function which accepts and returns a 1D vector where pvalued elements are set to 1 and all others to 0. The matrices A and B are defined as follows:

A Tn

ª1 0º «0 1 » » « «¬1 1»¼

…n

,

Bn

ª1 0 1º «0 1 1» » « «¬0 0 1»¼

…n

(2),(3)

The output y will be a 1D vector (greater in length than the input due to the asymmetric nature of the AnT matrix) whose one-valued elements (yt = 1, where yt is the tth element of y) each represent a term in the summation of primary implicants. To determine the structure of individual terms, each digit ti of the base-3 representation of the index t is considered:

ti if t i ti

xi 0 1 , then xi is included in this term. 2 1

(4)

A value of “1” in the term indicates a don’t-care condition for that variable, and is often omitted from the written representation. Consider the following example to demonstrate this process. For input vector f

f x1 , x 2 , x3

>1

1 1 1 0 0 1 0@

T

(5)

the one-valued indices of the resulting y-vector are 8 (“022” in base-3) and 21 (“210” in base-3), which means the summation of primary implicant representation of f is

f x1 , x 2 , x3

x1  x 2 x3

(6)

For this result, there are three total don’t-cares, two in the first term, and one in the second. 2.1.2 Implicant expansion (logical transform inverse operation) The inverse operation is a simple expansion of the implicants found in the resulting y-vector. Each element fm of the original function can be found with the following equation (f is a binary function, so all resulting positive elements represent the value 1):

fm

3n 1

n 1

t 0

i 0

>

@

¦ y t – G mi y ti  G 2 y ti

(7)

where mi is the ith digit of the base-2 representation of the index m. 2.2 Bit plane decomposition Working with grayscale images, bit plane decomposition10,11,12 is used to break the 8-bit grayscale images into a series of binary signal (Fig. 3).

Figure 3: Decomposition of Lena image into bit planes

The logical transform accepts a 1D vector as input, so when dealing with 2D signals (such as images) it is necessary to use a scanning technique for manipulating the data. An example showing a possible scanning pattern for making this transition is shown in Fig. 4, and includes a gray-code rearranging of the values to keep the ordering analogous with those in a Karnaugh map representation.7

Figure 4: Scanning 2D blocks (left) into 1D vector as input into logical transform (middle); the Karnaugh map representation (right).

2.3 Histogram of Primary Implicants The sum of primary implicants for a Boolean function is a representation where largest possible groups of values are arranged together.7 Several examples for 2D binary blocks (size 4x4) can be found in Fig 5. The sum of primary implicants representation for each, the number of terms in each sum, and the number of total don’t-cares are included.

Figure 5: Example 4x4 blocks and the associated sum of primary implicants

To determine how the primary implicants can be used for filtering of noise, the Histogram of Primary Implicants is introduced. This histogram presents a graphical representation of the composition of blocks by performing a count of the number of primary implicants in each block throughout the image. A running total is kept, and the sum plotted for values ranging from 0 terms up to 8 terms (the maximum for a block size of 16). From these graphs (for the entire image, as well as individual bit planes) it is possible to make inferences about the role of primary implicants under the presence of impulse noise.

3. FILTERING ALGORITHM 3.1 General form Using the information gained from the Histrogram of Primary Implicants, the terms most likely responsible for noise have been identified. Thus, through primary implicant elimination it becomes possible to reduce the impulse noise.

Figure 6: Generalized form of the filtering algorithm

Fig. 6 demonstrates the generic form of the algorithm. A preprocessing step breaks the original signal into blocks, mapping the data to a 1D vector if necessary. The logical transform is performed, resulting in a summation of primary implicants that are then thresholded. After the expansion back into a Boolean function the blocks are scanned back into the original image. Experimentation discovered that inverting values in the lower bit planes at locations where noise was detected improved results. This step, termed “Inversion Error Correction” (IEC), also occurs during post-processing. 3.2 Algorithm variations There are several possible variations of the algorithm, that all have the potential of producing even lower mean-squarederror results. However, these require additional computation, which increase the overall complexity of the algorithm. For example, adjusting the strength of the thresholding during a multi-pass algorithm would allow customization depending on previous results. Also, due to the use of non-overlapping windows, issues with not detecting noise on the edges of the blocks could be reduced by incorporating a shifting step into the multi-pass modification. Another possibility explored here is combining the output of the filtering process with that of the median filter. The median filter reduces the noise spikes but allows for additional noise throughout the signal, while the method presented here leaves non-noisy areas unaffected. Therefore, a combination of the two results would have the benefits of both. After filtering, the images are recombined together with the following formula, which is performed on every data point in the signals:

X new

ª X1 XN º « 2  ...  2 » VN ¼ ¬V 1 1 1  ...  2 2

V1

(8)

VN

where ıi is the standard deviation of the image Xi.

4. RESULTS The results presented are in comparison to a median type filter. A median filter uses a sliding window and replaces each data point in the signal with the statistical median of the original values that lie within the window.3 In 1D, if the original data X and sorted data Y surrounding the data point x0 were defined as follows:

Original data : X x-k , ... , x0 , ... , xk Sorted data : Y Y0 , ... , Yk , ... , YN 2 k 1

min (X) , ... , max (X)

(9)

Then the new value of x0 after being filtered would be the middle value in the sorted data set:

x0

Yk

(10)

All median filter results in this paper use a window size of 3 (k=1, N=2k+1=3). The 1D heartbeat signals are 512 data points long, and the images are 128x128 pixels large. The primary implicant threshold algorithm uses a window size of 16 (1x16 data points for 1D signals and 4x4 pixels for the 2D images). The Salt and Pepper Impulse Noise was varied from 2% to 6%, and results from the extreme cases are included here. Fig. 7 shows an original heartbeat signal plus the signal with an addition of 2% salt and pepper noise. This noise, after being filtered by the median filter, is reduced down to a mean-square-error (MSE) of 11.0. The difference graph to the right shows a major reduction in the noise spikes, but as stated previously, there is an addition of new noise throughout the signal due to the smoothing effect of the median filter. The plot in the bottom left of Fig. 7 show the filtering of the same noisy signal using the algorithm presented here, whose difference graph (bottom right) demonstrates that the process was able to reduce the noise without introducing additional error elsewhere in the signal. This means the edge

details from the original signal were maintained. This is most clear when comparing the heartbeat peaks: those found in the final graph more closely match the original, while the ones filtered by the median filter have been reduced.

Figure 7: Heartbeat signal, with % salt and pepper noise, filtered by both the median filter and by the algorithm presented here. Difference graphs for each (compared to original) are shown on the right.

Fig. 8 shows the same procedure, but with 6% salt and pepper noise and a different original heartbeat signal. This time, by comparing MSE values, the proposed filtering method achieved better results, and was able to do so without the introduction of additional noise through the signal.

Figure 8: Second heartbeat signal, with 6% salt and pepper noise, filtered by both the median filter and by the algorithm presented here. Difference graphs for each (compared to original) are shown on the right.

Moving to 2D, salt and pepper noise was added to images in varying amounts. Again the filtering procedure was performed as described, and results compared with that of the median filters (in 2D, with window size of 3x3). The difference graphs in 2D are not as easy to visually interpret as 1D, however similar trends are present. An image with 2% impulse noise can be seen in Fig. 9.

Figure 9: Filtered results of Lena with 2% salt and pepper noise, including difference graphs

Fig. 10 shows the same procedure, but with the addition of 6% Salt and Pepper Noise.

Figure 10: Filtered results of Lena with 6% salt and pepper noise, including difference graphs

As a variation to the original algorithm, the concept of combining the results obtained by this procedure with those achieved by the median filter was investigated. As an example, Fig. 11 shows the resulting heartbeat signal (and difference graph) when the filtering results from Fig. 7 are merged. Here there was a drop in MSE down to 7.2, which is better than both values from before.

Figure 11: Results of regular threshold filtering combined with median type filtering (left) and difference graph (right)

Again, extending this to 2D results in similar improvements. Fig. 12 shows two examples (2% noise and 6% noise). Comparing the difference graphs to those from before (Fig. 9, 10 respectively) shows decreased error, and the MSE values are now lower in both cases.

Figure 12: Combining results in 2D: Lena image with 2% (left) and 6% (right) salt and pepper noise

In fact, for the Lena image, it was found that for all levels of noise tested the resulting combined image had a lower mean squared error compared to that of filtering by just the median type filter. Fig. 13 shows a graph demonstrating how for every level of noise (with two variations at each) between 2% and 6% the MSE was lower for the combined algorithms than just for the median filter alone.

Figure 13: MSE improvements for filtering the Lena image when using combined algorithms compared to the median filter by itself

5. CONCLUSION Presented here is a new filtering algorithm for digital impulse noise in 1D and 2D signals. The generic form is able to detect and eliminate a large portion of the salt and pepper noise without adversely affecting other portions of the image. This is useful when, post-filtering, the output is to be additionally used for feature recognition. The median filter, on the other hand, while sometimes attaining better mean-squared-error values, introduces additional noise throughout the image through the smoothing of edge information. The algorithm introduced has a variable threshold parameter, which can be adjusted during the filtering process. This allows the method to be customized depending on the input signal, and adaptable to the situation. Finally, variations were defined with the goal of achieving greater noise reduction, although at the cost of additional computation. One of these, achieved by mathematically combining the outputs of the generic form with that of median type filters, is able to remove the largest amount of impulse noise of any results presented here.

ACKNOWLEDGEMENTS This research is supported in part by the NSF Award #0306464, by the Center for Infrastructure Assurance and Security, and by the US Air Force Information Warfare Center.

REFERENCES 1. 2.

D. Brownrigg. “The weighted median filter,” Communications of the ACM, Vol. 27, No. 8, Aug 1984 S. Ko and Y. Lee. “Center Weighted Median Filters and Their Applications to Image Enhancement,” IEEE Transactions on Circuits and Systems, Vol. 38, No. 9, Sept 1991.

3.

G. Arce and J. Paredes. “Image enhancement and analysis with weighted medians, “ in Nonlinear Image Processing, S. Mitra and G. Sicuranza, Eds. Academic, New York. 2000. 4. I. Shmulevich and G. Arce. “Spectral Design of Weighted Median Filters Admitting Negative Weights,” IEEE Signal Processing Letters, Vol. 8, No. 12, Dec 2001. 5. Z. Wang and D. Zhang. “Progressive Switching Median Filter for the Removal of Impulse Noise from Highly Corrupted Images,” IEEE Transactions on Circuits and Systems II: Analog and Digital Signal Processing, Vol. 46, No. 1, Jan 1999. 6. A. Hamza, P. Luque-Escamilla, J. Martinez-Aroza, and R. Roman-Roldan. “Removing Noise and Preserving Details with Relaxed Median Filters,” Journal of Mathematical Imaging and Vision 11, 161-177, 1999. 7. J. Wakerly, Digital Design: Principles and Practices, 3rd ed., Prentice Hall, New Jersey, 2001. 8. S. Agaian, J. Astola, and K. Egiazarian. Binary Polynomial Transforms and Nonlinear Digital Filters, Marcel Dekker, Inc., New York, 1995. 9. S. Agaian, T. Baran and K. Panetta. “The Application of Logical Transforms to Lossless Image Compression Using Boolean Minimization,” Proceedings, GSPx and ISPC, 13-31 March 2003. 10. J. Schwartz and R. Barker, “Bit-Plane Encoding: A Technique for Source Encoding”, IEEE Transactions on Aerospace and Electronics Systems, July 1966. 11. E. Kawaguchi and S. Kamata. “Data Reductive Image Coding By Bit-Plane Modifications,” Proceedings, IEEE 10th International Conference on Pattern Recognition, 16-21 June 1990. 12. T. Loncar-Turukalo, V. Crnojevic and Z. Trpovski. “Image Compression by Decomposition into Bit Planes,” Proceedings, TELSIKS 2001, 19-21 Sept. 2001. *[email protected]; phone 1 617 627-3217; fax 1 617 627-3220 **[email protected]; phone 1 210 458-5939; fax 1 210 458-5589 ***[email protected]; phone 1 617 627-3217; fax 1 617 627-3320