Quantum Image Processing and Its Application to Edge Detection: Theory and Experiment

Processing of digital images is continuously gaining in volume and relevance, with concomitant demands on data storage, transmission and processing power. Encoding the image information in quantum-mechanical systems instead of classical ones and replacing classical with quantum information processing may alleviate some of these challenges. By encoding and processing the image information in quantum-mechanical systems, we here demonstrate the framework of quantum image processing, where a pure quantum state encodes the image information: we encode the pixel values in the probability amplitudes and the pixel positions in the computational basis states. Our quantum image representation reduces the required number of qubits compared to existing implementations, and we present image processing algorithms that provide exponential speed-up over their classical counterparts. For the commonly used task of detecting the edge of an image, we propose and implement a quantum algorithm that completes the task with only one single-qubit operation, independent of the size of the image. This demonstrates the potential of quantum image processing for highly efficient image and video processing in the big data era.

Processing of digital images is continuously gaining in volume and relevance, with concomitant demands on data storage, transmission and processing power. Encoding the image information in quantum-mechanical systems instead of classical ones and replacing classical with quantum information processing may alleviate some of these challenges. By encoding and processing the image information in quantum-mechanical systems, we here demonstrate the framework of quantum image processing, where a pure quantum state encodes the image information: we encode the pixel values in the probability amplitudes and the pixel positions in the computational basis states. Our quantum image representation reduces the required number of qubits compared to existing implementations, and we present image processing algorithms that provide exponential speed-up over their classical counterparts. For the commonly used task of detecting the edge of an image, we propose and implement a quantum algorithm that completes the task with only one single-qubit operation, independent of the size of the image. This demonstrates the potential of quantum image processing for highly efficient image and video processing in the big data era.

I. INTRODUCTION
Vision is by far the most important channel for obtaining information. Accordingly, the analysis of visual information is one of the most important functions of the human brain [1]. In 1950, Turing proposed the development of machines that would be able to "think", i.e. learn from experience and draw conclusions, in analogy to the human brain. Today, this field of research is known as artificial intelligence (AI) [2][3][4]. Since then, the analysis of visual information by electronic devices has become a reality that enables machines to directly process and analyze the information contained in images and stereograms, or video streams, resulting in rapidly expanding applications in widely separated fields like biomedicine, economics, entertainment, and industry (e.g., automatic pilot) [5][6][7]. Some of these tasks can be performed very efficiently by digital data processors, but others remain time-consuming. In particular, the rapidly increasing volume of image data as well as increasingly challenging computational tasks have become important driving forces for further improving the efficiency of image processing and analysis.
In this article, we demonstrate the basic framework of quan-arXiv:1801.01465v1 [quant-ph] 4 Jan 2018 tum image processing based on a different type of QImR, which reduces the qubit resources required for encoding an image. Based on this QImR, we experimentally implement several commonly used two-dimensional transforms that are common steps in image processing on a quantum computer and demonstrate that they run exponentially faster than their classical counterparts. In addition, we propose a highly efficient quantum algorithm for detecting the boundary between different regions of a picture: It requires only one single-qubit gate in the processing stage, independent of the size of the picture. We perform both numerical and experimental demonstrations to prove the validity of our quantum edge detection algorithm. These results open up the prospect of utilizing quantum parallelism for image processing.
The article is organized as follows. In Sec. II, we firstly introduce the basic framework of quantum image processing, then present the experimental demonstration for several basic image transforms on a nuclear magnetic resonance (NMR) quantum information processor. In Sec. III, we propose a highly efficient quantum edge detection algorithm, along with the proof-of-principle numerical and experimental demonstrations. Finally, in Sec. IV, we summarize the results and give a perspective for future work.

II. FRAMEWORK OF QUANTUM IMAGE PROCESSING
In Fig. 1, we compare the principles of classical and quantum image processing (QImP). The first step for QImP is the encoding of the 2D image data into a quantum-mechanical system (i.e.,QImR). The QIR model substantively determines the types of processing tasks and how well they can be performed. Our present work is based on a QImR where the image is encoded in a pure quantum state, i.e., encoding the pixel values in its probability amplitudes and the pixel positions in the computational basis states of the Hilbert space. In this section, we introduce the principle of QImP based on such a QImR, and then present experimental implementations for some basic image transforms, including the 2D Fourier transform, 2D Hadamard, and the 2D Haar wavelet transform.

