Analysis Spectral Method
Analysis Spectral Method
Analysis Spectral Method
Imaging
Article
A New Pseudo-Spectral Method Using the Discrete
Cosine Transform
Izumi Ito
Information and Communications Engineering, Tokyo Institute of Technology, Tokyo 152-8552, Japan;
[email protected]; Tel.: +81-3-5734-2997
Received: 9 February 2020; Accepted: 24 March 2020; Published: 28 March 2020
Abstract: The pseudo-spectral (PS) method on the basis of the Fourier transform is a numerical
method for estimating derivatives. Generally, the discrete Fourier transform (DFT) is used when
implementing the PS method. However, when the values on both sides of the sequences differ
significantly, oscillatory approximations around both sides appear due to the periodicity resulting
from the DFT. To address this problem, we propose a new PS method based on symmetric
extension. We mathematically derive the proposed method using the discrete cosine transform
(DCT) in the forward transform from the relation between DFT and DCT. DCT allows a sequence to
function as a symmetrically extended sequence and estimates derivatives in the transformed domain.
The superior performance of the proposed method is demonstrated through image interpolation.
Potential applications of the proposed method are numerical simulations using the Fourier based PS
method in many fields such as fluid dynamics, meteorology, and geophysics.
Keywords: pseudo-spectral method; derivatives; discrete cosine transform; discrete sine transform
1. Introduction
The discrete cosine transform (DCT) and discrete sine transform (DST) have been extensively
studied, and they have played a crucial role in science and engineering for decades. For example,
DCT is used for standard image and video compression such as JPEG and MPEG. DST is adopted
for high efficiency video coding (HEVC). DCT and DST are closely related to the discrete Fourier
transform (DFT) [1–3]. All the relevant transforms assume the periodicity of sequences. DFT assumes
circular periodicity, where the left side of a sequence is placed next to the right side, while DCT
and DST assume symmetric circular periodicity, where after a sequence is extended symmetrically,
circular periodicity ensues. There are four types of DCT and DST (Types 1, 2, 3, and 4) corresponding
to different types of symmetry. As is well known, DCT Type 2 (DCT-2) is employed for JPEG and
MPEG, and DCT Type 3 is the inverse transform of DCT-2. Some applications use several types of DCT
and DST, while others just use one type [4,5].
Pseudo-spectral (PS) methods originated from [6,7] and have been studied for solutions of
partial differential equations [8]. The numerical solution is obtained via a finite set of expansion
functions. Generally, for periodic problems, the Fourier series is used as expansion functions, while for
non-periodic problems, orthogonal polynomials (e.g., Jacobi polynomials) are used. Legendre and
Chebyshev polynomials are special cases of Jacobi polynomials, in which derivatives are obtained at
unequally spaced points, such as Legendre–Gauss–Lobatto points and Chebyshev–Gauss–Lobatto
points (also referred to as Chebyshev points) [9–11]. Different expansion functions for PS methods are
chosen depending on the problems of applications. The PS method using Fourier series as expansion
functions is employed for estimating derivatives at equally spaced points, which is common in fluid
dynamics [12,13], meteorology, and geophysics, e.g., a direct numerical simulation for a turbulent
flow [14], wave prediction [15], multibody modeling of wave energy converters [16], and seismogram
simulation [17]. Generally, DFT is used for the PS method, and in periodic functions, approximations by
the PS method using DFT (PS-DFT) are much more accurate than those by finite difference methods [18].
Moreover, the use of the fast Fourier transform (FFT) accelerates the process. However, conversely, use
of DFT/FFT is problematic due to circular periodicity. If the values on both sides of sequences differ
significantly, oscillatory approximations are observed around both sides, which is already well known
as the Gibbs phenomenon.
Image interpolation by Hermite polynomials is a good example to understand the accuracy of
derivatives. It requires pixel intensities and their derivatives that affect the accuracy of interpolation,
where there is room for the choice of methods for calculating derivatives [19,20]. The combination
with PS-DFT has been shown to outperform conventional interpolation methods such as bicubic and
Lanczos in terms of both accuracy and speed [21]. However, it has not hitherto touched on the adverse
effects by PS-DFT.
In the present paper, we study PS methods based on symmetric extension to address the problem
of the Gibbs phenomenon induced by PS-DFT in image interpolation. We are motivated by the seminal
work [21] combining Hermite polynomials with PS-DFT for image interpolation. We focus on the
symmetric extension of a sequence in the spatial domain, which attenuates the difference in values
at both sides for suppressing the Gibbs phenomenon. The DCT can enable sequences to function as
symmetrical extended sequences. We mathematically derive two types of PS methods using DCT
from the relation between DFT and DCT. We evaluate the proposed methods through combining with
Hermite polynomials for image interpolation. The results testify to the efficacy of the PS method based
on symmetric extension. This paper thus extends earlier results available in the literature [22].
The remainder of the paper is organized as follows. In Section 2, we provide preliminaries in the
form of relevant definitions. We present and derive two PS methods based on symmetric extension in
Section 3. Our evaluations of image interpolation are detailed in Section 4. Finally, conclusions are put
forward in Section 5.
Notations: Let Z and R be the sets of integers and real numbers, respectively. Sequences and
signals in the time domain are represented as lower case letters, and their coefficients in the transformed
domain are denoted as upper case letters. The operator T −1 indicates an inverse transform that assigns
a sequence in the transformed domain to a corresponding sequence in the time domain. The derivatives
of x (n) with respect to n are represented as x 0 (n). We use an asterisk to denote the complex conjugate,
i.e., X ∗ (k ) is the complex conjugate of X (k).
2. Preliminaries
First, we provide the definitions of the relevant transforms and their relations. Then, we briefly
describe the PS method using DFT.
and:
N −1
1
x (n) =
N ∑ −nk
X (k)WN (2)
k =0
√
respectively, where WN = exp(− j2π/N ) and j = −1.
J. Imaging 2020, 6, 15 3 of 14
N −1
πkn
XC1 (k) = 2 ∑ α(n) x (n) cos
N−1
(3)
n =0
where:
(
1/2, n = 0, N − 1
α(n) = . (4)
1, otherwise
N −1
r
πk(n + 1/2)
2
XC2 (k ) = β(k) ∑ x (n) cos (5)
N n =0
N
where:
( √
1/ 2, k=0
β(k) = . (6)
1, otherwise
Note that the inverse DCT-1 corresponds to DCT-1 and that the inverse DCT-2 corresponds to DCT
Type 3.
x(n)
x̂1 (n)
(a) DCT-1
x(n)
x̂2 (n)
(b) DCT-2
Figure 1. Original sequence and symmetrically extended sequence.
J. Imaging 2020, 6, 15 4 of 14
The symmetrically extended sequence, x̂1 (n), for DCT-1 from x (n), as shown in Figure 1a,
is given as:
(
x (n) n = 0, 1, . . . , N − 1
x̂1 (n) = . (7)
x (2N − 2 − n) n = N, N + 1, . . . , 2N − 3
The relation between DFT coefficients and DCT-1 coefficients is expressed for k = 0, 1, · · · , N − 1 as:
where X̂1 (k) is the DFT coefficients of x̂1 (n) and XC1 (k) is the DCT-1 coefficients of x (n).
The symmetrically extended sequence, x̂2 (n), for DCT-2, as shown in Figure 1b, is given from
x (n) as:
(
x (n) n = 0, 1, . . . , N − 1
x̂2 (n) = . (9)
x (2N − n − 1) n = N, N + 1, . . . , 2N − 1
The relation between DFT coefficients and DCT-2 coefficients is expressed for k = 0, 1, . . . , N − 1 as:
√ 1 −k/2
X̂2 (k) = 2N X (k)W2N (10)
α(k) C2
where X̂2 (k) is the DFT coefficients of x̂2 (n) and XC2 (k) is the DCT-2 coefficients of x (n).
Thus, DCTs can enable sequences to behave as symmetrically extended sequences without the
manual extension of symmetry.
N −1
∂ 1 j2πk
x 0 (n) =
∂n
x (n) =
N ∑ N
−nk
X (k)WN . (12)
k =0
Observe that the DFT coefficient, X 0 (k), of x 0 (n) is given in (12) as:
j2πk
X 0 (k) = X ( k ). (13)
N
Note that the coefficients X 0 (k) require complex conjugate symmetry so that x 0 (n) are real numbers.
Therefore, we can obtain the derivatives by the inverse DFT from the coefficients multiplying
the DFT coefficients of the original sequence by the factors with respect to k. The steps involved in
implementing PS-DFT are summarized as follows.
J. Imaging 2020, 6, 15 5 of 14
1. N-point DFT is applied to the sequence of length N to obtain X (k) according to (1).
2. X (k) is multiplied by j2πk/N to obtain X 0 (k) according to (13).
3. The inverse DFT is applied to X 0 (k) according to (2).
1 M−1 πk
πnk
M k∑
=− X (k) sin . (19)
=1
M C1 M
Therefore, we define the PS method using DCT-1 in the forward transform as PS-DCT1 together with
−1
the inverse transform, T PS − DCT1 , given by:
N −2
h i 1 πnk
−1
x̂ 0 1 (n) = T PS 0
− DCT1 XC1 ( k ) = − N −1 ∑ XC0 1 (k) sin
N −1
(20)
k =1
where:
πk
XC0 1 (k) = X ( k ). (21)
N − 1 C1
−1
Note that T PS − DCT1 corresponds to a sign inverted DST Type 1 (DST-1).
J. Imaging 2020, 6, 15 6 of 14
N −1
1 jπk −k jπk k
x̂20 (n) = √ ∑
2N k=0 N
−kn
XC2 (k)W2N2 W2N −
N
XC2 (k)W2N
2 kn
W2N (26)
2 N −1 πk
r
πk(n + 1/2)
N k∑
=− X (k) sin . (27)
=0
N C2 N
Therefore, we define the PS method using DCT-2 in the forward transform as PS-DCT2 together with
−1
the inverse transform, T PS − DCT2 , given by:
N −1
r
πk(n + 1/2)
h i 2
x̂ 0 2 (n) = −1
T PS − DCT2 XC0 2 (k) =−
N ∑ XC0 2 (k) sin
N
(28)
k =0
where:
πk
XC0 2 (k) = X ( k ). (29)
N C2
−1
Note that T PS − DCT2 corresponds to a sign inverted DST Type 2 (DST-2).
1. DCT-1/DCT-2 is applied to a sequence of length N to obtain XC1 (k)/XC2 (k) according to (3)/(5).
2. XC1 (k)/XC2 (k) is multiplied by a factor, πk/( N − 1) or πk/N, to obtain XC0 1 (k )/XC0 2 (k) according
to (21)/(29).
−1 −1 0 0
3. T PS − DCT1 / T PS− DCT2 is applied to XC1 ( k )/XC2 ( k ) according to (20)/(28).
N −1
r
πk (n + 1/2)
∂ 0 2
∂n
x̂ 2 (n) = −
N ∑ XC002 (k) cos
N
(30)
k =0
where:
2
πk
XC002 (k ) = XC2 (k). (31)
N
I I
f (t) = ∑ yi ai (t) + ∑ yi0 bi (t) (32)
i =0 i =0
where:
p 0 ( ti ) pi ( t ) pi ( t )
ai ( t ) = 1 − ( t − ti ) i , bi ( t ) = ( t − t i ) , (33)
pi ( ti ) pi ( ti ) pi ( ti )
p i ( t ) = ( t − t 0 )2 ( t − t 1 )2 · · · ( t − t i −1 )2 ( t − t i +1 )2 · · · ( t − t I )2 . (34)
when I = 1 (degree=3), f (t) in (32) requires two nodal values and two nodal derivatives nearest the
location t for estimating the value at t, which is referred to as cubic Hermite interpolation (CHI).
where g(n) and r (n) represent the ground truth sample and the final resulting sample, respectively.
All algorithms were implemented in MATLAB and run on a macOS system with a 2.3 GHz Intel Core
i5 and 8 GB memory.
J. Imaging 2020, 6, 15 8 of 14
Figure 2. A portion on the leftmost side of the final output after successive image translation of the
image “Barbara”. PS, pseudo-spectral; FD, forward difference; CLFD, central finite difference; CTFD,
compact finite difference.
Table 1. SNRs (dB) of the final output after successive image translation.
Figure 3. The absolute errors of the final output after successive image translation of the image
“Barbara”. CNS, cubic natural spline.
Next, we changed the evaluation area. Figure 4 shows the SNRs for each image when the
evaluated area was narrowed by m columns on each side of the image. It can be seen that the SNRs of
PS-DCT1, PS-DCT2, and PS-DFT increased significantly when m = 1 and then continued to increase
slowly for m > 1, while the SNRs of the other methods slightly increased when m = 1, then plateaued
for m > 1. The results imply that there are large adverse effects by PS-DCT1 and PS-DCT2 within
one column on both sides of the results. That is, we can obtain superior results by excluding only
one pixel at each side. Table 2 summarizes the SNRs of the final output when m = 1. Compared to
Table 1, the SNRs increased across all methods. Notably, the SNRs of PS-DCT1, PS-DCT2, and PS-DFT
increased significantly. PS-DCT2 performed best, except with respect to the image “LAX”.
Table 2. SNRs (dB) of the final output after successive image translation (m = 1).
Figure 4. SNRs of the final output when excluding m columns on both sides of the image.
significant differences among PS-DCT1, PS-DCT2, and PS-DFT. One reason for this was that the rotated
image for the next input in successive rotation was zero-padded so that the image should be square,
which attenuated the Gibbs phenomenon. Another reason was that errors were not concentrated in
one place, due to rotation.
Figure 5. A portion near the circumference of the final output after successive rotation of the image
“Lenna”.
Figure 6. The absolute errors of the final output after successive rotation of the image “Lenna”.
which were converted to operations in real numbers in which one multiplication of complex numbers
was converted to three multiplications and three additions according to Nakayama’s method [28] and
one addition of complex numbers was converted to two additions. Figure 7 shows the comparison of
the arithmetic operations based on Table 4.
We measured the execution time for image interpolation. All algorithms were executed on
a macOS system with a 2.3GHz Intel Core i5 and 8GB memory. A total of 12 images of size 256 × 256
were used. Table 5 summarizes the mean execution time for successive image translation and successive
image rotation. The proposed methods ran slightly more slowly than PS-DFT, but the execution time
was acceptable. Together with the above qualities, the results testified to the efficacy of the proposed
methods.
Table 3. SNRs (dB) of the final output after successive image rotation.
Table 4. Arithmetic operations for PS-DCT1, PS-DCT2, and PS-DFT in real numbers.
Table 5. Mean execution time (s) for successive image translation and successive image rotation. CHI,
cubic Hermite interpolation.
5. Conclusions
We proposed PS methods based on symmetric extension to attenuate the oscillatory approximation
that occurs with DFT. Using DCT, derivatives can be estimated in the transformed domain with
sequences behaving as symmetrically extended sequences without a manual extension of symmetry.
We derived two PS methods, PS-DCT1 and PS-DCT2, from the relation between DFT and DCT.
Through image interpolation by Hermite polynomials, we showed that the proposed methods
outperform PS-DFT. DCT can be calculated in real numbers rather than in the complex numbers
that are required for DFT. Moreover, DCT has fast algorithms, as well as DFT. Therefore, the proposed
methods are advantageous in terms of accuracy and validity compared to PS-DFT.
The potential applications of the proposed method are numerical simulations/modeling using
the Fourier based PS method to solve several equations in many fields such as fluid dynamics,
meteorology, and geophysics. Furthermore, the proposed method may be applicable to numerical
methods where the Fourier based PS method has not been used before, such as those relevant to sensor
networks and radar imaging [29–31]. The future work of this paper will study potential applications
with numerical analysis.
References
1. Rao, K.R.; Yip, P. Discrete Cosine Transform; Academic Press. Inc.: Boston, MA, USA, 1990.
2. Martucci, S.A. Symmetric convolution and the discrete sine and cosine transforms. IEEE Trans. Signal Process.
1994, 42, 1038–1051. [CrossRef]
3. Reeves, R.; Kubik, K. Shift, scaling and derivative properties for the discrete cosine transform. Signal Process.
2006, 86, 1597–1603. [CrossRef]
4. Long, B.; Reinhard, E. Real-time fluid simulation using discrete sine/cosine transforms. IEEE Trans. Pattern
Anal. Mach. Intell. 2001, 23, 643–660.
5. Bhat, P.; Curless, B.; Cohen, M.; Zitnick, C.L. Fourier analysis of the 2D screened poisson equation for
gradient domain problems. In European Conference on Computer Vision; ECCV Part II LNCS; Springer:
Berlin/Heidelberg, Germany, 2008; Volume 5303, pp. 114–128.
6. Kreiss, H.-O.; Oliger, J. Comparison of accurate methods for the integration of hyperbolic equations. Tellus
1972, 24, 199–215. [CrossRef]
7. Orzag, S.A. Comparison of pseudospectral and spectral approximation. Appl. Math. 1972, L1, 253–259.
[CrossRef]
8. Fornberg, F. A Practical Guide to Pseudospectral Methods; Cambridge University Press: Cambridge, UK, 1998.
9. Elnagar, G.N.; Kazemi, M.A.; Razzaghi, M. The pseudospectral Legendre method for discretizing optimal
control problems. IEEE Trans. Autom. Control 1995, 40, 1793–1796. [CrossRef]
J. Imaging 2020, 6, 15 14 of 14
10. Fahroo, F.; Ross, I.M. Costate estimation by a Legendre pseudospectral method. J. Guidance Control Dyn.
2001, 24, 270–277. [CrossRef]
11. Elnagar, G.N.; Kazemi, M.A. Pseudospectral Chebyshev optimal control of constrained nonlinear dynamical
systems. Comput. Optim. Appl. 1998, 11, 195–217. [CrossRef]
12. Roache, P.J. A pseudo-spectral FFT technique for non-periodic problems. J. Comput. Phys. 1978, 27, 204–220.
[CrossRef]
13. Canuto, C.; Hussaini, M.Y.; Quarteroni, A.; Zang, T.A. Spectral Methods in Fluid Dynamics; Springer: New York,
NY, USA, 1988.
14. Takata, M.; Yamamoto, Y.; Shouno, H.; Kunugi, T.; Joe, K. Parallelization and evaluation of a direct numerical
simulation for a turbulent flow using pseudo spectral method. IPSJ J. 2003, 44, 45–54. (In Japanese)
15. Yoon, S.; Kim, J.; Choi, W. An explicit data assimilation scheme for a nonlinear wave prediction model based
on a pseudo-spectral method. IEEE J. Ocean. Eng. 2016, 41, 112–122.
16. Paparella, F.; Bacelli, G.; Paulmemo, A.; Mouring, S.E.; Ringwood, J.V. Multibody modelling of wave energy
converters using pseudo-spectral methods with application to a three-body hinge-barge device. IEEE Trans.
Sustain. Energy 2016, 7, 966–974. [CrossRef]
17. Das, S.; Chen, X.; Hobson, M.P. Fast GPU-based seismogram simulation from microseismic events in
marine environments using heterogeneous velocity models. IEEE Trans. Comput. Imaging 2017, 3, 316–329.
[CrossRef]
18. Smith, G.D. Numerical Solution of Partial Derivative Equations: Finite Difference Methods; Oxford University
Press: Oxford, UK, 1986.
19. Szegö, G. Orthogonal Polynomials; American Mathematical Society: Providence, RI, USA, 1939.
20. Seta, R.; Okubo, K.; Tagawa, N. Digital image interpolation method using higher-order Hermite interpolating
polynomials with compact finite-difference. In Proceedings of the 2009 APSIPA Annual Summit and
Conference, Sapporo, Japan, 4–7 October 2009.
21. Takamiya, K.; Okubo, K.; Tagawa, N. High accuracy image interpolation method combining higher-order
Hermite interpolation with pseudo spectral method. IEICE Trans. Commun. 2012, J95-Bo.2, 355–365. (In
Japanese)
22. Ito, I. Pseudo spectrum method based on symmetric extension. In Proceedings of the 7th European Workshop
on Visual Information Processing, Tampere, Finland, 26–28 Novober 2018; p. 29.
23. Oppenheim, A.V.; Schafer, R.W.; Buck, J.R. Discrete-Time Signal Processing; Prentice Hall: New Jersey, NJ,
USA, 1999.
24. Lele, S.K. Compact finite difference schemes with spectral-like resolution. J. Comput. Phys. 1992, 103, 16–42.
[CrossRef]
25. Standard Image Data BAse. Available online: http://www.ess.ic.kanagawa-it.ac.jp/app_images_j.html
(accessed on 27 March 2020).
26. Wang, Z. Fast algorithms for the discrete W transform and for the discrete Fourier transform. IEEE Trans.
Accoust. Speech Signal Process. 1984, 32, 803–816. [CrossRef]
27. Nussbaumer, H.J. Fast Fourier Transform and Convolution Algorithms; Springer: Berlin, Germany, 1982.
28. Nakayama, K. A new discrete Fourier transform algorithm using butterfly structure fast convolution.
IEEE Trans. Acoust. Speech Signal Process. 1985, ASSP-33, 1197–1208. [CrossRef]
29. Rossi, P.S.; Ciuonzo, D.; Ekman, T.; Dong, H. Energy detection for MIMO decision fusion in underwater
sensor networks. IEEE Sens. J. 2014, 15, 1630–1640. [CrossRef]
30. Devaney, A.J.; Marengo, E.A.; Gruber, F.K. Time-reversal-based imaging and inverse scattering of multiply
scattering point targets. J. Acoust. Soc. Am. 2005, 118, 3129–3138. [CrossRef]
31. Ciuonzo, D. On time-reversal imaging by statistical testing. IEEE Signal Process. Lett. 2017, 24, 1024–1028.
[CrossRef]
c 2020 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access
article distributed under the terms and conditions of the Creative Commons Attribution
(CC BY) license (http://creativecommons.org/licenses/by/4.0/).