1 Introduction

In image processing, images are corrupted by noise, which is easily detectable and degrades the image quality. Image acquisition and transmission are the major source of noise in digital images. In the digital image acquisition process, the optical image is converted into a continuous electrical signal which is then sampled. It is the primary process by which noise appears in a digital image. Images are also affected by the imaging sensor as the performance of the imaging sensor is affected by various factors such as environmental conditions and by the quality of the sensing elements. They are also corrupted during transmission due to interference of noise in the channel used for transmission. For example, while using the wireless network for transmission, image might be corrupted as a result of lightning or other atmospheric disturbance [13]. Images can be degraded due to the addition of different types of noise in the original images and one of them is impulse noise. This noise occurs due to transmission error, malfunctioning of the pixel element in camera sensor, faulty memory locations, and timing errors during analog to digital conversion. Impulse noise generates pixels with gray values, which are not correlated with their local neighborhood. It appears as a sprinkle of both light and dark (or only light or only dark) spots in the image by replacing some pixel values with random values in the range 0 to 255 [26]. There are some other types of artifacts that are common in old films, video sequences, and images, for instance: blotches, scratches, streaks and stripes [1]. The film materials of old movies and images are often degraded by randomly located scratches and blotches. Old movies and images are often valuable historical records, but most of them degrade in visual quality during the years, decreasing their usefulness. These artifacts may appear due to damage to the film surface or due to dust covering a small area of the surface. Digitizing this kind of film material can result in an image that has patches with gray level values that are not correlated to the neighboring pixels. The main visual defect is dust, which gets attached to the film or causes abrasion of the thin emulsion layer. Generally two types of distortion can occur. The first one is scratches; it appears as a thin line of pixels of arbitrary shape with nearly equal gray level values. These are due to foreign bodies which have been in the camera or the projector. The second one is blotches; it is a block or a small coherent area with similar gray level values. Each pixel in scratches or blotches is a type of impulse noise distortion, but they are characterized by two properties. First, since they appear randomly in the image sequence, these distortions build a discontinuity. Second, these distortions are coherent areas with a similar or almost same gray level value [16]. In addition to these distortions there are some other artifacts that appear in digital images, for instance stripes. Stripes are a model of line interaction with the image and they are visible as narrow light and dark lines in the image. It is also sometimes called “line scratches” and it appears mostly in old motion pictures. Image streaks can be any sequence of pixels that have been replaced by a random value [3]. An image which has been contaminated by noise is called a degraded image and by using different filters we can restore such degraded images. To filter out the noise from a degraded image is called de-noising. Such a filter is an important subsystem of any signal processing system. For example, in most applications, de-noising the image is used as preprocessing for subsequent image processing operations such as edge detection, image segmentation, object recognition, etc. The main goal of filtering is to suppress the noise while preserving image details.

2 Related works

