Next Article in Journal
Design and Validation of a Minimal Complexity Algorithm for Stair Step Counting
Next Article in Special Issue
Inertial Sensor Based Solution for Finger Motion Tracking
Previous Article in Journal
Deep Transfer Learning in Diagnosing Leukemia in Blood Cells
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Eliminating Nonuniform Smearing and Suppressing the Gibbs Effect on Reconstructed Images †

Faculty of Software Engineering and Computer Technigue, ITMO University, Saint-Petersburg 197101, Russia
*
Author to whom correspondence should be addressed.
This paper is an extended version of our report: Sizikov, V.; Dovgan, A.; Lavrov, A. “Suppressing the Gibbs Effect on Reconstructed Images” in the Majorov International Conference on Software Engineering and Computer Systems (MICSECS 2019), Saint-Petersburg, Russia, 12–13 December 2019.
Computers 2020, 9(2), 30; https://doi.org/10.3390/computers9020030
Submission received: 5 March 2020 / Revised: 8 April 2020 / Accepted: 9 April 2020 / Published: 15 April 2020
(This article belongs to the Special Issue Selected Papers from MICSECS 2019)

Abstract

:
In this work, the problem of eliminating a nonuniform rectilinear smearing of an image is considered, using a mathematical- and computer-based approach. An example of such a problem is a picture of several cars, moving with different speeds, taken with a fixed camera. The problem is described by a set of one-dimensional Fredholm integral equations (IEs) of the first kind of convolution type, with a one-dimensional point spread function (PSF) when uniform smearing, and by a set of new one-dimensional IEs of a general type (i.e., not the convolution type), with a two-dimensional PSF when nonuniform smearing. The problem is also described by a two-dimensional IE of the convolution type with a two-dimensional PSF when uniform smearing, and by a new two-dimensional IE of a general type with a four-dimensional PSF when nonuniform smearing. The problem of solving the Fredholm IE of the first kind is ill-posed (i.e., unstable). Therefore, IEs of the convolution type are solved by the Fourier transform (FT) method and Tikhonov’s regularization (TR), and IEs of the general type are solved by the quadrature/cubature and TR methods. Moreover, the magnitude of the image smear, Δ, is determined by the original “spectral method”, which increases the accuracy of image restoration. It is shown that the use of a set of one-dimensional IEs is preferable to one two-dimensional IE in the case of nonuniform smearing. In the inverse problem (i.e., image restoration), the Gibbs effect (the effect of false waves) in the image may occur. This may be an edge or an inner effect. The edge effect is well suppressed by the proposed technique, namely, “diffusing the edges”. The inner effect is difficult to eliminate, but the image smearing itself plays the role of diffusion and suppresses the inner Gibbs effect to a large extent. It is shown (in the presence of impulse noise in an image) that the well-known Tukey median filter can distort the image itself, and the Gonzalez adaptive filter also distorts the image (but to a lesser extent). We propose a modified adaptive filter. A software package was developed in MATLAB and illustrative calculations are performed.

1. Introduction

The elimination of image smearing, a problem of distorted image processing, is commonly undertaken by mathematical- and computer-based approaches ([1,2,3,4,5,6,7], et al.).
Smearing refers to image distortion caused by the shift of the image-recording device (i.e., photo camera, video camera, telescope, microscope, etc.), the mismatch of the movement of the observation object (i.e., the Earth’s surface, details on a conveyor belt), and the tracking device or the movement of the object itself (e.g., a patient in a tomograph, or an animal, car, or plane) for exposure time [4,7].
The problem of smear elimination via a mathematical method consists of two tasks: a direct problem (computer smear modeling) and an inverse problem (smear eliminating by equation solving) [7] (pp. 106–109). However, the inverse problem is very sensitive to the accuracy of the knowledge of smear magnitude, Δ (as shown, for example, in [8]), especially if the smear is variable, i.e., Δ = Δ(x), where x is the coordinate along the smear [5,6]. In this paper, we develop the “spectral method” proposed in [7,8,9] and use it to determine the smear Δ and Δ(x).
In this paper, we focus on a rarely considered form of image smearing, namely, rectilinear, which is nonuniform when the camera or object moves during the exposure, as well as on various types of integral equations used in the inverse problem. We give special attention to the Gibbs effect (the effect of false waves), which often appears on images [4,5,7], and noise filtering.
The authors of several publications [1,2,3,4,7,8,9] et al. consider the variant of uniform rectilinear image smearing, as well as that of arbitrary (nonuniform curvilinear) smearing, using a “blind” deconvolution method [10] (p. 192), [11,12], but less often consider an intermediate variant of nonuniform rectilinear smearing [1,2,5,6] as an actual variant.
The main goal of this work is a comparative consideration of two variants of rectilinear image smearing (uniform and nonuniform) and suppression of the Gibbs effect, which reduces the restored image quality.
Example: a smeared image of movable objects (e.g., athletes/runners, animals, cars, or planes) moving with different speeds, taken with a fixed camera. Note that a variant was considered in [1,2] in which a camera (or object) moved during the exposure rectilinearly with a certain speed v(t), where t is time. This variant is quite complicated, since it requires solving the nonlinear equation δ(t(x)) = x with respect to t, where δ ( t ) = 0 t v ( t )   d t [6]. In this paper and in [5,6], a simpler variant of smear is considered: Δ = Δ(x), where x is the coordinate along the smear.
However, it is not possible from [5,6] to determine the dependence Δ(x) from a smeared image. In this paper, we propose such a method (“divided spectra”) based on the spectral method.
The article is organized as follows. Section 2 describes the uniform rectilinear image smearing mathematically as a direct problem (integral calculation) and an inverse problem (image restoration via solving a set of one-dimensional IEs or one two-dimensional IE by the Fourier transform (FT) and Tikhonov’s regularization (TR) method). Section 3 describes the elimination of nonuniform rectilinear image smearing via solving a set of one-dimensional IEs or one two-dimensional IE of a general type (not convolution type) by the method of quadrature/cubature and TR. In Section 4, an illustrative numerical example is given: three cars moving with the same smear Δ. The smear is determined by the spectral method. The results of image restoration by the FT and TR methods are presented. The question of restoration error is stated. In Section 5, solution results for examples are presented in the case of various smears of automobiles. A method using divided spectra for determining the dependence Δ(x) is proposed. Section 6 describes the impulse noise filtering and its influence on the image itself. A modified median filter for impulse noise suppression is proposed. In all sections, we use the technique of diffusing the image edges that we proposed for suppressing the Gibbs effect. In Appendix A we also clarify why we used complex term—smear (motion blur).

