1. Introduction
Fast Fourier transform (FFT) provides a means for frequency analysis and filtering, avoiding the operation of convolution. The quantum version of Fourier transform (QFT) provides an opportunity to quickly obtain the results derived by FFT. The use of QFT has been investigated for various applications. Accordingly, in [
1], it is proved that a quantum version of the filtering operation can be achieved, even though the quantum convolution of two sequences is physically impossible. There are important differences between classical and quantum implementations for image filtering. These differences are analyzed in [
1], and it is shown that the major advantage of the quantum approach lies in the exploitation of the efficient implementation of QFT. A common approach to image filtering is to convolve the image with a filter function, which in the frequency domain translates into a multiplication operation. However, there are classical processing operations that cannot be directly applied to quantum images, such as convolution and correlation [
2]. In [
3], a survey is provided with some topics on the properties of quantum gates and their assembly into interesting quantum circuits. The role of reversibility in the theory of computation and an early discussion of gate and circuit constructions in reversible computation are also provided.
The application of QFT within the field of quantum computation has been extensively presented in [
4]. Shor’s algorithm, phase estimation, and computing discrete logarithms are some classic examples of its use. These special properties of quantum algorithms have resulted in novel solutions to problems difficult to be solved on a classical computer. QFT has been used in several applications [
5,
6,
7]. Since QFT is the core to a lot of quantum algorithms, current research mainly focuses on its effective realization [
7,
8,
9,
10,
11,
12,
13]. These studies discuss quantum information issues [
7], approximate QFT and decoherence [
8], Shor’s algorithm [
9,
10], QFT for phase estimation [
11], and quantum circuitry [
12,
13]. Quantum edge detection is carried out in [
14] based on double-chain quantum genetic algorithms. Hybrid quantum-classical networks for image generation are proposed in [
15].
A review of quantum image processing is presented in [
16], revealing the possibilities for intensive image-processing procedures due to the powerful parallel computing capabilities of quantum computers. In [
17], a quantum implementation of the FFT algorithm composed of a combination of quantum gates is proposed. QFT is implemented in [
18] on a 3-qubit nuclear magnetic resonance (NMR) quantum computer to extract the periodicity of an input state. A fast quantum image component-labeling algorithm is proposed in [
19], which is the quantum counterpart of the classical local operator technique. A quantum color image encryption algorithm is designed in [
20] based on geometric transformation and intensity channel diffusion. A framework of quantum image filtering in the spatial domain is proposed in [
21]. A quantum image median filtering approach is proposed and its corresponding quantum circuit is designed in [
22]. The main idea of the approach is that first, the classical image is converted into a quantum version based on the novel enhanced quantum representation (NEQR) of digital images, and then, a unique quantum module is designed to realize the median calculation of neighborhood pixels for each pixel point in the image. In [
23], the authors consider QFT-based color-image-filtering operations and their applications in image smoothing, sharpening, and selective filtering using quantum frequency domain filters. The proposed quantum filters use the principle of quantum oracles to implement the filter function.
The 3D FFT technique is useful in numerous physical problems. Four of these problems are listed next in order to provide the reader with a sense of the potential applicability of QFT. First-principles methods based on density functional theory (DFT) where the wave functions are expanded in plane waves (Fourier components) are the most widely used approaches for electronic structure calculations in materials science [
24]. The scaling of this method depends critically on having an efficient parallel 3D FFT that minimizes communications and calculations. First-principles methods based on DFT in the Kohn–Sham (KS) [
25] formalism are the most widely used approaches for electronic structure calculations in materials science. The most common implementation of this approach involves the expansion of the wave functions in plane waves (Fourier components) and the use of pseudopotentials to replace the nucleus and core electrons. In this implementation, parallel 3D FFT is required to transform the electronic wave functions from Fourier space to real space in order to construct the charge density. The 3D Fourier forward modeling of 3D density sources is capable of providing 3D gravity anomalies coinciding with the meshed density distribution within the whole source region [
26]. Forward modeling of potential fields’ anomalies is essential for geophysical interpretation and inversion. An implicit split-operator FFT algorithm for the numerical solution of the time-dependent Schrodinger equation is implemented for the electronic structure of
and
in [
27]. In this article, an algorithm appropriate for 3D applications is implemented that is implicit and thus overcomes the difficulty of the non-conservation of energy.
The tracking and isolation of moving objects with a specific range of speed are a challenging research topic in the field of automotive application [
28,
29,
30,
31]. To cope with this issue, velocity filters have been used in the past for localizing and monitoring moving objects in image sequences or otherwise 3D imagery [
32,
33,
34]. Filter banks are used for fast implementation of the localization and monitoring of moving vehicles. These banks are built using 3D FFT to perform directional filtering [
28,
29,
30,
31,
32,
33,
34,
35].
In this work, the way that basic quantum circuits are combined to build up the QFT structure is extensively presented. This structure is applied in the well-known separable procedure in order to implement 3D QFT. This way, the 3D spectral content of the data cube is evaluated. A quantum oracle is used for isolating the necessary frequency components in the 3D spectral cube that correspond to the required trajectory. In fact, a variety of quantum oracles are represented by the quantum filter used in order to realize the necessary filter bank. Inverse QFT (IQFT) is applied at the output of the quantum oracle to obtain the final result with the isolated moving object (trajectory). The implementation of velocity filters by means of the quantum version of 3D FFT results in fast filtering procedures, which are necessary for discriminating objects’ velocities. QFT can calculate the Fourier transform of a vector of size N with time complexity
compared to the classical complexity of
[
36]. However, if one wants to measure the full output state, then the QFT complexity becomes
, thus losing its apparent advantage, indicating that the advantage is fully exploited for algorithms when only a limited number of samples is required from the output vector, as is the case in many quantum algorithms. Accordingly, for a signal of 1024 samples, QFT requires operations of the order of 100, while classical FFT requires operations of the order of 10,000.
The paper is organized in the following way. In
Section 2, the quantum theory for supporting QFT is presented. The velocity filtering approach is provided in
Section 3. In
Section 4, the use of QFT for implementing velocity filters is analyzed. Experimental results are presented in
Section 5. Finally, conclusions are drawn in
Section 6.
3. Theory of Velocity Filtering
Studies [
28,
29] have carried out velocity filtering using filter banks created using conventional FFT, and simultaneously, they are selected by means of the specific spectral content required. In this work, all necessary spectral quantities are evaluated using QFT for radically accelerating the mathematical calculations. A bank of velocity filters [
28] is necessary for separating multiple objects with different velocities in a sequence of frames. In [
28], the 3D FFT transformation of a large number of objects with a variety of different velocities is applied. The proposed approach is based on experimentation and avoids using theoretical concepts. Accordingly, in this study, an object moving each time with a different velocity and in various directions was used in order to construct a filter bank. Multiple moving objects can be isolated from other objects with different velocities or from objects with the same amplitude of velocity but having different directions. The simulated datasets that were used in order to create the spectral signatures of different moving objects consisted of 256 frames of 256 × 256 pixels each. Accordingly, a data cube (shown in
Figure 2) was formed of 256
3 pixels. The number 256 = 2
8 was selected to fit the FFT requirements for fast evaluation of the 3D spectrum.
The time parameter is considered the distance from frame to frame. Based on this, the amplitude of the radial velocity of each object is referred to as the number of pixels it comes across from one frame to the next. A simple example of one object of size 10 × 10 pixels that is moving with a radial velocity of 1/3 pixels per frame is shown in
Figure 3. The object is moving in the direction of 340 degrees with respect to the horizontal left-to-right direction. Four different frames are given, i.e., the 1st, 64th, 128th, and 256th.
The datasets used for experimentation covered a wide range of velocities with regard to the amplitude and direction. Specifically, six different radial velocities (amplitudes) were selected, i.e., 1/2 (fast), 1/3, 1/4, 1/8, 1/16, and 1/32 (slow) pixels per frame. For all these velocities, 24 different directions were chosen, with the first one at 0 degrees (horizontal direction from left to right) and counterclockwise every 15 degrees, as shown in
Figure 4. Accordingly, a total of 6 × 24 = 144 different data cubes (velocities) were implemented.
Since the spectrum is a complex quantity, its amplitude and phase were evaluated separately. Parallel trajectories in the data cube that correspond to objects having the same velocity possess the same spectral amplitude information and differ in the phase information. Accordingly, regardless of the initial position of an object, its velocity corresponds to a specific amplitude of the spectral content. Thus, only the amplitude information is of interest and was recorded.
Studying the amplitude of the spectral content of a data cube, one can easily observe that from the total of 2563–224–16 million harmonics, only a small percentage has significant value. Thus, for each direction of the moving object with a specific velocity, a file that contained the positions of the most important harmonics (about 4000) was created, as those spectral components that are larger than the 12% (pixel value 30 with maximum 255) of the biggest spectral component are considered important harmonics.
However, later, when it is necessary to process complicated signals, the 20 largest harmonics among the 4000 will be recalled and their use in the final filter will be examined again. This is needed when in the signal to be processed, the vehicle to be recorded is not among the strongest objects.
To isolate an object moving with a specific velocity (velocity filtering) among other objects in a data cube, we need to perform the following steps:
1. Find the spectral content of the specific cube 3D FFT.
2. Eliminate from the spectral amplitude all harmonics except those corresponding to the specific velocity.
3. Evaluate the inverse 3D FFT to recover the data cube containing only the object with the specific velocity.
4. Implementation of Velocity Filtering Using QFT
4.1. Three-Dimensional Discreet Fourier Transform
The 3D discreet Fourier transform technique is a separable procedure. This comes from the fact that its expression
can be written as follows:
The first summation on the right of this equation means that we must perform N2 N-point discreet Fourier transforms along the n3 direction. Since each N-point FFT (for N being a power of 2) requires N log2 N operations, for the implementation of the first summation of Equation (17), N3 log2 N operations are needed. The derived intermediate result is an N3 complex cube to be again processed along the n2 direction. Thus, another set of N3 log2 N complex operations is required. The second derived intermediate result is again an N3 complex cube to be finally processed along the n1 direction. Thus, a total of 3N3 log2 N of complex operations are required. Following another way, we must perform N-point FFT along all horizontal lines, all horizontal columns, and all vertical columns regardless of the order in which they will be performed.
An example of 3D FFT is shown in
Figure 5 for N = 4. From this figure and Equation (17), it is evident that the order of implementation of the 1D transforms, i.e., the order of the summations in Equation (17), does not matter. In image cubes (frame sequences), one of the dimensions is usually time.
4.2. Quantum 3D Fast Fourier Transform
A quantum cube can be represented using a quantum register Q constructed so that it encodes all required information, i.e., the position of a pixel in the frame (x, y), the serial number of the frame (time t), and the intensity or color (c) of the pixel [
24]. We assumed that we have 2
k frames with 2
n × 2
n pixels each and that the color of each pixel requires m bits for its color representation. In this case, a register |P > having 2
n qubits is adequate for holding all position information, another register |T> having k qubits will represent the time information, and a register |C > with m qubits will represent 2
m different colors or grayscale levels. The register |P > is separated into two sub-registers of n qubits each containing the row and column information in the form |y > |x >. The quantum register Q containing all the information about the quantum frame cube can be expressed as
In Equation (18), the coefficients
aijt for a specific t (frame of the cube) sum up to 1:
and are used to express the color of a pixel with position
i by means of a superposition of all possible colors. For a given pixel
i, the coefficients
aij take the value of 1 if the color of the pixel is j and 0 otherwise. This is illustrated in
Figure 6 with a simple example of a 2 × 2 × 2 frame cube with eight colors (0–7). The corresponding coefficients
aijt for the specific examples in
Figure 6 are as follows:
In case we assume the time register |T> as being the third dimension in our pixel cube representation without distinction between time and space (such data are available in various cases, such as computed tomography), and furthermore, k equals n, then Equation (18) becomes
In Equation (19), the coefficients
aij sum up to 1:
and are used to express the color of a pixel with position
i by means of a superposition of all possible colors. For a given pixel
i, the coefficients
aij take the value of 1 if the color of the pixel is j and 0 otherwise:
This is illustrated in
Figure 7 with a simple example of a 2 × 2 × 2 frame cube with eight colors (0–7).
The quantum register Q, expressed using Equation (18), was experimentally implemented by the circuit in
Figure 8. It is in fact the quantum circuit that implements 3D velocity filtering.
As shown in
Figure 8, at the output of the proposed quantum velocity filtering circuit, we find the input image cube. Additionally, exploiting the quantum interference phenomenon, we can use an additional qubit initially in state |0> to reinterpret the quantum image cube as a superposition of two image cubes. For example, for a high-pass or a low-pass 3D filter, the output image is the sum of the image cube containing high frequencies and the image cube containing the corresponding low frequencies. The additional qubit can be used to make the distinction between the two image cubes.
Next, we analyzed this process and described the state of the quantum velocity filtering circuit at each step of the computation, as marked in
Figure 8. With respect to Equation (18), the register |P> having 2n qubits and holding all position information is represented in the following Equation (21), with two registers of n qubits each corresponding to x and y positions, respectively. The input state
is represented by the input image cube and an additional qubit in state
:
where
holds the quantum image cube using the representation described previously. Applying 3D QFT on the image cube produces state
:
where
I and
Im denote the identity operator on 1 and m qubits, respectively.
The next step performed by the quantum circuit is the equivalent of the classical filtering step. The state of the register holding the image cube does not in fact change to a state representing the filtered image cube, but rather, it undergoes an interference process with the additional qubit initially in state . This is achieved using a quantum oracle built using the filter function H(l, k, p).
The quantum state is a superposition of two states, a state representing the 3D frequencies that remain in the image cube and a state representing the 3D frequencies removed. Applying the oracle operator UH to this superposition, one can use the additional qubit to make the distinction between the two states. The oracle UH acts only on the position qubits and leaves the color qubits unaffected. Different choices of the filter H(l, k, p) result in different selections of 3D velocity filters. So, the resulting can be the input to IQFT.
The last computational step in the quantum circuit in
Figure 8 represents the IQFT that reverts from the frequency to the spatial representation of the image cube. The final state of the circuit contains the superposition of two quantum image cubes: the image cube containing the frequencies passed by the 3D filter and the image cube containing the frequencies suppressed by the 3D filter. The distinction between these two image cubes can be made using the additional qubit
. In fact, it can be interpreted as [
1]
For extracting necessary information from the quantum-transformed image, a further processing step must be performed [
1].
4.3. QFT Performance Versus FFT Performance
The computational performance of QFT is discussed in this subsection with regard to its superiority when compared to the computational performance of FFT. The required number of quantum gates is calculated, and a simple demonstration of their simplicity is presented with regard to the first simple necessary quantum gates. Note that the matrix in Equation (5) also implements classical FFT and performs the multiplication of the QFT matrix by the N × 1 column vector that contains the classical dataset. This multiplication would require N2 operations. Therefore, we would expect classical discreet Fourier transform to require O(N2) = O(22n) operations, which is exponential in n. The classical FFT algorithm can compute discreet Fourier transform in O(N log N) or O(n2n) operations, which is faster but still exponential in n.
However, QFT uses operation gates for its implementation. According to
Figure 1, the number of operation gates used can be evaluated as follows:
1st row: 1 H gate + (n − 1)R gates = n gates
2nd row: 1 H gate + (n − 2)R gates = n − 1 gates
.
.
.
(n − 1)th row: 1 H gate + 1 R gate = 2 gates
n-th row: 1 H gate = 1 gate
Adding the gate count from each row gives n + (n − 1) + (n − 2) +··· + 1, or O(n2), gates, which is polynomial in n. Therefore, QFT is exponentially faster than discreet Fourier transform or FFT.
Furthermore, classical FFT (corresponding to 2 qubits, N = 4) in matrix form is
where
is
and we replace
. Equation (25) can be written as the product of two sparse matrices
where
and
QFT is generated by matrix U and can be written as the product of four sparse matrices (the swap gate, the Hadamard gates (2 gates), and the controlled phase gate) as follows:
Hadamard gate for the lower qubit
Hadamard gate for the upper qubit
As shown, the sparse matrices of QFT are simpler than the classical matrices of FFT without dynamics. So, the calculations in QFT are simpler and faster. Similarly, in classical FFT (3 qubits, n = 8), we have three sparse matrices, and in QFT, we have seven simpler sparse matrices, so the calculations are also faster.
Accordingly, for the N-qubit registers in QFT, a significant reduction is achieved in the required operations since all matrices involved in its evaluation are sparse. In the implementation of the example of
Section 5.2, the execution time of conventional FFT was 200.63 s, while QFT implementation was carried out in 16.2 s.
6. Conclusions
The quantum version of 3D FFT was presented analytically in this work, emphasizing the detailed explanation of its application to a specific example of a data cube coming from an ordinary video. The form of the development of 3D QFT has an important tutorial character. Simultaneously, it constitutes an important technical utility for isolating objects that are moving at speeds within certain limits. This utility can be used for numerous applications.
A filter bank was built having a series of quantum filter functions that differ in their filtering capabilities with regard to the velocity of the object as well as its direction. The filter function is selected based on the properties of the object that is to be isolated.
The performance of the quantum circuit in
Figure 8 is effective since the object with the specific velocity (white car at the bottom of the scene moving from left to right in
Figure 14,
Figure 15 and
Figure 16) is totally isolated as the spectral signature of its trajectory (
Figure 17e) is embodied as the operational content of the quantum oracle U
H. Simultaneously, other cars with the same velocity are also isolated and brought to the foreground in the final scene.
Specific quantum velocity filtering techniques were not found in the literature for comparisons to be carried out. However, our approach was based on [
28] only with regard to the organization of the filter bank. Its superiority in performing fast calculations for isolating objects with a specific velocity is clear.