The corrupted pixel is the pixel which was being affected by any noise and now its value is far different from surrounding pixels. Noise reduction of the image is done by using two methods: linear techniques and nonlinear techniques. In linear techniques, a noise reduction algorithm is applied for each pixel of the image linearly without any knowledge of which pixels are corrupted or uncorrupted. The main drawback of linear techniques is that they damage noiseless pixels because it is applied for both noise and noiseless pixels. To overcome the drawbacks of linear techniques, nonlinear techniques were developed. In nonlinear techniques various filters have been proposed which work well for low noise density, but for high noise density, the performance of these techniques is poor. To improve the performance of filtering, a wide range of filters has been proposed. Some of them are Switching Median filter (SM) [21], Multi State Median Filter (MSM) [9], CWMF (Centre Weighted Median Filter) [22], Adaptive Centre weighted Median Filter (ACWM) [23], Signal Dependent Rank Order Mean (SD-ROM) [2], AMF (Adaptive Median Filter) [14], PSM (Progressive Switching Median Filter) [27], TSM (Tri-State Median Filter) [8], DBA (Decision Based Algorithm) [20], and SMF (Standard Median Filter) [18]. SMF is proposed as a reliable method to remove salt and pepper noise without damaging the edge details, but SMF is effective only for low noise density. When the noise density is greater than 50 %, the edge details of the image will not be preserved. To remove the drawbacks of this filter AMF was proposed. It removes the noise at high noise density, but by increasing the window size, it introduces the problem of causing blurring in the image. Switching Median filter [21] was proposed to detect and correct the corrupted pixels based on a predefined threshold value. This filter doesn’t take care of the local features as a result of which edges and details are not recovered satisfactorily for high noise density. For removal of high noise density impulse noise, Decision Based Filter was proposed, in which the corrupted pixels are replaced by the local median or by the neighboring pixels. But, due to the replacement by neighboring pixels a streaking effect occurs. To avoid this streaking effect in the image, at high noise density, a two stage cascade approach [5] was proposed. The first stage of the filter detects whether each pixel is corrupted or uncorrupted. If the pixel is corrupted then it is replaced by the median, else it is left unaltered. The second stage is the replacement of unsymmetrical trimmed midpoint, which may damage the fine details of the image. Another approach to removing the streaking that occurs in a DBA is Modified Decision Based Filtering (MDBF) [4]. The corrupted pixels are replaced by the median of the uncorrupted pixels in the selected window, but for high noise density (up to 80 %) MDBF does not preserve the edge details of the filter. Modified Decision Based Unsymmetric Trimmed Median Filter (MDBUTMF) [11] was proposed to remove the streaking and edge preservation problem. The corrupted pixels are replaced by the trimmed median output or by the mean of the selected window. At a very high noise density the filter smudges the edges of the images; to overcome this problem, Trimmed Global Mean Filter (TGM) [25] was proposed. Here, if the selected window contains both corrupted and uncorrupted pixels, then corrupted pixels are replaced by the median of the uncorrupted pixel in the selected window. On the other hand, if the selected window contains only corrupted pixels, then the processed pixel is replaced by the trimmed global mean. Many edge preserving regularization methods have been proposed to remove impulse noise using a non-linear data filtering with edge preserving regularization [17]. In order to increase the performance of this method to remove impulse noise, a two stage method was proposed [7] and [6]. The authors used AMF [14] or ACWMF [23] to identify the corrupted pixels, and to restore these corrupted pixels, the edge preserving method was used. It works on high noise density, but it is limited by the accuracy of the detector in the first phase. To identify the corrupted pixels in an image, a new statistic called ROAD (Rank Ordered Absolute Difference) [12] was proposed. This algorithm uses a bilateral filter to remove both impulse as well as Gaussian noise and the resulting filter are called a trilateral filter [24]. The ROAD value provides a measure of how closely the pixel is related to its four neighbors, but it produces a blurring problem for high noise density. To amplify the difference between the corrupted and uncorrupted pixels in ROAD, so that noise detection is more accurate, a statistic called ROLD (Rank ordered Logarithmic Difference) [28] was presented. It works in two stages, in the first stage it detects the noisy candidate pixels. In the second stage, it utilizes the edge preserving regularization method. This method removes random-valued impulse noise at noise density below 60 %, but it requires high computation time. To overcome the drawbacks in the above two methods a two stage decision based algorithm was introduced to remove random- valued impulse noise, scratches, and stripes [26]. It is also a two stage method, in the first stage, corrupted pixel is identified using a ROAD algorithm. In the second phase, to remove a noisy pixel, adaptive median filtering is applied. Due to the adaptive nature of the window, blurring occurs as filter size is incremented. It is an iterative process so it requires high processing time.

The above techniques work better for low noise density, but do not provide good and effective result for higher noise density. For high noise density, the images get blurred and edge details of original images are not preserved. To preserve edges and to give better PSNR, we are proposing a new algorithm, in which a ROAD algorithm is used to detect corrupted pixels and Trimmed Global Mean filter is used to process a corrupted pixel with a constant window size.

3 The proposed scheme

3.1 ROAD (rank ordered absolute difference)

We use a local image statistic called ROAD, proposed in [12]. Let x = (x1, x 2) be the pixel location under consideration and Ωx (N) be the set of points in a (2 N + 1)\ times (2 N + 1) neighborhood centered at x for some positive integer N. The set Ωx (N) is given by equation (1)

$$ {\varOmega}_x(N)=\left\{\ x+\left(i,\ j\right): - N\le \left(i,\ j\right)\le N\ \right\} $$
(1)

Let us consider N = 1. Let Ωx 0 represent the set of points in a 3\ times 3 detected neighborhood of ‘x’ given by equation (2)

$$ {\varOmega_{\mathrm{x}}}^0 = {\varOmega}_{\mathrm{x}}(1)/\left\{\mathrm{x}\right\} $$
(2)

For each point of y ϵ Ωx 0, define dx, y as the absolute difference in intensity of the pixel between x and y. The absolute difference is given by equation (3)

$$ {d}_{x,y}=\left|{u}_x-{u}_y\right| $$
(3)

Sort the dx, y values in increasing order and define the ROAD by using equation (4)

$$ {\mathrm{ROAD}}_{\mathrm{m}}\left(\mathrm{x}\right)={\displaystyle {\sum}_{i=1}^m{r}_{{}_i}}\ \left(\mathrm{x}\right) $$
(4)

Where 2 ≤ m ≤ 7

and ri(x) is the smallest dx, y for y ϵ Ωx 0

Let us consider N = 1 and m = 4. ROAD provides the information on how close the pixel value is to its 4 closest neighbors in a 3\ times 3 window. The logic behind using this statistic is that a corrupted pixel will vary greatly in intensity from most or all the neighboring pixels, so the ROAD value will be larger for uncorrupted pixels which belongs to actual image intensity. If half the neighboring pixels are of similar intensity, then ROAD value will be smaller. The ROAD value can be used to detect that whether or not a pixel is corrupted by impulse noise by setting a certain threshold value. If the ROAD value is greater than the threshold, the pixel is corrupted, otherwise it is not. It is suggested in [12] to use a 3\ times 3 window and m = 4 for noise density less than 25 % otherwise 5\ times 5 window and m = 12.

3.2 Trimmed global mean (TGM) filter

The algorithm starts with the detection of corrupted pixels. If a pixel P(i, j) is between 0 and 1, then the pixel is uncorrupted. However, if P(i, j) is 0 or 1 then it is considered to be a corrupted pixel. For such corrupted pixels, we select a window of $N\ times $N and remove all uncorrupted pixels from the selected window. Then the median of the remaining pixels is calculated and P(i, j) is replaced with the median value. If the selected window consists entirely of corrupted pixels, then P(i, j) is replaced by the trimmed global mean. The trimmed global mean is calculated by removing all of the corrupted pixels from the whole image and finding the mean of the remaining pixels. A flowchart of the trimmed global mean filter is shown in Fig. 1.

Fig. 1
figure 1

Flowchart of trimmed global mean filter

The algorithm works in two stages: the detection stage and the filtering stage.

Detection Stage: Let X be the noisy image of size $m\ times $n, X(i, j) be the gray level value at pixel location (i, j), and W be the detection window of size $w\ times $w centered at X(i, j), where W = N + 1 and initially N = 1. The pixels in the detection window W centered at X(i, j) are given by equation (5).

$$ \mathrm{W} = \mathrm{X}\left(\mathrm{i}+\mathrm{K},\ \mathrm{j}+\mathrm{I}\right)\kern0.75em -\mathrm{N}\le\ \mathrm{K},\ \mathrm{I}\le\ \mathrm{N} $$
(5)

The absolute difference of a pixel X(i, j) with the surrounding pixels in the selected window is given by D in equation (6).

$$ \mathrm{D} = \left\{\left|\mathrm{X}\left(\mathrm{i}+\mathrm{K},\ \mathrm{j}+\mathrm{I}\right)\ \hbox{--}\ \mathrm{X}\left(\mathrm{i},\ \mathrm{j}\right)\right|\right\}\kern0.5em -\mathrm{N}\le\ \mathrm{K},\ \mathrm{I}\le\ \mathrm{N} $$
(6)

The array D is sorted and the sum of the m smallest absolute differences is obtained and this defines the ROAD given by equation (7).

$$ {\mathrm{ROAD}}_{\mathrm{r}}=\sum\ \mathrm{D}\left(\mathrm{r}\right)\kern1em 2\le \mathrm{r}\le {\left(2\mathrm{N}+1\right)}^2-1 $$
(7)

The ROAD value obtained is compared with a predefined threshold value T. If the ROAD value is less than the threshold, then X (i, j) is an uncorrupted pixel otherwise it is a corrupted pixel. From this condition, we generate a binary image B in which, if X (i, j) is corrupted we put a 0, and otherwise a 1.

$$ B\left(i,\ j\right)=\left\{\begin{array}{c}\hfill 1\ For\ ROAD\left(i,\ j\right)<T\hfill \\ {}\hfill 0\ For\ ROAD\left(i,\ j\right)\ge T\hfill \end{array}\right. $$
(8)

Filtering Stage: The resulting image P is obtained by element-wise multiplication of the binary image B and the original noisy image X. The resultant image of size $m\ times $n and is denoted P and given by equation (9)

$$ P\left(i,j\right)=X\left(i,j\right)\times B\left(i,j\right) $$
(9)

Finally, the trimmed global mean filter is applied over P as shown in the flowchart in Fig. 1.

4 Results and discussions

In this section we present our results and prove the image restoration capability of the proposed algorithm. We implemented the algorithm in MATLAB R2010b and used TIFF images for experimentation. The machine used was a Core2Duo 1.66GHz with 3GB RAM. The performance of various state of the art methods is compared quantitatively by using peak signal to noise ratio (PSNR), which is given by equation (10)

$$ PSNR(dB)=10* log10\left(\left(255\times 255\right)/MSE\right) $$
(10)

Where MSE is the mean squared error between the denoised image (f) and the original image (g). MSE is given by equation (11)

$$ MSE=\frac{1}{p \times q}{\displaystyle {\sum}_{i=1}^p{\displaystyle {\sum}_{j=1}^q{\left(f\left(i,j\right)-g\left(i,j\right)\right)}^2}} $$
(11)

Where i and j are the rows and columns respectively. Their values are 1 < i < p and 1 < j < q.

In Table 1 we list the PSNR values for various filters for three images with different noise densities. In the proposed algorithm, the ROAD value is used to detect noisy pixels based on the concept that corrupted pixels will vary greatly in intensity of most of their neighboring pixels. It is done by assuming that the actual pixels of the image should have at least half of the intensity of their neighboring pixels. By varying the threshold we can find the corrupted pixels in the original image. As given in [12], we showed that the mean ROAD value is near 1 for a 3\ times 3 detection window when noise density is less than 25 % and 24 in a 5\ times 5 detection window. For noise density greater than 25 %, we have selected the threshold of 40 for a 3\ times 3 window. Sometimes impulses are clumped together in the original image to form a region of similar intensities. Trimmed global mean is capable of removing that clumped noise at high density satisfactorily. Our algorithm uses a fixed window for the filtering stage, which results in low execution time. If an iterative process has to be used, it may consume more time.

Table 1 Comparison of restoration results in PSNR (db) for images corrupted with random-valued impulse noise

Random-valued impulse noise: We added random-valued impulse noise in the standard images of Baboon, Bridge and the Pentagon with a size of 512\ times 512 pixels. All three images were corrupted by 20, 40 and 60 % random-valued impulse noise. We applied the proposed algorithm over those corrupted images. PSNR values calculated after applying the proposed algorithm on the corrupted images are shown in Table I. At 20 % impulse noise, the proposed algorithm gives a maximum of 6 dB increase in PSNR in the baboon image over the ROLD-EPR algorithm. At 40 % impulse noise, the proposed algorithm gives a maximum of 31.28 dB of PSNR for the pentagon image. At a higher noise density (60 %), the proposed algorithm gives better PSNR: 24.57 dB for the baboon image, for 24.42 dB for the bridge image, and 28.23 dB the for pentagon image. This shows that the proposed algorithm gives good performance relative to the comparable filters. The subjective results are shown in Figs. 2, 3, and 4.

Fig. 2
figure 2

(a) Baboon image corrupted by 20 % impulse noise. (b) Restored image (PSNR = 30.79 dB) from (a). (c) Baboon image corrupted by 40 % impulse noise. (d) Restored image (PSNR = 27.21 dB) from (c). (e) Baboon image corrupted by 60 % impulse noise. (f) Restored image (PSNR = 24.57 dB) from (e)

Fig. 3
figure 3

(a) Bridge image corrupted by 20% impulse noise. (b) Restored image (31.79 dB) from (a). (c) Bridge image corrupted by 40 % impulse noise. (d) Restored image (PSNR = 27.72 dB) from (c). (e) Bridge image corrupted by 60 % impulse noise. (f) Restored image (PSNR = 24.42 dB) from (e)

Fig. 4
figure 4

(a) Pentagon image corrupted by 20 % impulse noise. (b) Restored image (PSNR = 35.44 dB) from (a). (c) Pentagon image corrupted by 40 % impulse noise. (d) Restored image (PSNR = 31.28 dB) from (c). (e) Pentagon image corrupted by 60 % impulse noise. (f) Restored image (PSNR = 28.23 dB) from (e)

For noise density less than 25 %, we use a 3\ times 3 detection window and filter window. For greater than 25 % noise density, we use a 5\ times 5 detection window and filtering window. In Fig. 2, we used a standard 512\ times 512 image of a baboon. 2 (a), 2 (c) and 2 (e) are the image corrupted by 20, 40 and 60 % random-valued impulse noise respectively, and the corresponding restored images are shown in 2 (b), 2 (d) and 2 (f). In Figs. 3 and 4, we used the standard 512\ times 512 images of a bridge and the Pentagon, and the corrupted images are similarly shown alongside the corresponding restored images. These results show that the proposed filter is able to restore the corrupted images to the extent of recognizable and acceptable quality.

We also artificially added stripes, blotches, and scratches in the Lena image.

Stripes: We artificially added white and black stripes 1, 2, and 3 pixels wide in the Lena image shown in Figs. 5 and 6. We added 1 pixel wide stripe, horizontally and vertically, of white and black pixels, shown in Figs. 5a, c, 6a, and c. The restored images after applying the proposed algorithm are shown in 5 (b), 5 (d), 6 (b), and 6 (d), respectively. In Figs. 5e and 6e we add both horizontal and vertical stripes, and the restored images are shown in 5 (f) and 6 (f) respectively, with PSNR of 33.07 dB in each case. The Lena image with both horizontal and vertical 2 pixels wide stripes added is shown in Figs. 5g and 6g, and the results after applying the proposed filter are shown in Figs. 5h and 6h, with PSNR 28.29 dB and 28.21 dB respectively. The results after adding horizontal and vertical 3 pixel wide stripes are shown in Figs. 5j and 6j. The proposed algorithm satisfactorily recovered the image after adding these stripes as well. In restoring stripes, we took a 5\ times 5 detection window and filtering window. The trimmed global mean filter recovered all of the corrupted pixels by replacing them with the trimmed global mean, if the selected window contains only corrupted pixels. By this logic, it is able to remove black and white stripes of various pixel widths as shown in Figs. 5 and 6. The proposed algorithm also performed well on images corrupted by both stripes and random valued impulse noise. Figures 5k and 6k are the Lena image corrupted by both horizontal and vertical stripes, with 40 % random impulse noise added. The recovered images after applying the proposed filter are shown in Figs. 5i and 6i, with PSNR of 28.00 dB and 28.16 dB respectively. These results show that our algorithm is also able to remove stripes from corrupted images.

Fig. 5
figure 5

(a) Lena image corrupted by white horizontal stripes of 1 pixel width. (b) Restored image (PSNR = 36.93 dB) from (a). (c) Lena image corrupted by white vertical stripes of 1 pixel width. (d) Restored image (PSNR = 35.37 dB) from (c). (e) Lena image corrupted by both white horizontal and vertical stripes of 1 pixel width. (f) Restored image (PSNR = 33.07 dB) from (e). (g) Lena image corrupted by both white horizontal and vertical stripes of 2 pixel width. (h) Restored image (PSNR = 28.29 dB) from (g). (i) Lena image corrupted by both white horizontal and vertical stripes of 3 pixel width. (j) Restored image (PSNR = 25.62 dB) from (i). (k) Lena image corrupted by white horizontal and vertical stripes of 1 pixel width and 40% impulse noise. (l) Restored image (PSNR = 28.00 dB) from (i)

Fig. 6
figure 6

(a) Lena image corrupted by black horizontal stripes of 1 pixel width. (b) Restored image (PSNR = 36.93 dB) from (a). (c) Lena image corrupted by black vertical stripes of 1 pixel width. (d) Restored image (PSNR = 35.37 dB) from (c). (e) Lena image corrupted by both black horizontal and vertical stripes of 1 pixel width. (f) Restored image (PSNR = 33.07 dB) from (e). (g) Lena image corrupted by both black horizontal and vertical stripes of 2 pixel width. (h) Restored image (PSNR = 28.21 dB) from (g). (i) Lena image corrupted by both black horizontal and vertical stripes of 3 pixel width. (j) Restored image (PSNR = 25.64 dB) from (i). (k) Lena image corrupted by black horizontal and vertical stripes of 1 pixel width and 40% impulse noise. (l) Restored image (PSNR28.16 dB) from (i)

Blotches: The algorithm can also remove both white and black blotches, including when combined with impulse noise. Figure 7a and c show the Lena image corrupted by white and black blotches. Figure 7b and d show the results after applying the proposed algorithm over the corrupted images. The proposed algorithm also successfully restores the image when corrupted by both blotches and random valued-impulse noise. Figure 7e and g are the images corrupted by impulse noise and white and black blotches. Results after applying the proposed algorithm are shown in Fig. 7f and h.

Fig. 7
figure 7

(a) Lena image corrupted by white blotches. (b) Restored image (PSNR = 43.0125 dB) from (a). (c) Lena image corrupted by black blotches. (d) Restored image (PSNR = 43.01 dB) from (c). (e) Lena image corrupted by white blotches and 40 % impulse noise. (f) Restored image (PSNR = 29.71 dB) from (e). (g) Lena image corrupted by black blotches and 40 % impulse noise. (h) Restored image (PSNR = 29.62 dB) from (g)

Scratches: We also tested the proposed algorithm against scratches and impulse noise and proved that our algorithm gives good performance on images corrupted by scratches and impulse noise. We artificially added scratches on the Lena image as grayscale lines with intensity 0.2, 0.1, 0.9, and 0.8, shown in Fig. 8a. Figure 8c shows the image corrupted by scratches and random-valued impulse noise at 40 % noise density. The restored images are shown alongside corrupted images.

Fig. 8
figure 8

(a) Lena image corrupted by scratches. (b) Restored image (PSNR = 35.41 dB) from (a). (c) Lena image corrupted by scratches and 40 % impulse noise. (d) Restored image (PSNR = 29.51 dB) from (c)

5 Conclusions

In the proposed algorithm, we used a ROAD statistic as a method of detecting corrupted pixels and the trimmed global mean filter for correcting the corrupted pixels. The proposed algorithm gives a better PSNR than many standard algorithms. With the ROLD-EPR algorithm, the average restored PSNR for the three images at 20, 40 and 60 % noise density is 25.46 dB and with our proposed algorithm, it is 29.05 dB, which shows that there is a 14 % increase in average PSNR over the comparative methods. The proposed algorithm is a simple algorithm to remove different type of degradation: stripes, scratches and blotches. We used a constant window for the filter stage, and no iterative process is used. Therefore, it does not take much processing time yet still gives good results for high noise density. The main advantages of the proposed algorithm are that it is easy to implement in hardware and that it has low execution time.