[Downloaded from www.aece.ro on Monday, April 19, 2021 at 02:30:57 (UTC) by 179.61.159.184. Redistribution subject to AECE license or copyright.] Advances in Electrical and Computer Engineering Volume 13, Number 3, 2013 Quantum Image Filtering in the Frequency Domain Simona CARAIMAN, Vasile I. MANTA Department of Computer Engineering, Technical University of Iasi, D. Mangeron 27, 700050 Iasi, Romania sarustei@cs.tuiasi.ro 1 Abstract—In this paper we address the emerging field of Quantum Image Processing. We investigate the use of quantum computing systems to represent and manipulate images. In particular, we consider the basic task of image filtering. We prove that a quantum version for this operation can be achieved, even though the quantum convolution of two sequences is physically impossible. In our approach we use the principle of the quantum oracle to implement the filter function. We provide the quantum circuit that implements the filtering task and present the results of several simulation experiments on grayscale images. There are important differences between the classical and the quantum implementations for image filtering. We analyze these differences and show that the major advantage of the quantum approach lies in the exploitation of the efficient implementation of the quantum Fourier transform. Index Terms—quantum image processing, quantum Fourier transform, quantum oracle, image filtering. I. INTRODUCTION The spectacular perspectives offered by the realization of a quantum computer have determined an increasing interest for research in quantum information and quantum computation. It seems that, in certain cases, the massive parallelism inherent in quantum computational systems can lead to exponential speedups over the best classical approaches [1-3]. Nevertheless, exploiting the remarkable properties of quantum systems for developing efficient quantum algorithms is a challenging task. This is due to the fundamental differences between the operating modes of quantum and classical computers. The key role in most of the known quantum algorithms is played by the quantum Fourier transform. It is the main ingredient for the efficient quantum order-finding algorithm introduced by Peter Shor [4]. Other problems such as performing discrete logarithms and factoring, which for large numbers are considered intractable on a classical computer, benefit from similar speedups as they can be reduced to order finding. The remarkable properties of quantum systems have led to the emergence of innovative ideas in all major fields of computing, including graphics processing. Nevertheless, speeding up certain signal processing tasks is a rather under researched area. There is an important potential use of quantum computation in this field generated by the more efficient quantum versions of the Fourier transform, wavelet transform [5] and of the discrete cosine transform [6-7]. 1 This work was supported by the project PERFORM-ERA Postdoctoral Performance for Integration in the European Research Area (ID-57649), financed by the European Social Fund and the Romanian Government). The research in quantum image processing is still confronting with fundamental aspects such as representing and storing an image on a quantum computer and the basic processing operations. Representation of color information on one qubit was proposed for the Qubit Lattice approach [8] and was also employed in the FRQI framework [9]. Several basic processing operations were defined in the FRQI framework: geometrical transformations [10], onequbit quantum gates applied on the color wire [11], a similarity measure between two images based on pixel differences [12], two strategies for quantum image watermarking [13, 14]. Beach et al. [15] show that Grover's quantum search algorithm [16] is applicable to image processing tasks such as pose recognition in a model-based machine vision system. Other important contributions to the quantum imageprocessing field rely on the exploitation of maybe the most valuable resource of many–qubit quantum systems, entanglement. It was shown that it could lead to the development of efficient methods for representing and retrieving information about the objects in a quantum image [17] and also to a quantum image compression scheme [18]. In this paper we focus on how to achieve a quantum version of a rather basic classical task, that of image filtering. A common approach is to convolve the image with a filter function, which in the frequency domain translates into a multiplication operation. However, there are fundamental differences between classical and quantum operations, the latter being necessarily invertible due to the reversible nature of quantum computation. Therefore there are classical processing operations that cannot be directly applied to quantum images. Such examples are convolution and correlation [19]. In our paper we describe a method to achieve the filtering of a quantum image by exploiting the quantum Fourier transform and the principle of the quantum oracle. Before describing the proposed quantum image-filtering algorithm, background is given to make the paper selfcontained. We give a short introduction to the basic concepts in quantum computing and briefly overview the quantum version of the discrete Fourier transform. In Section III we describe our approach for representing a quantum image and then discuss the proposed technique for quantum image filtering. In Section IV we provide the results of applying various filters on quantum images by performing simulation experiments. In Section V we analyze the features of the proposed quantum algorithm for image filtering with respect to its classical counterpart and Digital Object Identifier 10.4316/AECE.2013.03013 77 1582-7445 © 2013 AECE [Downloaded from www.aece.ro on Monday, April 19, 2021 at 02:30:57 (UTC) by 179.61.159.184. Redistribution subject to AECE license or copyright.] Advances in Electrical and Computer Engineering Volume 13, Number 3, 2013 to the use of other quantum image representation approaches. In Section VI we summarize our conclusions and discuss the prospects for further development of the quantum image-processing field in the light of the new contributions presented in this paper. II. BASIC CONCEPTS IN QUANTUM COMPUTING The quantum analogous of the classical bit is called a qubit. The states of the qubit can be completely described by the superposition of two orthonormal basis states, which in Dirac notation are labelled 0 and 1 (in a Hilbert space 0 , 1, C 2 ). This orthonormal system 0 1 0 with and 1 0 1 , is called computational T T basis. Any state can be described by a linear combination of these two states: 0 1 with 1 . (1) Complex values and represent the probability 2 2 amplitudes of the basis states. This means that measuring the quantum system yields 0 with probability 2 and 1 with probability . 2 The state of an n -qubit quantum computer is described by an unit vector in Hilbert space H C 2 : n 2n 1 i 0 i 2n 1 where i 0 (2) i 2 i 1 and i 2 represents the probability of obtaining state i when measuring the register. A quantum register s is represented by a sequence of qubits. If s is an n -qubit quantum register and U is an operator in the states space H , then the operator U (s) applied to a register is called a quantum gate. Any quantum operator is a unitary operator and thus any computational process can be implemented by a sequence of quantum gates. Elementary quantum gates include single qubit gates (Not, Hadamard, phase-shift, rotations), controlled gates (CNOT, CPHASE) and the Toffoli gate [20]. The unitarity of quantum operators ensures the reversibility of the computational process. We remark that the number of outputs of a quantum gate is equal to the number of inputs. For example, the Not gate ( X ) and the Hadamard gate ( H ) act on a single qubit and can be described by 0 1 (3) X , X 0 1 0 1 , 1 0 1 H 0 0 1 1 1 1 2 H . (4) , 1 2 1 1 H 1 0 1 2 The controlled-Not gate ( CNOT ) acts on two qubits, a target qubit and a control qubit. The former is flipped if and only if the latter is in state 1 : 00 00 ; 78 01 01 ; 10 11 ; 11 10 . The action of the controlled-Not gate is x, y x, x y , where is addition modulo two, and has the following matrix representation: 1 0 0 0 0 1 0 0 . (5) CNOT 0 0 0 1 0 0 1 0 The only irreversible operation allowed is the measurement of quantum states, which has the effect of collapsing the superposition into one of the computational basis states. A direct consequence of the principles of quantum physics is the immense computing power of a quantum machine compared to that of a classical one. This is due to three remarkable quantum resources that have no classical counterparts: quantum parallelism, quantum interference and entanglement of quantum states. These remarkable properties of quantum systems allowed the formulation of optimal algorithms for two fundamental problems: integer factorization (Shor's algorithm [4]) and the search in an unstructured database (Grover's algorithm [16]). Thus, two main classes of quantum algorithms have better time complexity than their classical counterparts. The algorithms in the first class are based on the quantum Fourier transform and provide remarkable solutions for solving the factorization and discrete logarithm problems, with an exponential speedup over the best known classical algorithms. The algorithms in the second class are based on the mechanism of quantum amplitude amplification [21] found in Grover's quantum search algorithm. This class of algorithms provides a quadratic speedup with respect to the best classical algorithms. III. QUANTUM IMAGE FILTERING A. Representation of Quantum Images In order to represent the quantum image we will use a quantum register prepared in a state that encodes both color and position of a pixel [22]: 2n m 1 2 1 2 1 Q C m P 2 n n ij j i . (6) 2 i 0 j 0 Pixel positions are encoded in register P using 2n qubits, which are enough to store an image with N 2n 2n pixels. Register P is in the form y x where y and x encode the row and column coordinates of a pixel respectively. Color information for each pixel is represented using m log 2 L qubits encoding the L colors (gray levels) present in the image. Coefficients ij , with 2m 1 j 0 2 ij 1 for all i with 0 i 22 n , 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 coefficients ij take value 1 if the color of the pixel is j , and 0 otherwise. This is illustrated in Fig. 1 with a simple example of a 2 2 image with four colors. [Downloaded from www.aece.ro on Monday, April 19, 2021 at 02:30:57 (UTC) by 179.61.159.184. Redistribution subject to AECE license or copyright.] Advances in Electrical and Computer Engineering Volume 13, Number 3, 2013 algorithm that computes the discrete Fourier transform on 2 n elements requires exponentially more operations, using O n2 n gates. Even though the quantum Fourier transform is an efficient quantum algorithm for performing a Fourier transform of quantum amplitudes, it does not speed up any task that requires computing the Fourier transform on classical data. This is because the complete set of Fourier coefficients are in fact encoded in the amplitudes of the quantum state given by the right side of (8). As noted in Section II, the amplitudes in a quantum computer cannot be directly accessed by measurement. Nevertheless, a more subtle use of the quantum Fourier transform allows for exponential speedups to be obtained when solving several interesting problems. These include the order-finding problem, the factoring problem, and, in combination with the quantum search algorithm, the problem of counting the solutions to a search problem. Figure 1. Example of a simple 2 2 quantum image with four possible colors (two qubits are used to represent the color information and two qubits encode the position of each pixel). B. The Quantum Fourier Transform and Its Inverse The quantum Fourier transform (QFT) on an orthonormal basis 0 , 1 , , N 1 is a linear operator whose action on a computational basis state is defined by 1 N 1 2 ixk N (7) QFTN x k . e N k 0 It can be easily verified that the transform in (7) is unitary ( QFTN x is normalized to unity and QFTN x is orthogonal to QFTN x unless x x ). Applied to a superposition of states x with complex amplitudes x it produces another superposition of states k with amplitudes related to x by an appropriate discrete Fourier transform: N 1 N 1 QFTN x x k k , (8) x0 k 0 where 1 N 1 2 ikx N k (9) e x . N x 0 From the unitarity of the quantum Fourier transform it follows that its inverse is the Hermitian adjoint of the quantum Fourier operator, QFT 1 QFT † . It maps the state given by the right side of (7) to x and its action on a computational basis state is described by 1 N 1 2 ixk N (10) QFTN1 x k . e N k 0 The quantum Fourier transform and its inverse can be efficiently implemented using one-qubit Hadamard gates and 2-qubit controlled-phase gates. That is, a quantum circuit that performs the n-qubit Fourier transform needs O n 2 such quantum gates. In contrast, the best classical C. Quantum Circuit for Image Filtering In classical image processing image filtering can be achieved by convolving the input image with a filter. This can be achieved either in the spatial domain or in the frequency domain but, in general, the latter approach is computationally faster, especially as the filter size increases. This is due to the convolution theorem, which leads to the following steps for performing the filtering process: 1. Compute F (u, v) , the Fourier transform of the input image f ( x, y ) ; 2. Multiply the Fourier transformed image with a filter function H (u, v) ; 3. The filtered image is obtained by computing the inverse Fourier transform of the result obtained in step 2. In order to achieve the filtering of a quantum image we need to derive the corresponding quantum steps of the above procedure. Nevertheless, as proved by Lomont [19], the quantum convolution of two sequences, encoded in the coefficients of two quantum states, cannot be achieved directly. It also holds true for the correlation operation. This is because, due to linearity constraints, there is no physical process capable of realizing the multiplication step. That is, for arbitrary quantum states i ai i and j b j j there is no quantum operator to compute the state N 1 N 1 N 1 i , j 0 k 0 j 0 P a j bk j k ai b j ij where 1 ab i 2 j (11) is the normalization factor and N 2n for some integer n 0 . In order to avoid the consequences of this result we propose to apply the filtering step using a quantum oracle provided as a black box. As shown in Figure 2, at the output of the proposed quantum filtering circuit we actually find the input image. Thus, Lomont’s proof is not contradicted but only avoided. Moreover, exploiting the quantum interference phenomenon, we can use an additional qubit initially in state 0 to reinterpret the quantum image as a superposition of two images. If for example a high pass or a low pass filter is 79 [Downloaded from www.aece.ro on Monday, April 19, 2021 at 02:30:57 (UTC) by 179.61.159.184. Redistribution subject to AECE license or copyright.] Advances in Electrical and Computer Engineering Volume 13, Number 3, 2013 Figure 2. The quantum circuit for image filtering in the frequency domain. used, the output image is the sum of the image containing the high frequencies and the image containing the corresponding low frequencies. The additional qubit can be used to make the distinction between the two images. In the following we analyse this process and describe the state of the quantum image filtering circuit at each step of the computation as marked in Fig. 2. The input state I 0 is represented by the input image and an additional qubit in state 0 : I0 Q 0 where Q 1 2n 2n 1 2n 1 2m 1 y 0 x 0 j 0 holds the j y x 0 , ij quantum image (12) using the representation described in Section III.A. Applying the quantum Fourier transform on the image produces state I1 : I1 I m QFT22 n Q I 0 1 2n 2n 1 2n 1 2m 1 1 n 2 2n 1 2n 1 2m 1 y 0 x 0 j 0 y 0 x 0 j 0 1 22 n 1 2n 2 yxj y x 0 k where I1good (15) is the state containing the ‘good’ frequencies is the state containing that the filter allows to pass, I1bad the ‘bad’ frequencies that are suppressed by the filter and t is the number of ‘good’ frequencies. Applying the oracle operator U H to this superposition one can use the additional qubit to make the distinction between the two states, where the action of U H is UH kp z kp z H (k , p) . (16) I 2 I m U H I1 1 22 n 2n 1 2n 1 2m 1 2n 1 y 0 x 0 j 0 k , p 0 2 i ( yk xp ) yxj e j UH k p 0 2n , (17) filter H (k , p ) is yxj 2n 1 yxj j e 2n 2 iyk 2n 1 2n k k 0 yxj e 2 n e x 0 (13) 2 ixp 2n p 0 p 0 2 iyk 2n 1 2n 1 2m 1 2n 1 y 0 x 0 j 0 k , p 0 QFT j QFT2n y e 2 n QFT k ik 1 i1i0 j k p 0 thus be re-written: m n n 2 iyk 2 ixp 1 2 1 2 1 2 1 n n I 2 2 n yxj e 2 e 2 j k p 0 2 y 0 x 0 j 0 k , pSbad 1 2n 2 2n 1 2n 1 2m 1 y 0 x 0 j 0 k , pS good yxj e 2 iyk 2 ixp 2n 2n e (19) j k p 1 TABLE 1. THE Sgood AND Sbad FREQUENCY SETS FOR SOME . (14) The next step performed by the quantum circuit is the equivalent of the classical filtering step. Nevertheless, there is a fundamental distinction compared to the classical operation that allows us to avoid the result proved by Lomont. The state of the register holding the image does not actually change to a state representing the filtered image but rather it undergoes an interference process with the additional qubit initially in state 0 . This is achieved using a quantum oracle built using the filter function H (k , p ) . The quantum state I1 1, k , p S good H (k , p ) . (18) 0, k , p Sbad S good and Sbad represent the sets of coordinates for the ‘good’ and ‘bad’ frequencies classified accordingly by the corresponding filter function. The resulting state, I 2 can 2 ixp QFT ik 1 QFT i0 is actually a superposition of two states, a state representing only the filtered frequencies and a 80 22 n t t I1bad 2 n I1good , 2n 2 2 qubits unaffected. In our case z is initially 0 and the where I and I m denote the identity operator on one and m qubits, respectively. We also used the fact that the quantum Fourier transform on k qubits is the k -fold tensor product of k one-qubit quantum Fourier transforms (written QFT k ): QFT2k i I1 U H only acts on the position qubits and leaves the color j QFT22 n 2n 1 2n 1 2m 1 y 0 x 0 j 0 state representing the frequencies removed by the filter: Filter Low-pass COMMON IDEAL FILTERS. Frequency Sets S good k , p D(k , p ) D0 Sbad k , p D(k , p ) D0 High-pass S good k , p D(k , p ) D0 Sbad k , p D(k , p ) D0 Band-pass S k , p DL D(k , p ) DH good Sbad k , p D(k , p ) DL and D(k , p) DL Band-stop S good k , p D(k , p ) DL and D (k , p ) D Sbad k , p DL D(k , p ) DH [Downloaded from www.aece.ro on Monday, April 19, 2021 at 02:30:57 (UTC) by 179.61.159.184. Redistribution subject to AECE license or copyright.] Advances in Electrical and Computer Engineering Volume 13, Number 3, 2013 Various choices for the filter function H (k , p ) lead to different values in the ‘good’ and ‘bad’ frequency sets. Table 1 shows the different sets associated with some ideal filters. The last computational step in the quantum circuit in Fig. 2 represents the inverse quantum Fourier transform that reverts from the frequency to the spatial representation of the image. The final state of the circuit contains the superposition of two quantum images: the image containing the frequencies passed by the filter and the image containing the frequencies suppressed by the filter. For example, if a low-pass filter is used, the final image is actually a superposition of the low-frequencies image and the highfrequencies image. Moreover, the distinction between these two images can still be made using the additional qubit: I3 1 2 1 2 1 2 1 yxj j QFT21 k QFT21 p 0 22 n y0 x0 j 0 k , pS 2 1 2 1 2 1 j QFT21 k QFT21 p 1 , (20) yxj y 0 x 0 j 0 k , pS n m n n n bad n m n n n good 1 2 1 2 1 2 1 j yxj 23 n y 0 x0 j 0 k , pS n n 2n 1 m e 2n 1 2n 1 2m 1 yxj y 0 x 0 j 0 k , pS good is yxj e where yxj can interpret state 2n 1 j e 2n e r 2 ikr 2n 1 2n 2 ipt 2n t 0 t 0 e r r 0 2 iyk 2n 1 2n r 0 bad 2 ikr t 1 2 ipt 2n t 0 2 ixp e I3 2n . By re-arranging the sums we as the superposition of the two images: I3 1 3n 2 2n 1 2n 1 2m 1 1 23 n 2n 1 2n 1 2m 1 1 23 n 2n 1 2n 1 2m 1 1 23 n 2n 1 2n 1 2m 1 2 i ( kr pt ) 2n 1 2n 1 r 0 t 0 j 0 k , pSbad y 0 x 0 ' yxj r 0 t 0 j 0 k , pS good y 0 x 0 r 0 t 0 j 0 r 0 t 0 j 0 2 i ( kr pt ) 2n 1 2n 1 j r t 0 2n e ' yxj 2n e IV. SIMULATION OF QUANTUM IMAGE FILTERING j r t 1 ,(21) b rtj j r t 0 g rtj j r t 1 where the color of a pixel with position rt is 2m 1 j 0 b rtj j in the image containing the suppressed frequencies, Qbad , and 1 22 n In this section we present the results of applying the filtering operation on the gray scale images in Fig. 3. The simulations were performed in MATLAB by representing the quantum images in the form of an ij -matrix according to (6) and by applying (21) to compute the intensity values for the pixels in the resulting quantum states that represent the filtered images, Qbad and Qgood . Three 32 by 32 Qbad 0 Qgood 1 1 22 n both images in the final superposition using the quantum storage and retrieval protocol described by VenegasAndraca and Bose [8]. The disadvantage of this protocol is that it involves preparing several copies of the input image, applying the same computational process on each copy and then sampling using the measurement operator. This is in fact a statistical procedure that serves for minimizing the uncertainty in the retrieval process of a quantum parameter. This uncertainty comes from the probabilistic nature of quantum measurement. An alternative for extracting useful information from a quantum-transformed image is to apply further processing steps. In fact, this is also the common procedure in classical image processing. The filtering step is part of a preprocessing stage where the image is enhanced such that further operations, e.g. segmentation, could be better applied. Then, other classes of measurements could be applied on the processed image that could reveal its properties without the need to actually ‘see’ the processed image. For example, the segmentation of the high frequency image, i.e. the image containing edge information, can produce a quantum state representing only the pixels belonging to the edges of an object. Variations of quantum searching, quantum counting and/or quantum integral estimation can then be applied to compute useful statistics associated to the shape of the object, e.g. perimeter, area, etc. Such information could then be determined by measuring the final quantum state. The result of the measurement can then be used for comparing two images in a content-based image retrieval system. It follows that implementing such a system quantumly can bring a significant speedup compared to the classical variant. This is due both to the exponential speedup of the quantum version of the Fourier transform, but also due to the speedup brought by the quantum search algorithm. 2m 1 j 0 g rtj j in the image with the frequencies passed through by the filter, Qgood . In classical image processing the final stage usually assumes extracting information from the result by looking at the image. This, however, cannot be achieved in the quantum domain because the resulting image(s) are stored in quantum states. A measurement on the final state I 3 only samples from the transformed image, revealing only the color at a single pixel position. However, one can retrieve pixels images were used: a synthetic image containing only two gray levels (Fig. 3 left) and two sub-images of a microscopy image (Fig. 3 right). For each image, the color information for each pixel is represented using m 8 qubits to encode 256 possible gray levels and the pixel positions are encoded using 2n 10 qubits. The synthetic image was filtered using a high pass filter with D0 6.4 and the resulting high- and low-frequency images are shown in Fig. 4, corresponding to the Qgood and Qbad states, respectively. Scaled versions of the 32 by 32 images are presented. As expected, the high-pass filter emphasizes a horizontal edge in the middle of the image and the low-pass filter has a blurring effect. The horizontal bands in the filtered images are due to the ringing effect of 81 [Downloaded from www.aece.ro on Monday, April 19, 2021 at 02:30:57 (UTC) by 179.61.159.184. Redistribution subject to AECE license or copyright.] Advances in Electrical and Computer Engineering Volume 13, Number 3, 2013 the ideal filter. Figure 3. Test images. Left – synthetic image, 32 32 pixels, with two gray levels. Right – Microscopy image of a tissue section displaying cell nuclei as bright round objects; A,B are 32 32 pixels sub-images used for testing purposes. Figure 4. Result of filtering the synthetic image in Fig. 3 with a high-pass filter, D0 0.2 32 6.4 . Left – image containing the corresponding high Fourier transform. For comparison and displaying purposes, the classical representation of the quantum high- and lowfrequency images is extracted from the corresponding quantum superpositions by multiplying the amplitudes, i.e. the coefficients, with the integer encoding of the state vectors. Just like in the classical case, negative floating point values are also obtained for the gray levels in the filtered images. The minimum value in the image is displayed as black, the maximum value is displayed as white and the values in between are displayed as intermediate shades of gray, using 256 gray levels. The gray level for pixel (3,3) in the high-frequency image is represented as 105 and in the low-frequency image as 246. The results of filtering sub-images A and B of the microscopy image are presented in Fig. 5 and Fig. 6. As only four gray levels are present in the original sub-image A, the quantum representation of each pixel in the filtered images is expressed as a superposition of four basis vectors. The gray levels and the corresponding amplitudes in the quantum representation of pixel (3,3) of sub-image A are detailed in Table III. The original sub-image B contains 189 different gray levels. The quantum amplitudes of the superposition representing the intensity value of the same pixel in sub-image B are presented in Fig. 7. frequencies. Right – image containing the corresponding low frequencies. TABLE II. QUANTUM REPRESENTATION OF THE PIXEL WITH COORDINATES (3,3) IN THE SYNTHETIC IMAGE IN FIG. 3, FILTERED WITH A HIGH-PASS FILTER WITH D0 0.2 32 6.4 input image high-freq. image ( Qgood ) low-freq. image ( Qbad ) gray level 170 -3.91 173.91 C 1 170 8 image containing the corresponding high frequencies. Right - image containing the corresponding low frequencies. 0.0559 100 -0.0559 100 -0.0559 170 1.0559 170 In the filtered images, the intensity value of each pixel is represented by a quantum superposition of the two basis vectors corresponding to the gray levels in the original image. For example, for pixel with coordinates (3,3), the gray levels and the corresponding quantum representation in each image – original, high- and low-frequency images – are detailed in Table II. The resulting quantum state, corresponding to the representation in (21), is a normalized state: g rtj b 2 rtj 1, Figure 5. Result of filtering sub-image A of the cell image in Fig. 3 with a high-pass filter, D0 0.2 32 6.4 . Left – original sub-image A. Center - (22) TABLE III. QUANTUM REPRESENTATION OF THE PIXEL WITH COORDINATES (3,3) IN SUB-IMAGE A OF THE CELL IMAGE IN FIG. 3, FILTERED WITH A HIGHPASS FILTER WITH D0 0.2 32 6.4 input image high-freq. image low-freq. image gray level 0 1.3942 -1.3942 C 10 -0.0262 0 1.0262 0 -0.0008 1 0.0008 1 0.0079 51 0.0079 51 0.0191 52 0.0191 52 8 j and is equivalent to the quantum representation of the gray level in the original image. This is consistent with the classical case where the summation of the corresponding high- and low-frequency images gives the original image. In general, the inverse Fourier transform is complex. However, when both the input image and the filter are realvalued, the imaginary part of the inverse transform should be zero. In practice, the imaginary components appear to be non-zero usually due to computational approximations and need to bee ignored. Thus, in the filtered image, the coefficients are taken to be the real part of the inverse 82 Figure 6. Result of filtering sub-image B of the cell image in Fig. 3 with a high-pass filter, D0 0.2 32 6.4 . Left – original sub-image B. Center image containing the corresponding high frequencies. Right - image containing the corresponding low frequencies. [Downloaded from www.aece.ro on Monday, April 19, 2021 at 02:30:57 (UTC) by 179.61.159.184. Redistribution subject to AECE license or copyright.] Advances in Electrical and Computer Engineering Figure 7. Quantum representation of the pixel with coordinates (3,3) in subimage B of the cell image in Fig. 3 filtered with a high-pass filter with D0 0.2 32 6.4 . The gray level of the pixel is 0.2788 and is represented by a superposition of quantum states that correspond to all the gray levels in the original sub-image. V. DISCUSSION The convolution operation in the spatial domain corresponds to multiplication in the frequency domain. Thus, for spatial invariant linear filters, convolution can be implemented efficiently using the discrete Fourier transform. Despite the obvious speedup that could be introduced by the quantum version of the Fourier transform, a quantum implementation for the filtering operation in the frequency domain is not straightforward. This is due to the fact that the quantum convolution of two sequences, encoded in the coefficients of two quantum states, is physically impossible. Thus, in order to develop a quantum version of the image filtering operation we devise a workaround to this problem. Our solution is based on the use of a quantum oracle. An oracle is a quantum circuit that ‘recognizes’ solutions to a given problem. It is supplied as a black box that provides a yes-no answer to a specific question. In our case the oracle operator is used to implement the filter function. Thus, we are able to avoid the impossibility of the quantum convolution by working with the image containing both ‘good’ and ‘bad’ frequencies as classified by the filter. The trick is to reinterpret this image as the sum of two filtered images: the image containing only the ‘good’ frequencies and the image containing only the ‘bad’ frequencies. This way we don’t need to actually convolve the image with the filter function but only use the filter to distinguish between the two component images. The output state of the quantum circuit implementing the filtering process is a superposition of the two quantum images. The main advantage of our quantum implementation for the image filtering operation is related to the efficiency of the quantum Fourier transform. It requires exponentially less operations than the classical fast Fourier transform. However, this speedup is usually difficult to be exploited because the complete set of Fourier coefficients are encoded as amplitudes of quantum states and cannot be directly accessed. In our method we are able to preserve the speedup of the quantum Fourier transform as the Fourier coefficients need not be extracted. In classical information processing the result of image filtering is represented by an image containing only the frequencies passed through by the filter. The result of our quantum image filtering method is different from the classical counterpart under several aspects. In the classical case, the original image cannot be reconstructed out of the Volume 13, Number 3, 2013 filtered image. In contrast, the quantum filtering process is reversible because only unitary operators are used to act upon the system. Another contrast regards the retrieval of the filtered image(s). In the classical case the process is straightforward, while the quantum representation of the filtered image(s) encodes this information in the amplitudes of the quantum states. A statistical procedure would then be necessary to extract these amplitudes by measurement. Such a procedure involves preparing several copies of the input image and applying the same computational process on each copy. However, in most image processing applications, filtering is a pre-processing step and its result is usually an input for several other operations. Thus, the retrieval of the filtered image is not necessary. It can be further processed and useful information can be extracted at the end of the quantum computational process as discussed in Section III.C. Further processing can be applied on either of the two images in the quantum superposition represented by the final state of the quantum filtering circuit. This can be achieved making use of the oracle qubit and controlled operators. This qubit distinguishes between the two quantum states. It is flipped if the value of the filter function implemented by the oracle is one and remains unchanged otherwise. Thus it can be used as a control qubit to manipulate one image or the other. In the quantum protocol for image filtering proposed in this paper the color of a pixel in the quantum image is quantized and represented with an appropriate number of qubits, much like in the classical case ( m log 2 L qubits are needed to represent the L colors of a gray level image). The same m qubits are used to store the colors of all the pixels in the image, which is possible by efficiently exploiting the properties of quantum superpositions. This, in fact, allows for an overall exponentially lower memory space to be used than in the classical case ( m 2n qubits are needed to store a 2n 2n image with L gray levels compared to m22 n classical bits). Another approach for encoding the color information would be to use a single qubit as suggested by VenegasAndraca and Bose [8] and Le et al. [9]. It relies on the definition of a machine capable of detecting electromagnetic waves and producing an initialized qubit that encodes the frequency of the electromagnetic wave in the phase parameter. Le et al. use single qubit unitary operators to achieve basic color processing operations such as color inversion [11]. However this representation restricts the possible processing operations that can be defined in the quantum domain. For example, using our representation, the mechanism of quantum amplitude amplification can be employed to define quantum procedures for histogram computation and threshold-based segmentation [22]. The one-qubit color representation is not suited for such a purpose because the quantum states representing pixels with a given color are not computational basis states. Even though in our representation the necessary state space is larger than in the representation suggested in [8], we consider that the broader possibilities for processing operations are much more valuable. Still, we find that the mechanism for image filtering described in this paper is straightforward to be employed on the one-qubit 83 [Downloaded from www.aece.ro on Monday, April 19, 2021 at 02:30:57 (UTC) by 179.61.159.184. Redistribution subject to AECE license or copyright.] Advances in Electrical and Computer Engineering representation. Moreover, we envision that a more advanced quantum image processing field will exploit various image representation models. This is much like in the classical case where one uses different image formats and color models depending on the purpose of the image manipulation process (we use compressed formats for image transmission, the RGB color model for image display, the L*a*b* color model for color analysis, etc.). Volume 13, Number 3, 2013 applications for quantum information processing. It would also represent an overall justification for the immense efforts needed for building working quantum computers. REFERENCES [1] [2] VI. CONCLUSIONS In this paper we addressed the field of Quantum Information Processing by analyzing the prospects of applying quantum computation concepts to image processing tasks. Specifically, we developed a quantum version for the image filtering operation. This is an important technique that comes up in many image processing applications. It is usually applied in the early stages of vision processing for image enhancement. For example, it can be used to eliminate undesirable characteristics introduced in the acquisition process (e.g. noise) or to emphasize various structures in the image prior to a segmentation process (e.g. edges). In classical computing, image filtering can be achieved by convolving the image with a mask representing the filter. However, convolution with large filters is a very expensive process in the spatial domain. The alternative is to apply filtering in the frequency domain as it corresponds to a multiplication operation. Either way, to the best of our knowledge, no quantum algorithm has yet been devised to implement this operation. Our quantum version for the image filtering operation avoids convolving the image with a filter, which has been proved to be physically impossible to realize directly [19], and uses a quantum oracle to act as a filter. This quantum image filtering mechanism has several advantages over the classical case: - It exploits the speedup introduced by the quantum version of the Fourier transform and thus it is exponentially faster; - It exploits the properties of quantum superpositions and thus requires less memory space to represent and process the image ( m 2n qubits are needed to store a 2n 2n image with L 2m gray levels compared to m 22 n classical bits); - The output quantum state incorporates information about both components of the original image – the image containing the frequencies passed by the filter and the image containing the frequencies stopped by the filter. The two components can be efficiently distinguished and exploited using the oracle qubit. The result obtained in this paper offers a promising perspective on the investigation of more such applications of quantum computing to image processing tasks. The developments in the field of Quantum Image Processing are still in an early stage. We believe that the contributions to this field are not a mere digression in a hot topic as many may think, but they could significantly impact the overall advent of the main framework of Quantum Information Processing. Interesting ideas could arise for the design of new quantum algorithms and the development of novel 84 [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21] [22] D. R. Simon, “On the Power of Quantum Computation”, SIAM J. Comput. 26, 5, pp. 1474-1483, 1997, dx.doi.org/ 10.1137/S0097539796298637. D. Deutsch and R. Jozsa, “Rapid Solution of Problems by Quantum Computation”, Proc. R. Soc. Lond. A, 439, pp. 553-558, 1992, dx.doi.org/10.1098/rspa.1992.0167. E. Bernstein and U. Vazirani, “Quantum Complexity Theory”, SIAM J. Comput. 26, 5 pp. 1411-1473, 1997, dx.doi.org/10.1137/S0097539796300921. P. Shor, “Algorithms For Quantum Computation: Discrete Logarithms and Factoring”, in: SFCS '94: Proc. of the 35th Annual Symposium on Foundations of Computer Science, IEEE Computer Society, 1994, pp. 124-134, dx.doi.org/ 10.1109/SFCS.1994.365700. A. Fijany, C. Williams, “Quantum Wavelet Transform: Fast Algorithm and Complete Circuits”, arXiv:quant-ph/9809004, 1998. A. Klappenecker, M. Roetteler, “Discrete Cosine Transforms on Quantum Computers”, arXiv:quant-ph/0111038, 2001. C. C. Tseng, T. M. Hwang, “Quantum Circuit Design of 8x8 Discrete Cosine Transform Using Its Fast Computation Flow Graph”, in: Circuits and Systems, 2005. ISCAS 2005. IEEE International Symposium on, pp. 828-831 Vol. 1, dx.doi.org/10.1109/ISCAS.2005.1464716. S. Venegas-Andraca and S. Bose, “Storing, Processing and Retrieving an Image Using Quantum Mechanics,” in Proc. of the SPIE Conf. Quantum Information and Computation, 2003, pp. 137–147, dx.doi.org/ 10.1117/12.485960. P. Le, F. Dong, and K. Hirota, “A Flexible Representation of Quantum Images for Polynomial Preparation, Image Compression, and Processing Operations,” Quantum Inf. Process., vol. 10, pp. 63– 84, 2011, dx.doi.org/ 10.1007/s11128-010-0177-y. P. Q. Le, A. M. Iliyasu, F. Dong, K. Hirota, “Strategies for Designing Geometric Transformations on Quantum Images”, Theor. Comput. Sci. 412 (2011), 1406-1418, dx.doi.org/ 10.1016/j.tcs.2010.11.029. P. Q. Le, A. M. Iliyasu, F. Dong, K. Hirota, “Efficient Color Transformations on Quantum Images”, JACIII 15 (2011) 698-706. F. Yan, P. Q. Le, A. M. Iliyasu, B. Sun, J. A. Garcia, F. Dong and K. Hirota, “Assessing the Similarity of Quantum Images Based on Probability Measurements,” 2012 IEEE World Congress on Computational Intelligence, Brisbane, 10-15 June 2012, pp. 1-6, dx.doi.org/ 10.1109/CEC.2012.6256418. A. M. Iliyasu, P. Q. Le, F. Dong, and K. Hirota, “Watermarking and authentication of quantum images based on restricted geometric transformations”. Inf. Sci. 186, 1, pp. 126-149, 2012, dx.doi.org/10.1016/j.ins.2011.09.028. W. Zhang, F. Gao, B. Liu, Q. Wen, and H. Chen, “A watermark strategy for quantum images based on quantum Fourier transform” Quantum Inf. Process. 12, 2, pp. 793-803, 2013, dx.doi.org/10.1007/s11128-012-0423-6. G. Beach, C. Lomont, C. Cohen, “Quantum Image Processing (QuIP)”, in: Proc. of 32nd Workshop on Applied Imagery Pattern Recognition, 2003, pp. 39-44, dx.doi.org/ 10.1109/AIPR.2003.1284246. L. K. Grover, “A Fast Quantum Mechanical Algorithm for Database Search”, in: Proc. of the 28th annual ACM Symposium on Theory of Computing, STOC '96, ACM, New York, NY, USA, 1996, pp. 212219, dx.doi.org/ 10.1145/237814.237866. S. Venegas-Andraca, J. Ball, “Processing Images in Entangled Quantum Systems”, Quantum Inf. Process. 9 (2010) 1-11, dx.doi.org/ 10.1007/s11128-009-0123-z. J. Latorre, “Image Compression and Entanglement”, arXiv:quantph/0510031, 2005. C. Lomont, “Quantum Convolution and Quantum Correlation Algorithms Are Physically Impossible,” arXiv:quant-ph/0309070, 2003. M. Nielsen and I. Chuang, “Quantum Computation and Quantum Information”, Cambridge Series on Information and the Natural Sciences. Cambridge, UK: Cambridge University Press, 2000 G. Brassard, P. Hoyer, M. Mosca, A. Tapp, “Quantum Amplitude Amplification and Estimation”, arXiv:quant-ph/0005055, 2000. S. Caraiman and V. Manta, “Image Processing Using Quantum Computing”, 16th International Conference on System Theory, Control and Computing (ICSTCC), Sinaia, 12-14 October 2012 , pp. 1-6.