2. Mathematical Description of Uniform Rectilinear Smearing of the Image

Let us recall the well-known case of image uniform smearing [4,7,9] and consider the direct and inverse problems.

2.1. Direct Problem

The direct problem of uniform rectilinear smearing of an image is to calculate the integral [6]
g y ( x ) = 1 Δ x x + Δ w y ( ξ )   d ξ ,
where Δ = const is the smear magnitude; the axes x and ξ are directed along the smear, and the axis y is perpendicular to the smear (plays the role of the parameter); wy(ξ) is the given non-smeared image, and gy(x) is the calculated (modeled) smeared image in each y-line. In order to calculate g according to (1), we developed in MATLAB the main program Autos.m and m-functions smearing.m [7] for the arbitrary smear angle θ and smear.m [5] for θ = 0. In addition, the MATLAB system has m-functions fspecial.m and imfilter.m for modeling g [10].
It should be noticed that the description of the smearing problem by an integral (and, as a consequence, by an integral equation, see below) is the most adequate mathematical description of the image smearing process.
The following Algorithm 1 in the form of pseudo code describes solving the direct problem according to [7] (pp. 116–118).
Algorithm 1. The direct problem of uniform rectilinear smearing of an image.
Input: exact (undistorted) image w
(1)
Assignment of smear magnitude Δ and smear angle θ.
(2)
Turn of the image w about angle θ and introduction of boundary conditions (BCs), truncation or diffusion of edges
(3)
Calculation of the smeared image g line-by-line in the discrete form: g j ( i ) = 1 Δ + 1 k = i i + Δ w j ( k ) , j = 1 , 2 , , m , i = 1 , 2 , , N , where j and i are the numbers of rows and columns of the turned image, and N = n Δ when truncating and N = n + Δ when diffusing the image edges.
(4)
Inverse turn of the image g.
Output: g

2.2. Inverse Problem