A. Quantum image representation
Given a 2D image F = (F i,j ) M ×L , where F i,j represents the pixel value at position (i, j) with i = 1, . . . , M and j = 1, . . . , L, a vector f with M L elements can be formed by letting the first M elements of f be the first column of F , the next M elements the second column, etc. That is, Accordingly, the image data f can be mapped onto a pure quantum state |f = 2 n −1 k=0 c k |k of n = log 2 (M L) qubits, where the computational basis |k encodes the position (i, j) of each pixel, and the coefficient c k encodes the pixel value, i.e., c k = F i,j /( F 2 i,j ) 1/2 for k < M L and  c k = 0 for k ≥ M L. Typically, the pixel values must be scaled by a suitable factor before they can be written into the quantum state, such that the resulting quantum state is normalized. When the image data are stored in a quantum random access memory, this mapping takes O(n) steps [55]. In addition, it was shown that if c k and k |c k | 2 can be efficiently calculated by a classical algorithm, constructing the n-qubit image state |f then takes O[poly(n)] steps [56,57]. Alternatively, QImP could act as a subroutine of a larger quantum algorithm receiving image data from other components [41].
Once the image data are in quantum form, they could be postprocessed by various quantum algorithms [4]. In Appendix A, we discuss some other QImR models and make a comparison between the QImR we use and others.

B. Quantum image transforms
Here, we focus on cases where M L = 2 m × 2 l (an image with N = M L = 2 n pixels). Image processing on a quantum computer corresponds to evolving the quantum state |f under a suitable Hamiltonian. A large class of image operations is linear in nature, including unitary transformations, convolutions, and linear filtering (see Appendix C for details). In the quantum context, the linear transformation can be represented as |g =Û |f with the input image state |f and the output image state |g . When a linear transformation is unitary, it can be implemented as a unitary evolution. Some basic and commonly used image transforms (e.g., the Fourier, Hadamard, and Haar wavelet transforms) can be expressed in the form G = P F Q, with the resulting image G and a row (column) transform matrix P (Q) [5]. The corresponding unitary oper-atorÛ can then be written asÛ = Q T ⊗ P , where P and Q are now unitary operators corresponding to the classical operations. That is, the corresponding unitary operations of n qubits can be represented as a direct product of two independent operations, with one acting on the first l = log 2 L qubits and the other on the last m = log 2 M qubits.
The final stage of QImP is to extract useful information from the processed results. Clearly, to read out all the components of the image state |g would require O(2 n ) operations. However, often one is interested not in |g itself but in some significant statistical characteristics or useful global features about image data [41], so it is possibly unnecessary to read out the processed image explicitly. When the required information is, e.g., a binary result, as in the example of pattern matching and recognition, the number of required operations could be significantly smaller. For example, the similarity between |g and the template image |g (associated with an inner product g|g ) can be efficiently extracted via the SWAP test [58] (see Appendix D for a simple example of recognizing specific patterns).
Basic transforms are commonly used in digital media and signal processing [5]. As an example, the discrete cosine transform (DCT), similar to the discrete Fourier transform, is important for numerous applications in science and engineering, from data compression of audio (e.g., MP3) and images (e.g., JPEG), to spectral methods for the numerical solution of partial differential equations. High-efficiency video coding (HEVC), also known as H.265, is one of several video compression successors to the widely used MPEG-4 (H.264). Almost all digital videos including HEVC are compressed by using basic image transforms such as 2D DCT or 2D discrete wavelet transforms. With the increasing amount of data, the running time increases drastically so that real-time processing is infeasible, while quantum image transforms show untapped potential to exponentially speed up over their classical counterparts.
To illustrate QImP, we now discuss several basic 2D transforms in the framework of QIP, such as the Fourier, Hadamard, and Haar wavelet transforms [59][60][61]. For these three 2D transforms, P is the transpose of Q. Quantum versions for the one-dimensional Fourier transform (1D QFT) [62], 1D Hadamard, and the 1D Haar wavelet transform take time O[poly(m)], which is polynomial in the number of qubits m (see Appendix B for further details). However, corresponding classical versions take time O(m2 m ). When both input data preparation and output information extraction require no greater than O[poly(n)] steps, QImP, such as the 2D Fourier, Hadamard, and Haar wavelet transforms, can in principle achieve an exponential speed-up over classical algorithms. Figure 2 compares the different requirements on resources for the classical and quantum algorithms, in terms of the size of the register (i.e., space) and the number of steps (i.e., time).

C. Experimental demonstrations
We now proceed to experimentally demonstrate, on a nuclear spin quantum computer, some of these elementary image transforms. With established processing techniques [63,64], NMR has been used for many demonstrations of quantum information processing [47,62,65,66].
As a simple test image, we choose a 4 × 4 chessboard pattern whose encoding and processing require four qubits. We therefore chose iodotrifluoroethylene (C 2 F 3 I) as a 4-qubit quantum register, whose molecular structure and relevant properties are shown in Fig. 3(a). We label 19 F 1 , 19 F 2 , 19 F 3 , and 13 C as the first, second, third, and fourth qubit, respectively. The natural Hamiltonian of this system in the doubly rotating frame [67] is where ν j represents the chemical shift of spin j, and J jr is the coupling constant between spins j and r.  were carried out at 305 K on a Bruker AV-400 spectrometer in a magnetic field of 9.4 T. The input image preparation is illustrated in Fig. 3(b). Starting from the thermal equilibrium and using the lineselective method [68], we prepare the pseudopure state (PPS) ρ 0000 = |0000 0000| + [(1 − )/16]I 16 , where ≈ 10 −5 is the polarization and I 16 denotes the 16 × 16 unit operator. The operator U PPS1 equalizes all populations except that of the state |0000 , and a subsequent gradient field pulse destroys all coherences except for the homonuclear zero quantum coherences (ZQC) of the 19 F nuclei. A specially designed unitary operator U PPS2 is applied to the system and transforms these remaining ZQC to non-ZQC, which are then eliminated by a second gradient pulse. The resulting PPS has a fidelity of 98.4% defined by |tr(ρ th ρ expt )|/[tr(ρ 2 th )tr(ρ 2 expt )] 1/2 , where ρ th and ρ expt represent the theoretical and experimentally measured density matrices, respectively. The last operator U encode turns |0000 0000| into the image state ρ img = |f img f img |, which corresponds to the input image. The three unitary operations U PPS1 , U PPS2 , and U encode are all realized by gradient ascent pulse engineering (GRAPE) [69], each having theoretical fidelity of about 99.9%. For a 4 × 4 image, the three image transformation operators that we consider arê where the Haar, Fourier, and Hadamard matrices are and The corresponding quantum circuits and the actual pulse sequences in our experiments are shown in Figs. 3(c) and 4, respectively. Each unitary rotation in the pulse sequences is implemented through a Gaussian selective soft pulse, and a compilation program is employed to increase the fidelity of the entire selective pulse network [70]. The program systematically adjusts the irradiation frequencies, rotational angles, and transmission phases of the selective pulses, so that up to first-order dynamics, the phase errors and unwanted evolutions of the sequence are largely compensated [71]. The resulting fidelities for the π refocusing rotations range from 97.2% to 99.5%, and for the π/2 rotations from 99.7% to 99.9%. We use the GRAPE technique to further improve the control performance. The compilation procedure generates a shaped pulse of relatively high fidelity, which serves as a good starting point for the gradient iteration. So the GRAPE search quickly reaches a high performance. The final pulse has a numerical fidelity of ≈ 99.9%, after taking into account 5% rf inhomogeneity. The whole pulse durations of implementing the Haar, Fourier, and Hadamard transforms are 21.95, 19.86, and 3.81 ms, respectively. Since the isotropic composition of our sample corresponds to natural abundance, only ≈ 1% of the molecules contain a 13 C nuclear spin and can therefore be used as quantum registers. To distinguish their signal from that much larger background of molecules containing 12 C nuclei, we do not measure the signal of the 19 F nuclear spins directly, but transfer the states of the 19 F spins to the 13 C spin by a SWAP gate and read out the state information of the 19 F spins through the 13 C spectra. Thus, all signals of these four qubits are obtained from the 13 C spectra.
We apply the Haar wavelet, Fourier, and Hadamard transforms to this input 2D pattern, using the corresponding sequences of rf pulses. To examine if the experiments have produced the correct results, we perform quantum state tomography [72] of the input and output image states. Compared with theoretical density matrices, the input-image state and the corresponding transformed-image states have fidelities in the range of [0.961, 0.975], As an alternative to quantum state tomography, we also reconstruct state vectors |ψ expt = 16 k=1 c expt k |k directly from the experimental spectra. The input-image and the transformed-image states are experimentally read out and the decoded image arrays are displayed in Fig. 5. The top row shows the experimental spectra. The middle row shows the corresponding measured image matrices (only the real parts, since the imaginary parts are negligibly small) as 3D bar charts whose pixel values are equal to the coefficients of the quantum states. The bottom row represents the same image data as 2D gray scale (visual intensity) pictures. The experimental and theoretical data agree quite well with each other, with the image Euclidean distance [73] F expt − F th / F th ≈ 0.08 in the input data and ∈ [0.09, 0.12] in the resulting data after processing.

III. QUANTUM EDGE DETECTION ALGORITHM
A typical image processing task is the recognition of boundaries (intensity changes) between two adjacent regions [74]. This task is not only important for digital image processing, but is also used by the brain: It has been shown that the brain processes visual information by responding to lines and edges with different neurons [75], which is an essential step in many pattern recognition tasks. Classically, edge detection methods rely on the computation of image gradients by different types of filtering masks [5]. Therefore, all classical algorithms require a computational complexity of at least O(2 n ) because each pixel needs to be processed. A quantum algorithm has been proposed that is supposed to provide an exponential speed-up compared with existing edge extraction algorithms [76]. However, this algorithm includes a COPY operation and a quantum black box for calculating the gradients of all the pixels simultaneously. For both steps, no efficient implementations are currently available. Based on the aforementioned QImR, we propose and implement a highly efficient quantum algorithm that finds the boundaries between two regions in O(1) time, independent of the image size. Further discussions regarding more general filtering masks are given in Appendix C.
Basically, a Hadamard gate H, which converts a qubit |0 → (|0 + |1 )/ where I 2 n−1 is the 2 n−1 × 2 n−1 unit matrix. For an n-qubit input image state |f = N −1 k=0 c k |k (N = 2 n pixels), we have the output image state |g = (I 2 n−1 ⊗ H) |f as two pixels belong to the same region, their intensity values are identical and the difference vanishes, otherwise their difference is nonvanishing, which indicates a region boundary. The edge information in the even positions can be extracted by measuring the last qubit. Conditioned on the measurement result of the last qubit being 1, the state of the first n − 1 qubits encodes the domain boundaries. Therefore, this procedure yields the horizontal boundaries between pixels at positions 0/1, 2/3, etc.
To obtain also the boundaries between the remaining pairs 1/2, 3/4, etc., we apply the n-qubit amplitude permutation to the input image state, yielding a new image state |f with its odd (even) elements equal to the even (odd) elements of the input one |f (e.g., c 2k = c 2k+1 and c 2k+1 = c 2k+2 ). The quantum amplitude permutation can be efficiently performed in O[poly(n)] time [61]. Applying again a singlequbit Hadamard rotation to this new image state |f , we get the remaining half of the differences. An alternative approach for obtaining all boundary values is to use an ancilla qubit in the image encoding (see Appendix E for a suitable quantum circuit). For example, a 2-qubit image state (c 0 , c 1 , c 2 , c 3 ) can be redundantly encoded in three qubits as (c 0 , c 1 , c 1 , c 2 , c 2 , c 3 , c 3 , c 0 ). After applying a Hadamard gate to the last qubit of the new image state, we obtain the state (c 0 +c 1 , c 0 −c 1 , c 1 +c 2 , c 1 −c 2 , c 2 +c 3 , c 2 −c 3 , c 3 +c 0 , c 3 −c 0 ). By measuring the last qubit, conditioned on obtaining 1, we obtain the reduced state (c 0 − c 1 , c 1 − c 2 , c 2 − c 3 , c 3 − c 0 ), which contains the full boundary information. With image encoding along different orientations, the corresponding boundaries are detected, e.g., row (column) scanning for the vertical (horizontal) boundary. This quantum Hadamard edge detection (QHED) algorithm generates a quantum state encoding the information about the boundary. Converting that state into classical information will require O(2 n ) measurements, but if the goal is, e.g., to discover if a specific pattern is present in the picture, a measurement of single local observable may be sufficient. A good example is the SWAP test (see Appendix D), which determines the similarity between the resulting image and a reference image. As a numerical example, Fig. 6 shows the outcome of the QHED algorithm simulated on a classical computer for an input binary (b/w) image F cat . For this simple demonstration, we use only a binary image; nevertheless, the QHED algorithm is also valid for an image with general gray levels. A 256 × 256 image F cat is encoded into a quantum state |f cat with 16 qubits instead of 2 16 = 65536 classical bits (i.e., 8 kB). Then a unitary operator I 2 15 ⊗ H is applied to |f cat . The resulting image decoded from the output state demonstrates that the QHED algorithm can successfully detect the boundaries in the image.
To test the QHED algorithm experimentally, we encode a simple image in a quantum state |f e of our 4-qubit quantum register. We then apply a single-qubit Hadamard gate to the last qubit while keeping the other qubits untouched, i.e.,Û e = I 8 ⊗ H. The edge information with half of the pixels (even positions) in the resulting state |g e =Û e |f e is produced, which can be read out from the experimental spectra. We separately perform two experiments to obtain the boundaries for odd and even positions with and without the amplitude permutation, as described above. To test if the processing result is correct, we measure the input and output image states and obtain their fidelities in the range of [0.972, 0.981]. The experimental results of boundary information are shown in Fig. 7, along with some corresponding experimental spectra. Compared with the theoretical data, the experimental input and output images have image Euclidean distance of 0.06 and 0.08, respectively.

IV. CONCLUSION
In summary, we demonstrate the potential of quantum image processing to alleviate some of the challenges brought by the rapidly increasing amount of image processing. Instead of the QImR models used in previous theoretical research on QImP, we encode the pixel values of the image in the probability amplitudes and the pixel positions in the computational basis states. Based on this QImR, which reduces the required qubit resources, we discuss the principle of QImP and experimentally demonstrate the feasibility of a number of fundamental quantum image processing operations, such as the 2D Fourier transform, the Hadamard, and the Haar wavelet transform, which are usually included as subroutines in more complicated tasks of image processing. These quantum image transforms provide exponential speed-ups over their classical counterparts. As an interesting and practical application, we present and experimentally implement a highly efficient quantum algorithm for image edge detection, which employs only one single-qubit Hadamard gate to process the global information (edge) of an image; the processing runs in O(1) time, instead of O(2 n ) as in the classical algorithms. Therefore, this algorithm has significant advantages over the classical algorithms for large image data. It is completely general and can be implemented on any general-purpose quantum computer, such as trapped ions [77,78], superconducting [45,48,79], and photonic quantum computing [80,81]. Our experiment serves as a first experimental study towards practical applications of quantum computers for digital image processing. In addition to the computational tasks we show in this paper, quantum computers have the potential to resolve other challenges of image processing and analysis, such as machine learning, linear filtering and convolution, multiscale analysis, face and pattern recognition, image and video coding [4,[46][47][48][49]. Image and video information encoded in qubits can be used not only for efficient processing but also for securely transmitting these data through networks protected by quantum technology. The theoretical and experimental results we present here may well stimulate further research in these fields. It is an open area to explore and discover more interesting practical applications involving QImP and AI. This paradigm is likely to outperform the classical one and works as an efficient solution in the era of big data.

ACKNOWLEDGMENTS
We are grateful to Emanuel Knill for helpful comments and discussions on the article. We also thank Fu Liu, W. Zhao, Thus far, several QImR models have been proposed. In 2003, Venegas-Andraca and Bose suggested the "qubit lattice" model to represent quantum images [52] where each pixel is represented by a qubit, therefore requiring 2 n qubits for an image of 2 n pixels. This is a quantum-analog presentation of classical images without any gain from quantum speed-up. A flexible representation for quantum images (FRQI) [53] integrates the pixel value and position information in an image into an (n + 1)-qubit quantum state (1/ √ 2 n ) 2 n −1 k=0 (cos θ k |0 + sin θ k |1 )|k , where the angle θ k in a single qubit encodes the pixel value of the corresponding position |k . A novel enhanced quantum representation (NEQR) [54] uses the basis state |f (k) of d qubits to store the pixel value, instead of an angle encoded in a qubit in FRQI, i.e., an image is encoded as such a quantum state (1/ √ 2 n ) encoding the pixel value f (k). Table I compares our present QImR, which we refer to as quantum probability image encoding (QPIE), with the other two main quantum representation models: FRQI and NEQR. It clearly shows that the QImR we use here (QPIE) requires fewer resources than the others.
where  compose the quantum Haar wavelet transform (Fig. 8) as follows : where S M is the qubit cyclic right shift permutation: and m the number of qubits. Specifically, S 4 is the SWAP gate to interchange the states of the two qubits: |i 1 i 2 → |i 2 i 1 . Therefore the corresponding circuit consists of the following controlled gates.
Here, C k (U ) is a multiple qubit controlled gate described as follows: whereī 1ī2 . . .ī k in the exponent of U means the product of the bits' inverseī 1ī2 . . .ī k , andī = NOT(i). That is, if the Pixel-value encoding Angle Basis of qubits Probability amplitude first k control qubits are all in state |0 the m − k qubit unitary operator U is applied to the last m − k target qubits, otherwise the identity operation is applied to the last m − k target qubits. Since S 2 m−k can be implemented by (m − k − 1) SWAP gates, the circuit for C k (S 2 m−k ) is composed of (m − k − 1) C k (SWAP) gates. C 1 (SWAP) can be implemented by 3 C 2 (NOT) gates [59]. Hence, the implementation of C k (S 2 m−k ) needs in total 3(m − k − 1) C k+1 (NOT) gates. Both C k (H) and C k (NOT) can be implemented with linear complexity, for k = 0, . . . , m − 1. Hence, we conclude that the quantum Haar wavelet transform can be implemented by O(m 3 ) elementary gates.

APPENDIX C: IMAGE SPATIAL FILTERING
Spatial filtering is a technique of image processing, such as image smoothing, sharpening, and edge enhancement, by operating the pixels in the neighborhood of the corresponding input pixel. The filtered value of the target pixel is given by a linear combination of the neighborhood pixels with the specific weights determined by the mask values [5]. For example, given an input image F = (F i,j ) M ×M and a general 3 × 3 filtering mask, spatial filtering will give the output image Here we construct a linear filtering operator U such that g = U f , where f = vec(F ) and g = vec(G). f and g are both M 2 -dimensional vectors, and the dimension of U is M 2 × M 2 . We prove that U can be constructed as where E is an M × M identity matrix, and V 1 , V 2 , V 3 are M × M matrices defined by Let h = U f , then we have h k = By direct comparison, it is readily seen that h k = g k . Hence, we have g = U f . We can deduce that U is unitary if and only if w 22 = ±1 and other elements are all zero in W [Eq. (C1)]. In general, the linear transformation of spatial filtering is nonunitary. For a nonunitary linear transformation U , we can try to embed it in a bigger quantum system, and perform a bigger unitary operation to realize an embedded transformation U [83]. Alternatively, the quantum matrix-inversion techniques [41,50] could also help to perform some nonunitary linear transformations on a quantum computer.

APPENDIX D: DETECTING SYMMETRY BY QIMP
Here, we present a highly efficient quantum algorithm for recognizing an inversion-symmetric image, which outperforms state-of-the-art classical algorithms with an exponential speed-up. First, we use the NOT gate (i.e., the Pauli X operator σ x ) to rotate the input image 180 • with respect to the image center. Then we utilize the SWAP test [58] to detect the overlap between the input and rotated images: The larger the overlap, the better is the inversion symmetry of original image. This algorithm is described as follows.
1. Encode an input M × L = 2 m × 2 n image into a quantum state |f with n = m + l qubits.
3. Using the SWAP test method [4,47], we detect the overlap between two states before and after applying NOT operation to the input pattern; a measured overlap value f |U NOT |f [84] can efficiently supply useful information on the inversion symmetry of the input pattern. Estimating distances and inner products between state vectors of image data in M L-dimensional vector spaces then takes time O(log M L) on a quantum computer, which is exponentially faster than that of classical computers [85,86]. Here a specific example of a 2 × 2 image is provided for illustration. To rotate the input image matrix by 180 • as follows, The input state of left-hand image is (|00 + 2|01 + 3|10 + 4|11 )/ √ 30. Applying a NOT gate to each qubit, the input state is transformed to (|11 + 2|10 + 3|01 + 4|00 )/ √ 30 (corresponding to the rotated image on the right-hand side). It is clear that the input image has been rotated by 180 • around its center, which corresponds to point reflection in 2D.

APPENDIX E: VARIANT OF QHED ALGORITHM
In order to produce full boundary values in a single step, a variant of the QHED algorithm uses an auxiliary qubit for encoding the image. The quantum circuit is shown in Fig. 9. The operation D 2 n+1 is an n+1-qubit amplitude permutation, which can be written in matrix form as