The inverse (more important and complex) problem can be solved by two approaches.
In the first approach, in order to eliminate the smearing, we solve a set of one-dimensional Fredholm integral equations (IEs) of the first kind of convolution type (for each value of y) [6,7,9]:
h ( x ξ )   w y ( ξ )   d ξ = g y ( x ) , < x < .
where
h ( x ) = { 1 / Δ , Δ x 0 ,   0 ,   otherwise .
The IE (2) is obtained from the relation (1); axes x and ξ are directed along the smear and axis y is perpendicular to the smear; h is the kernel of IE mathematically, and the point spread function (PSF) physically and technically [3,4,7,11,13]. The function h, as a rule, is difference, or spatially invariant, which means that the smearing is uniform and the smear magnitude Δ is the same at all points of the image (Δ = const).
The problem of solving IE (2) is ill-posed (unstable) [14,15,16,17]. We use the stable Tikhonov regularization method (TRM, TR) with the Fourier transform (FT) [4,7,9,16,18]:
w α y ( ξ ) = 1 2 π   W α   y ( ω )   e i ω ξ   d ω ,
where
W α   y ( ω ) = H ( ω )   G y ( ω ) | H ( ω ) | 2 + α   ω 2 p
is the regularized Fourier spectrum (FS) of the solution; H(ω) = F(h(x)) and G y ( ω ) = F ( g y ( x ) ) are Fourier spectra of functions h(x) and g y ( x ) (H(ω) is the transfer function of a system [9]), where F is the sign of FT; α > 0 is the regularization parameter; p ≥ 0 is the regularization order (usually p = 1 or p = 2). Several approaches have been developed for choosing the regularization parameter α: the discrepancy principle, the method of training examples, the selection method, and others [2,7,14,17,18]. In order to calculate the reconstructed image using expressions (4) and (5), we have developed the m-function desmearingf.m [10]. In addition, the MATLAB system has the m-function deconfreg.m [10].
The following Algorithm 2 describes the solution of inverse problem (the first approach).
Algorithm 2. The inverse problem of the uniform rectilinear smearing (the first approach)
Input: smeared image g(x, y), where x and y are directed horizontally and vertically, respectively.
(1)
Calculating the Fourier spectrum G ( ω 1 , ω 2 ) = F ( g ( x , y ) ) , where x is horizontally, and y is vertically.
(2)
Determining the smear Δ and angle θ values according to the Fourier spectrum (by the spectral method).
(3)
Calculating the PSF h(x) according to (3), where x is directed along the smear and y is perpendicular to the smear.
(4)
Calculating the Fourier spectra H(ω) = F(h(x)) and line-by-line G y ( ω ) = F ( g y ( x ) ) .
(5)
The choice of the regularization parameter α by some approach.
(6)
Calculating line-by-line (for every y) the W α   y ( ω ) – the regularized Fourier spectrum of the desired solution w α   y ( ξ ) according to (5).
(7)
Calculating the restored image as IFT line-by-line: w α   y ( ξ ) = F 1 ( W α   y ( ω ) ) according to (4)
(8)
Inverse turn of the image and obtaining w(x, y), where x is horizontally, and y is vertically
Output: w(x, y).
 
In the second approach, to eliminate the smearing (as well as defocusing), the two-dimensional Fredholm integral equation of the first kind of convolution type is used (cf. (2)) [2,6,7]:
h ( x ξ , y η )   w ( ξ , η )   d ξ   d η = g ( x , y ) , < x , y <
In this equation, the x and ξ axes are directed horizontally, and y and η are directed vertically downward. PSF h is displayed on the plane (x, y) as a narrow strip [6,7] (p. 112).
In this approach, the direct problem is calculated using the m-functions fspecial.m and imfilter.m [10]. However, the solution of the two-dimensional IE (6) (the inverse problem) by the TR method and the two-dimensional FT is equal to w α ( x , y ) = F 1 ( W α ( ω   1 , ω   2 ) ) , where F 1 is the inverse Fourier transform (IFT), or
w α ( x , y ) = 1 4 π 2     W α ( ω 1 , ω 2 )   e i ( ω 1 x + ω 2 y )   d ω 1   d ω 2 ,
where W α ( ω 1 , ω 2 ) is the regularized spectrum (two-dimensional FT) of the solution, equal to
W α ( ω 1 , ω 2 ) = H * ( ω 1 , ω 2 )   G ( ω 1 , ω 2 )   | H ( ω 1 , ω 2 ) | 2 + α   ( ω 1 2 + ω 2 2 ) p
where H ( ω 1 , ω 2 ) = F ( h ( x , y ) ) , G ( ω 1 , ω 2 ) = F ( g ( x , y ) ) . The MATLAB contains the m-function deconvreg.m [10] for solving IE (6) by the TR and FT methods according to (7), (8).
The following Algorithm 3 describes the solution of the inverse problem (the second approach).
Algorithm 3. The inverse problem of the uniform rectilinear smearing (the second approach)
Input: smeared image g(x, y), where x and y are directed horizontally and vertically respectively
(1)
Calculating the Fourier spectrum G ( ω 1 , ω 2 ) = F ( g ( x , y ) ) .
(2)
Determining the smear magnitude Δ and the smear angle θ from the spectrum
(by the spectral method).
(3)
Building the PSF h(x, y) in the form of a strip with length Δ at angle θ.
(4)
Calculating the Fourier spectrum H ( ω 1 , ω 2 ) = F ( h ( x , y ) ) .
(5)
Choice of the regularization parameter α and regularization order p in some approach.
(6)
Calculating W α ( ω 1 , ω 2 ) – the regularized Fourier spectrum of the solution according to (8).
(7)
Computation of the restored image in the IFT form: w α ( x , y ) = F 1 ( W α ( ω 1 , ω 2 ) ) according to (7).
Output: w(x, y)
In order to compare the various approaches below, we give the well-known Formulas (1)–(8).

3. Mathematical Description of the Nonuniform Rectilinear Smearing

Taking into account the expressions (1)–(8), we describe the nonuniform rectilinear smearing of image along the smear direction. Let us consider two approaches.

3.1. The First (Time) Approach [1,2,6]

In this approach, the speed of moving object (or camera) is believed to be known as a function v(t) of time t [ 0 , τ ] , where τ is the exposure time. This approach was considered in detail in [6], and we consider the second, simpler approach.

3.2. The Second (Spatial) Approach [5,6]

Suppose that we have determined a dependence Δ = Δ(x) of the smear Δ on the x coordinate directed along the smear. This dependence may be determined from the smeared image in some approach, for example, by the method of “blind” deconvolution [11] or by the spectral method [9] (see Section 4).

3.2.1. The Direct Problem

In this case, the PSF h is not difference, or spatially invariant, and the direct problem is written in the form (cf. (1)):
g y ( x ) = 1 Δ ( x )   x   x + Δ ( x ) w y ( ξ )   d ξ
To calculate gy(x) according to (9), we have developed the m-function smear_n.m [5].

3.2.2. The Inverse Problem

The inverse problem in the frames of the second approach is written as a set of one-dimensional Fredholm integral equations of the first kind of general type (not in the convolution type) for each value of y [5,6]:
A w y a b h ( x , ξ )   w y ( ξ )   d ξ = g y ( x ) , c x d
where A is integral operator; [ a , b ] and [ c , d ] are limits for ξ and x. The PSF h is written as
h ( x , ξ ) = { 1 / Δ ( x ) , x ξ x + Δ ( x ) ,   0 , otherwise .
The FT method cannot be used for solving IE (10), since the IE (10) is not an equation of convolution type. However, the quadrature method can be applied, which reduces the IE (10) to some system of linear algebraic equations (SLAE) for each y [7] (p. 126):
A w y = g y
where A is the matrix, associated with h (the same for all y-rows), w y is the desired vector, g y is the right-hand side of SLAE. A stable solution of SLAE (12) is provided by the Tikhonov regularization method (TRM) [7]:
( α   I + A T A )   w y   α = A T g y
where α > 0 is the regularization parameter (the α choice method see in Figure 5 further), I is the identity matrix, A T is the transposed matrix, and w y α is the regularized solution in each y-row, equal to
w y   α = ( α   I + A T A ) 1 A T g y
In order to realize the formulas (10)–(14) on the PC, we have developed the m-function desmearq_n.m. Note that the quadrature method with Tikhonov’s regularization (TR) according to (13), (14) can be also used for solving IE of convolution type (2) with the PSF (3), i.e., for uniform smearing. For that, we have developed the m-function desmearq.m.
The inverse problem in the framework of the second approach can be also presented in the form of a two-dimensional Fredholm IE of the first kind of general type [18] (cf. (6)):
A w a b c d h ( x , ξ , y , η )   w ( ξ , η )   d ξ   d η = g ( x , y ) ,   a x b ,   c y d
Integral Equation (15) can be solved by the quadrature method (more precisely, cubature method) (cf. [18] p. 167).
According to this method, each of the integrals in (15) is replaced by a finite sum on discrete grids of nodes in x, ξ, y, η and we obtain SLAE with a four-dimensional matrix A, a two-dimensional right-hand side g and a two-dimensional desired function w. To solve such SLAE by the known methods (Gauss, etc.), it is necessary to transform the four-dimensional matrix A into a two-dimensional one, to transform the two-dimensional right-hand side g into a one-dimensional one, to solve such SLAE, and then to transform the resulting one-dimensional solution w into a two-dimensional one.
The solution of a two-dimensional IE by the cubature method took place, for example, in [18] (p. 168), however, with the small matrix 11 × 11 × 7 × 7, i.e., 11 2 × 7 2 . If an image g has real dimensions, e.g., 400 × 400 pixels, then it is necessary to solve SLAE with the two-dimensional matrix of size 400 2 × 400 2 , i.e., the matrix of gigantic size 160,000 × 160,000, which is difficulty implemented even on powerful computers. We see that the cubature method for solving IE (15) is a cumbersome method and its application to restore a nonuniform smeared image is complex.
It is possible to use the iteration methods of Jacobi, Landweber, Friedman, Bakushinsky, et al. [2,15,18] for solving two-dimensional IE (15). These methods usually do not use giant arrays; however, they require successful initial approximation for w, the number of iterations (playing the role of a regularization parameter), and other parameters.
As a result, we conclude that the most effective technique in the case of nonuniform smearing is the technique (10)–(14), based on line-by-line image processing by solving one-dimensional IE (10) and SLAE (12) with two-dimensional matrix in each y-line and on the subsequent combination of row-wise solutions into a single two-dimensional image.
The following Algorithm 4 describes the line-by-line solution of inverse problem.
Algorithm 4. The inverse problem for illuminating the row-wise nonuniform rectilinear smear
Input: image g(x, y) smeared nonuniformly along x
(1) Presentation of a two-dimensional image g(x, y) as a set of one-dimensional images g y ( x ) .
(2) Determining the nonuniform smear Δ(x) from the spectrum (by the spectral method).
(3) Calculating a PSF h(x,ξ) according to (11).
(4) Writing matrix A and vectors g y of a SLAE.
(5) Choosing the regularization parameter α in some approach.
(6) Solving the regularized SLAE (13) in each y-row.
(7) Obtaining the regularized solution w y α according to (14).
(8) Forming image wα(x, y) from a set of row-wise solutions w y α .
Output: wα(x, y).

4. Illustrative Example

The following numerical example is solved. Figure 1 shows semi-model grayscale (gray) initial image J of three cars (file Autos.png).
Image J has intensities from 0 to 255, which causes inconvenience in filtering impulse noise, which has values 0 and 255 (see details in Section 6).
To avoid this inconvenience, we replace the intensities 0 and 255 of the image J with the values 1 and 254. We obtain the image I with intensities from 1 to 254.
We use the image I 143 × 1307 pixels for further processing. Note that the driver’s head is visible in the left car, which (along with the wheels) will be one of the reference points in image processing.

4.1. Uniform Smearing of Image Using Boundary Conditions

Further, we assume that the cars move at the same speed and therefore give the same smear in the image: Δ = const = 20 pixels or the cars are stationary, but the camera moves uniformly during the exposure. Image I is smeared horizontally according to (1) using the head program Autos.m as well as the m-functions fspecial.m and imfilter.m at Δ = 20. In this case, a “boundary condition” is used in the m-function imfilter.m with the option ‘circular’. Figure 2a presents a smeared image (see smeared driver’s head and wheels).
In order to restore the image by solving inverse problem, it is necessary to know the angle θ and the smear Δ. It is possible to estimate these parameters visually, but only with an error, or it is impossible to estimate them at all. As we showed in [8,19], even the error of θ in 1–2 degree and the error of Δ in 1–2 pixel lead to the significant error (~10%) in image restoration even by Tikhonov’s regularization or Wiener’s parametric filtering method.
In [7,8,9,19], we have developed the so-called “spectral method”, which allows us to determine the distortion type (smearing, defocusing, etc.) and estimate the distortion parameters based on the Fourier transform (Fourier spectrum) of the distorted image. Let us use the spectral method. Figure 2b presents the Fourier spectrum in modulus |G(ω)| of distorted image showed in Figure 2a. As follows from Figure 2b, the image in Figure 2a is uniformly smeared (this follows from a theory and a large number of Fourier spectra of smeared, defocused, and other images [3,6,7,8,9,19,20,21]). In addition, one can estimate the smear magnitude Δ by the formula
Δ = 2 ω max ω 1
where ω 1 and ω max are the first and last zeros of the transfer function H(ω) = F(h(x)) (see the details in [9]). For several measures in Figure 2b, we get on average Δ = 20.08 ± 0.05 pixels, which is close to the exact value of Δ = 20. Using the value of Δ, we restored the image of cars (Figure 2c) by the FT and TR method according to (6)–(8) using m-function deconvreg.m with α = 10 4.2 (α value is chosen by the minimum of curve 1 in Figure 5); relative error is σ rel = 0.0359 (according to (17)).

4.2. Uniform Image Smearing with Truncation

The Boundary Conditions (BCs) [10,22] used in m-function imfilter.m are an artificial technique intended for determining the intensities of an undistorted image outside its edges. Instead of BCs, we have proposed [7,23] the image truncation technique, which does not require extra boundary data. Figure 3a presents the image 143 × 1267 which is smeared uniformly with a truncation modeled using m-function smear.m (with the option ‘truncation’). Figure 3b presents the image restored by the FT and TR method using m-function desmearq.m with α = 10 1.2 and σ rel = 0.269 . We see the significant edge and smaller inner Gibbs effects in Figure 3b. This is due to the sharp jump of intensity on the edges of image if it is truncated. Nevertheless, the truncation technique can be effective in the case of a finite image (a space object on the dark background [7] (p. 105), [22], etc.).

4.3. Uniform Image Smearing with Diffusing the Image Edges

In [7,23], we have proposed the approach of diffusing the smeared image edges to suppress the Gibbs edge effect. The Gibbs effect (distortion of the “ringing” type) is due to a stepwise change in intensity of the Heaviside step function type. Mathematically, the Gibbs effect can be explained by the fact that the FT of the step function gives the sinc function with side fluctuations. In order to suppress these false fluctuations, in [10] (p. 185), it was proposed to use the m-function edgetaper.m, which diffuses the image edges. However, modeling has shown that this function does not sufficiently diffuse the edges, and the foregoing Algorithm 1 is more effective. At the same time, the Gibbs inner effect is eliminated more difficult, but the image smearing itself reduces the intensity jump and reduces the Gibbs inner effect (see middle of Figure 3b).
The technique of diffusing the image edges resembles smoothing the edges of the transfer function H(ω), as well as the image smoothing by Butterworth low-frequency filter [4] (p. 265–267), [10] (p. 143), etc. However, these filters enhance smoothing the edges in the frequency domain, and our technique realizes diffusing the edges of the image itself immediately, which leads to a greater suppression of the Gibbs effect.
The diffusing of edges leads to the smooth decrease of intensity on the smeared image edges and to suppressing the Gibbs effect on the restored image. Figure 4a presents the uniformly smeared image with the addition of diffusing its edges via m-function smear.m (with the option ‘diffusion’). Figure 4b presents the result of image restoration of cars by the FT and TR method according to (12)–(14) with the m-function desmearq.m. We see that the introduction of diffusing the edges leads to the image restoration without the Gibbs effect and to almost exact restoration.

4.4. Error Estimation of Image Restoration

In order to estimate numerically the restoration quality and choose the regularization parameter α, we propose a formula for calculating relative error in the form of the standard deviation of the calculated image w ˜ α from the exact image w ¯ [9]:
σ rel ( α ) = | | w ˜ α w ¯ | | L 2 | | w ¯ | | L 2 = j = 1 M i = 1 N ( w ˜ α j i w ¯ j i ) 2 / j = 1 M i = 1 N w ¯ j i 2
where M is the number of rows and N is the number of columns in the image. Such an expression for the image error can be used only in the case of model image processing when w ¯ is known (e.g., the image in Figure 1b). Figure 5 presents the curves σ rel ( α ) for different variants of solutions. One can choose the value of α from the minima of these curves.
One can also use the following expression for restoration error:
PSNR = 10   lg ( w ¯ max M N / w w ¯ L 2 2 )
where PSNR is the so-called peak signal-to-noise ratio, used widely in engineering, acoustics, and other fields. However, formula (17) is more convenient and obvious for image processing. Indeed, if, for example, the error according to (17) equals σ rel = 0.035 , then this means that the restoration error is 3.5%, and this value does not depend on the system of units w, which is convenient and clear. Although, if we use the formula (18) and get an error, for example, 8 dB, it becomes difficult to judge whether this is a large or small error in image restoration.

5. Direct and Inverse Problems of Nonuniform Image Smearing

The next step is the nonuniform image smearing. We believe that the cars move with different speeds and therefore they have different smears on the image, for example, Δ = Δ 1 = 15 pixels for the left car, Δ = Δ 2 = 20 pixels for the middle car and Δ = Δ 3 = 25 pixels for the right car.
As a result, smear Δ(x) is a piecewise constant function:
if (i <= 360) Δ = 15; elseif ( i <= 820) Δ = 20; else Δ = 25;
where i = 1 … 1307 is the number of discrete reading along x.
Figure 6 shows an image smeared nonuniformly according to (9) and (19) with diffusing the edges for suppressing the Gibbs edge effect using m-function smear_n.
In order to solve the inverse problem of image restoration, one needs to know the dependence (19) Δ(x) of the smear from x. However, we usually do not know this dependence in practice, or we can visually estimate it according to Figure 6 only approximately. To determine Δ(x), we use the spectral method, as in Figure 2b. Figure 7 presents the Fourier spectrum in modulus |G(ω)| of the distorted image g(x, y) in Figure 6.
However, Figure 7 shows that the spectrum is the sum of three spectra and this creates difficulties with the definition of Δ 1 , Δ 2 and Δ 3 . We propose the approach that we call the “approach of divided spectra”.

The Approach of Divided Spectra

Let us divide the original piecewise-uniform smeared image in Figure 6 into three parts, for example, g1(:,22:344); g2(:,400:800), g3(:,854:1293). To perform such a division is not difficult. Figure 8a–c present the divided parts g1, g2, g3 of the image shown in Figure 6.
Next, we calculate the FT (spectrum) in modulus |G| for each part of the image (Figure 8d–f, cf. Figure 2b). From the spectra, we determine the magnitudes of smears by the Formula (16) and obtain (for several measures): Δ 1 = 14.95 ± 0.40 , Δ 2 = 20.42 ± 0.50 , Δ 3 = 24.99 ± 0.60 or rounded to integer values: Δ 1 = 15 , Δ 2 = 20 , Δ 3 = 25 .
As a result, having determined rather accurately the divided smears Δ 1 , Δ 2 , Δ 3 , and hence the dependence Δ(x), we solve the inverse problem of a single (without division) image restoration according to (10)–(14), namely, by the quadrature method with Tikhonov’s regularization. Figure 9 presents the result of image restoration using the developed m-function desmearq_n.m. The image is restored almost accurately and without the Gibbs effect.

6. Noise Accounting

In the above results, we do not take into account the influence of noise; therefore, we obtain clear restored images in Figure 2, Figure 4 and Figure 9. Let us consider the influence of noise on the results of image processing for example of impulse noise (of type ‘salt & pepper’) with intensities 0 and 255 [10,24,25,26].
In the Tukey median filter [4,7,24,25] (realized in the m-function medfilt2.m), a small window slides over the noisy image and at each position of the window, the intensity of center point of the window I 0 is replaced by the median intensity I m . As a result, noise with intensities I n = 0 and 255 is eliminated, but the image itself may be distorted, since, firstly, I m can be different from I 0 and, secondly, I 0 can be equal to 0 or 255.
In [4] (p. 360) and [10] (p. 178), an adaptive median filter (the Gonzalez filter) was proposed (m-function adpmedian.m), according to which I 0 is replaced by I m only when I 0 = 0 or 255, i.e., the central point is impulse. However, the Gonzalez filter can also distort the image itself when I 0 = 0 or 255, although the center point is not an impulse, but the point of the image itself.
We propose a filter that we call a modified median filter (m-function modmed.m). According to this filter, the original noise-free image is supposed to have no points with intensity 0 or 255, i.e., 0 < I 0 < 255 , and replacing I 0 with I m in a noisy image is performed only when I 0 = 0 or 255, i.e., when the center point is really an impulse, as in the Gonzalez filter. If the noise-free image haspoints with intensities 0 or 255, then we propose to replace I 0 = 0 or 255 with I 0 = 1 or 254 in the noise-free image (as in Figure 1).
The following Algorithm 5 describes the operations of the modified median filter.
Algorithm 5. Noise eliminating by the modified median filter.
Input: g – image noisy by bipolar impulse noise
(1)
Initial (noise -free) image w of size M×N
(2)
Correction of w: for j = 1:M for i = 1:N if w(j,i) = 0 then w(j,i) = 1; if w(j,i) = 255 then w(j,i) = 254;
(3)
Noising image w by impulse noise and obtaining image g
(4)
Presentation of sliding window m×n (default 3×3)
(5)
The Tukey filter (median intensity at each point): fmed = medfilt2(g,[m n]);
(6)
Initial approximation of filtered image: f = g;
(7)
Noise eliminating: for j = 1:M for i = 1:N if g(j,i) = 0 or g(j,i) = 255 then f(j,i) = fmed(j,i); (replacement only if the point (j,i) is an impulse)
Output: f – image filtered by the modified median filter
Figure 10a presents the image taken from Figure 2a and uniformly smeared (Δ = const = 20 pixels). Figure 10b presents an image that is smeared and slightly noisy by impulse noise (the share of noising is d = 0.005, i.e., 0.5%). Figure 10c shows the image cleared from noise by the modified median filter (m-function modmed.m). The elimination of noise seemed to be successful, but the FT (spectrum) in modulus in Figure 10d of image from Figure 10c is insufficiently clear, unlike the clear spectrum in Figure 2b. Consequently, eliminating the image smear in Figure 10c by the FT and TR method using the m-function deconvreg.m gives an insufficiently accurate result (Figure 10e, α = 10 3.7 , σ rel = 0.0448 , see curve 5_05 in Figure 5), besides with the Gibbs weak effect.
Note that the intensities in the image in Figure 10a are artificially put equal from 1 to 254, as the modified median filter requires.
We also note that the impulse noise level (the share of noising) is put equal to d = 0.005, 0.01 and 0.02 (see Figure 5 and Figure 10) in order to determine the error dependence of image filtering by the modified median filter from the noise level. We see from a comparison of the images in Figure 10a,c that this filter eliminates noise effectively, but slightly distorts the image itself (Figure 10c). This leads to the noticeable distortion of the spectrum (Figure 10d) and the restored image (Figure 10e).
This means that the Tukey median filter has an error in restoring the center point of a sliding window. If we pass through medfilt2.m even a noise-free image, for example, the smeared image S1 in Figure 10a, we get the image Sf1 = medfilt2(S1, [3 3], ‘symmetric’). The image Sf1 is different from S1 on 2.4%, i.e., the Tukey median filter distorts an image even in the noise absence. Since both the Gonzalez filter and our modified filter refer to the Tukey filter, they also distort an image (cf. Figure 10a,c). The relative error of the Tukey filter is σ rel = 0.0244 , the Gonzalez filter is σ rel = 0.0135 , and the modified filter is σ rel = 0.0017 at noise d = 0.005.

7. Conclusions

In this paper, we describe a technique of restoring the smeared images in the case when the smearing is rectilinear, horizontal, but nonuniform, in particular, piecewise uniform (example: cars on the road). It is proposed to solve a set of one-dimensional integral equations (IEs) (the first approach) or one two-dimensional IE (the second approach). In both approaches, the equations are not convolution type IEs; therefore, they are solved by the quadrature/cubature method with Tikhonov’s regularization. The first approach is shown to be more preferable than the second one. Numerical examples confirm this. We have developed programs in the MATLAB system and we perform illustrative calculations.
In order to determine the image smear of a variable quantity Δ = Δ(x), we propose a new modification of the “spectral method” (the “approach of divided spectra”), which enhances the image restoration accuracy.
It is also shown that to improve the image restoration quality, the image edge diffusing should be used for suppressing the Gibbs edge effect (the effect of false waves). The Gibbs effect may also be inner. In this case, it is suppressed by image smearing, which reduces the jumps in intensities.
We propose a new filter for eliminating impulse noise in the images—the modified median filter that suppresses noise, but almost does not distort the image.
In further publications, the proposed technique will be tested on the real images and compared with other methods.
The technique can be used in practice for restoring grouped images of several objects (e.g., people, planes, cars) moving with different speeds and therefore receiving different smears Δ in the images during exposure by a fixed camera.

Author Contributions

Conceptualization, V.S.; methodology, V.S. and A.D.; software, V.S.; formal analysis, V.S. and A.L.; data curation, V.S. and A.D.; writing—original draft preparation, V.S. and A.D.; writing—review and editing, V.S., A.D. and A.L.; visualization, V.S. and A.D. All authors have read and agreed to the published version of the manuscript.

Funding

This research was funded by MFCTC ITMO (Project Number: 619296).

Conflicts of Interest

The authors declare no conflict of interest.

Appendix A

Let us briefly consider the question about terminology and image restoration methods. Many authors ([4,10,11,12,13,17,27], and others) use the terms blur, blurring, deblurring both for blurring and for defocusing of images. This creates an inconvenience. According to these terms, it is difficult to determine what kind of distortion (blurring or defocusing, etc.) is meant. In addition, the restoration of both blurry and defocused images is described only by two-dimensional integral equations (IEs). However, in this article, we show that in the case of nonuniform blur, it is better to use a set of one-dimensional IEs. We suppose that along with the terms blur, blurring, the terms such as smear, smearing and defocusing must be used, as well as one should solve both two-dimensional and one-dimensional IEs. It is also appropriate to use the complex term: smear (motion blur).
As stated in English Wikipedia [28], smear may refer to a sample smearing over a microscope slide, motion (in optics) that degrades sharpness of image, etc. In [29], it was also noted: in optics, image smear occurs when an object moves within the exposure time. In addition, in astronomy [30,31], time smearing or time-average smearing is the degradation of the reconstructed image of a celestial body observed by a ground-based interferometer that occurs because of the duration of the observation and rotation of the Earth.
Based on the foregoing, we can conclude that the terms smear and smearing can be used and is used quite often, along with the terms blur and blurring, in order to mean the image distortion during the mutual movement of the photographed object and the shooting equipment.

References

  1. Tikhonov, A.N.; Goncharsky, A.V.; Stepanov, V.V. Inverse Problems of Photoimages Processing. In Ill-Posed Problems in Natural Science; Tikhonov, A.N., Goncharsky, A.V., Eds.; MSU Publ.: Moscow, Russia, 1987; pp. 185–195. [Google Scholar]
  2. Bakushinsky, A.; Goncharsky, A. Ill-posed Problems: Theory and Applications; Kluwer Academic Publishers: Dordrecht, The Netherlands, 1994; 199p. [Google Scholar] [CrossRef]
  3. Gruzman, I.S.; Kirichuk, V.S.; Kosykh, V.P.; Peretyagin, G.I.; Spektor, A.A. Digital Image Processing in Information Systems; NSTU Publ.: Novosibirsk, Russia, 2002; 352p. [Google Scholar]
  4. Gonzalez, R.C.; Woods, R.E. Digital Image Processing, 2nd ed.; Prentice Hall: Upper Saddle River, NJ, USA, 2002; 797p. [Google Scholar]
  5. Sizikov, V.; Dovgan, A. Reconstruction of images smeared uniformly and non-uniformly. CEUR Workshop Proc. 2019, 2344, 11. [Google Scholar]
  6. Sizikov, V.S.; Dovgan, A.N.; Tsepeleva, A.D. Reconstruction of images smeared non-uniformly. J. Opt. Technol. 2020, 87, 1–8. [Google Scholar] [CrossRef]
  7. Sizikov, V.S. Direct and Inverse Problems of Image Restoration, Spectroscopy and Tomography with MatLab; Lan’ Publ.: St. Petersburg, Russia, 2017; 412p. [Google Scholar]
  8. Sizikov, V.S. Spectral method for estimating the point-spread function in the task of eliminating image distortions. J. Opt. Technol. 2017, 84, 95–101. [Google Scholar] [CrossRef]
  9. Sizikov, V.S.; Stepanov, A.V.; Mezhenin, A.V.; Burlov, D.I.; Éksemplyarov, R.A. Determining image-distortion parameters by spectral means when processing pictures of the earth’s surface obtained from satellites and aircraft. J. Opt. Technol. 2018, 85, 203–210. [Google Scholar] [CrossRef]
  10. Gonzalez, R.C.; Woods, R.E.; Eddins, S.L. Digital Image Processing using MATLAB; Prentice Hall: Upper Saddle River, NJ, USA, 2004; 302p. [Google Scholar]
  11. Fergus, R.; Singh, B.; Hertzmann, A.; Roweis, S.T.; Freeman, W. Removing camera shake from a single photograph. ACM Trans. Graph. 2006, 25, 787–794. [Google Scholar] [CrossRef]
  12. Cho, S.; Lee, S. Fast motion deblurring. ACM Trans. Graph. 2009, 28. [Google Scholar] [CrossRef]
  13. Velho, L.; Frery, A.C.; Gomes, J. Image Processing for Computer and Vision Graphics, 2nd ed.; Springer: London, UK, 2009; 476p. [Google Scholar] [CrossRef]
  14. Tikhonov, A.N.; Arsenin, V.Y. Solutions of Ill-Posed Problems; Winston: Washington, DC, USA, 1977. [Google Scholar]
  15. Engl, H.; Hanke, M.; Neubauer, A. Regularization of Inverse Problems; Kluwer: Dordrecht, The Netherlands, 1996; 328p. [Google Scholar]
  16. Petrov, Y.P.; Sizikov, V.S. Well-Posed, Ill-Posed, and Intermediate Problems with Applications; Publisher VSP: Leiden, The Netherlands, 2005; 234p. [Google Scholar]
  17. Hansen, P.C. Discrete Inverse Problems: Insight and Algoritms; SIAM: University City, PA, USA, 2010; 213p. [Google Scholar]
  18. Verlan, A.F.; Sizikov, V.S. Integral Equations: Methods, Algorithms, Programs; Naukova Dumka: Kiev, Ukraine, 1986; 544p. [Google Scholar]
  19. Sizikov, V.S. Estimating the point-spread function from the spectrum of a distorted tomographic image. J. Opt. Technol. 2015, 82, 655–658. [Google Scholar] [CrossRef]
  20. Bates, R.H.T.; McDonnell, M.J. Image Restoration and Reconstruction; Oxford U. Press: Oxford, UK, 1986; 320p. [Google Scholar]
  21. Jähne, B. Digital Image Processing; Springer: Berlin/Heidelberg, Germany, 2005; 549p. [Google Scholar] [CrossRef] [Green Version]
  22. Nagy, J.G.; Palmer, K.; Perrone, L. Iterative methods for image deblurring: A Matlab object-oriented approach. Numer. Algorithms 2004, 36, 73–93. [Google Scholar] [CrossRef]
  23. Sizikov, B.C. The truncation—Blurring—Rotation technique for reconstructing distorted images. J. Opt. Technol. 2011, 78, 298–304. [Google Scholar] [CrossRef]
  24. Lim, J.S. Two-Dimensional Signal and Image Processing; Prentice Hall PTR: Upper Saddle River, NJ, USA, 1990; 694p. [Google Scholar]
  25. D’yakonov, V.; Abramenkova, I. MATLAB: Signal and Image Processing; Piter: St. Petersburg, Russia, 2002; 608p. [Google Scholar]
  26. Bezuglov, D.A.; Voronin, V.V.; Krutov, V.A. Images denoising in case impulse noise using spline approximation. MATEC Web Conf. 2018, 226. [Google Scholar] [CrossRef]
  27. Dell’Acqua, P.; Donatelli, M.; Estatico, C.; Mazza, M. Structure preserving preconditioners for image deblurring. J. Sci. Comput. 2017, 72, 147–171. [Google Scholar] [CrossRef]
  28. Smear. Available online: https://en.wikipedia.org/wiki/Smear (accessed on 4 June 2019).
  29. Smear (optics). Available online: https://en.wikipedia.org/wiki/Smear_(optics) (accessed on 6 April 2016).
  30. Time smearing. Available online: https://en.wikipedia.org/wiki/Time_smearing (accessed on 7 August 2019).
  31. Johnson, J.F. Modeling imager deterministic and statistical modulator transfer functions. Appl. Opt. 1993, 32, 6503–6513. [Google Scholar] [CrossRef] [PubMed]
Figure 1. Initial (undistorted) image of stationary cars (143 × 1307 pixels). (a) Image J with intensities from 0 to 255; (b) image I with intensities from 1 to 254.
Figure 1. Initial (undistorted) image of stationary cars (143 × 1307 pixels). (a) Image J with intensities from 0 to 255; (b) image I with intensities from 1 to 254.
Computers 09 00030 g001
Figure 2. Image 143 × 1307 smeared uniformly (a); two-dimensional centered FT (spectrum) in modulus of image 143 × 1307 (b); image 143 × 1307 restored by the Fourier transform (FT) and Tikhonov regularization (TR) method (c).
Figure 2. Image 143 × 1307 smeared uniformly (a); two-dimensional centered FT (spectrum) in modulus of image 143 × 1307 (b); image 143 × 1307 restored by the Fourier transform (FT) and Tikhonov regularization (TR) method (c).
Computers 09 00030 g002
Figure 3. Image smeared uniformly with truncation (a); restored image (b).
Figure 3. Image smeared uniformly with truncation (a); restored image (b).
Computers 09 00030 g003
Figure 4. Image smeared uniformly with diffusing the edges (option ‘diffusion’). (a)—smeared image 143 × 1327 (Δ = 20 pixels); (b)—restored image 143 × 1307 by TR method (α = 10–8), relative error of restoration σ rel 0 .
Figure 4. Image smeared uniformly with diffusing the edges (option ‘diffusion’). (a)—smeared image 143 × 1327 (Δ = 20 pixels); (b)—restored image 143 × 1307 by TR method (α = 10–8), relative error of restoration σ rel 0 .
Computers 09 00030 g004
Figure 5. The relative error of image restoration σ rel ( α ) . 1—FT and TR method (see Figure 2c); 2—FT and TR method with truncation (Figure 3b); 3—FT and TR method with diffused edges (Figure 4b); 4—quadrature and ТR method with diffusing and division (see Figure 9); 5 – FT and TR method with noise, d = 0.005, 0.01, 0.02 (Figure 10e).
Figure 5. The relative error of image restoration σ rel ( α ) . 1—FT and TR method (see Figure 2c); 2—FT and TR method with truncation (Figure 3b); 3—FT and TR method with diffused edges (Figure 4b); 4—quadrature and ТR method with diffusing and division (see Figure 9); 5 – FT and TR method with noise, d = 0.005, 0.01, 0.02 (Figure 10e).
Computers 09 00030 g005
Figure 6. Image smeared nonuniformly with diffusing the edges.
Figure 6. Image smeared nonuniformly with diffusing the edges.
Computers 09 00030 g006
Figure 7. FT (Fourier spectrum) in modulus of nonuniformly smeared image presented in Figure 6.
Figure 7. FT (Fourier spectrum) in modulus of nonuniformly smeared image presented in Figure 6.
Computers 09 00030 g007
Figure 8. Divided parts of image (ac); divided spectra in modulus (df).
Figure 8. Divided parts of image (ac); divided spectra in modulus (df).
Computers 09 00030 g008
Figure 9. Restored single image 143 × 1307, σ rel 0 (see curve 4 in Figure 5).
Figure 9. Restored single image 143 × 1307, σ rel 0 (see curve 4 in Figure 5).
Computers 09 00030 g009
Figure 10. Noise influence accounting. (a) Image smeared uniformly; (b) image smeared uniformly and noisy (d = 0.005); (c) image filtered from noise using modmed.m; (d) FT (spectrum) in modulus; (e) image restored by the FT and TR method.
Figure 10. Noise influence accounting. (a) Image smeared uniformly; (b) image smeared uniformly and noisy (d = 0.005); (c) image filtered from noise using modmed.m; (d) FT (spectrum) in modulus; (e) image restored by the FT and TR method.
Computers 09 00030 g010

Share and Cite

MDPI and ACS Style

Sizikov, V.; Dovgan, A.; Lavrov, A. Eliminating Nonuniform Smearing and Suppressing the Gibbs Effect on Reconstructed Images. Computers 2020, 9, 30. https://doi.org/10.3390/computers9020030

AMA Style

Sizikov V, Dovgan A, Lavrov A. Eliminating Nonuniform Smearing and Suppressing the Gibbs Effect on Reconstructed Images. Computers. 2020; 9(2):30. https://doi.org/10.3390/computers9020030

Chicago/Turabian Style

Sizikov, Valery, Aleksandra Dovgan, and Aleksei Lavrov. 2020. "Eliminating Nonuniform Smearing and Suppressing the Gibbs Effect on Reconstructed Images" Computers 9, no. 2: 30. https://doi.org/10.3390/computers9020030

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop