Abstract
Quantum image processing is an emerging topic in the field of quantum information and technology. In this paper, we propose a new quantum image representation of RGB images with deterministic image retrieval, which is an improvement over all the similar existing representations in terms of using minimum resource. We use two entangled quantum registers constituting of total 7 qutrits to encode the color channels and their intensities. Additionally, we generalize the existing encoding methods by using both qubits and qutrits to encode the pixel positions of a rectangular image. This hybridqudit approach aligns well with the current progress of NISQ devices in incorporating higher dimensional quantum systems than qubits. We then describe the image encoding method using higherorder qubitqutrit gates, and demonstrate the decomposition of these gates in terms of simpler elementary gates. We use the Google Cirq’s quantum simulator to verify the image preparation in both the ideal noisefree scenario and in presence of realistic noise modelling. We show that the complexity of the image encoding process is linear in the number of pixels. Lastly, we discuss the image compression and some basic RGB image processing protocols using our representation.
Similar content being viewed by others
Introduction
Stateoftheart quantum computation, in both theoretical and experimental grounds, largely uses twodimensional quantum systems known as Qubits. The same applies for the presentday noisy intermediatescale quantum (NISQ) computing processors available for simulating real quantum circuits. Intrinsically, all the quantum systems designed as qubits have more than two energy levels, though the higher levels are maintained as nonfunctional. It is in principle possible to exploit these levels for quantum computation. Recently there has been a surge of interest to develop theoretical ideas and experimental tools to realize quantum computation using \(d>2\) dimensional quantum systems, called Qudits^{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18}. This is usually referred to as ‘multivalued quantum computation’. It is straightforward to observe that using qudits increases the storage capacity and reduces the complexity of a quantum circuit, improving the overall performance of a quantum information protocol. Experimental platforms, e.g. photonic systems^{12,13}, trapped ions^{4}, continuous spin systems^{3,11}, nuclear magnetic resonance^{9,10}, molecular magnets^{2} and transmon qudits^{19} has been used to test quditbased computation. The present literature on qudits has shed light on to the construction of elementary gates for quantum circuits where all the qudits have same dimension^{1,7,20,21,22,23,24}. However, quantum circuit composed of qudits of different dimensions, often termed as ‘hybridqudit system’, remain relatively unexplored^{25,26,27}.
Quantum computation has found its application in a plethora of technological fields, quantum image processing being one of them. It is a rapidly developing topic with potential applications in space science, medicine, automobile engineering etc. Compared to classical bits, one needs logarithmically less number of qubits to store the same amount of classical information. Additionally, quantum properties like superposition and entanglement leads to exponential quantum speedup of the image processing algorithms^{28,29}. The first step of an image processing algorithm is to encode the classical image as a quantum state. A number of different forms of quantum encoding methods have been proposed^{29,30,31,32,33,34,35}. They differ in their applicability for binary, greyscale or color images, the amount of resources consumed, and the efficiency of the image retrieval process. For binary and greyscale images, Flexible representation of quantum images (FRQI)^{30} and Novelenhanced quantum representation of images (NEQR)^{32} are the most commonly used encoding methods in the current literature. Compared to FRQI, NEQR employs higher number of qubits to encode the greyscale pixel values and has a more accurate image retrieval process, which we will discuss in the upcoming sections. For color images, specifically those having an RGB color channel format, several quantum representations inspired from FRQI and NEQR have been proposed. To mention some of them, ref.^{31} extends the FRQI method to encode the color channel intensities using three qubits, though it suffers the same drawback as FRQI for image retrieval. On the other hand, the NEQRbased color image encoding methods^{33,35} use 24 qubits to encode the colors, and have accurate image retrieval. In ref.^{34}, the authors show that the number of necessary qubits can be reduced to 10 for encoding the colors, while retaining the accurate image retrieval.
In this work, we aim to reduce the number of quantum units required to encode an RGB image, while adhering to the accurate image retrieval process. As it has been shown in^{36}, following the same approach as NEQR, and replacing the qubits with qutrits, only 6 qutrits are required to encode the greyscale values varying from 0 to 256. This means that the encoding of RGB color channel intensities should take 16 qutrits, which is still pretty large. As we propose here, it is possible to encode an RGB image using only 7 qutrits. Using higher than three dimensional qudits can logarithmically reduce the required resources. Interestingly, in ref.^{37}, it is argued that systems with three basis states indeed construct the most costeffective circuit compared to \(n\ne 3\) dimensional systems^{36}. In the IBMQ platform, one can excite the third energy level of a superconducting (SC) qubit and convert it to a qutrit. The Google Cirq quantum computing platform^{38} provides quantum simulation using qudits and corresponding gates. Rigetti’s quantum computation supports the activation, gate implementation and measurement on a real qutrit^{39}. All the above imply that the qutritbased quantum computing is imminent, and these motivate us to use qutrits in quantum representation of images.
Our encoding scheme also explores the possibility of using both qubits and qutrits to encode the pixel position and color information, thus giving rise to a hybrid qubitqutrit circuit. We call this a Hybrid Qudit Quantum Representation (HQDQR) of RGB images. The elementary gates of a hybridqudit system has been discussed before^{25,26}. In this manuscript, we show the decomposition of higherorder hybrid qudit gates in terms of elementary singlequdit and hybrid twoqudit gates. This in turn shows that, the number of elementary gates needed for our proposed image encoding is much less compared to the other existing RGB image representations. Thus, HQDQR uses minimum number of quantum units as well as minimum number of gates to encode an RGB image. The complexity of the image encoding process is linear in the number of pixels.
The paper is organized as follows. In Section “Methods” we revisit some elementary gates of qutrit and hybrid qubitqutrit quantum circuit, and show their decomposition in terms of elementary singlequdit and twoqudit gates. In Section “Model” we briefly discuss the existing RGB image representations. Following that we introduce our hybrid qudit representation, calculate the complexity of the image encoding process and discuss the image compression. Additionally, we present some basic RGB image operations using our image representation. In Section “Experiment”, we present the results of testing the image encoding and retrieval in the Cirq quantum simulator. Finally, we conclude in section “Discussion”.
Methods
In this section, we present preliminary concept of quantum gates used in a quantum circuit constituted of qudits, which will be useful in order to describe our image representation. The gates used in a quantum circuit apply an unitary transformation on the input state. In case of qubits, any unitary transformation can be asymptotically achieved by repeatedly applying a set of single and twoqubit elementary gates, allowing a certain amount of error. These elementary gates are called universal gates for qubits. The idea of universality can be extended to qudits. In fact a number of works have proposed the universal gates in a qudit circuit^{1,7,20,22}. However, the mathematical idea of universality may not always be suitable to apply for physically realizing a complex quantum circuit. In practice, the gates used to achieve a unitary operation on any number of qudits should be easy to realize experimentally and should have hight fidelity, so that it can be implemented efficiently in a real quantum hardware. There has been a number of experimental proposals to realize basic qudit gates in laboratory.
The above works assume that the all the qudits in a circuit has the same dimension d. In principal, it is possible to build a circuit with different dimensional qudits. A few works discuss the basic gates in a hybrid qudit circuit, and quantum computation using such systems^{25,26}.
Quantum computation in qutrit systems
The Hilbert space of a threelevel quantum system or Qutrit is spanned by the orthogonal basis vectors \(\{0\rangle , 1\rangle , 2\rangle \}\). The elementary and universal qutrit gates, and the possibility of their physical realization, have been investigated^{1,20,22,40,41,42,43}.
Single qutrit gates
Ternary bitflip gates:
In analogy to the qubit bitflip or X gate, the ternary X gate flips the basis states of a qutrit.
There are six ternary X gates as listed below^{36,40},
The first one is identity operator which does not change anything. The operators \(\{\sigma ^{x}_{+1}, \sigma ^{x}_{+2}\}\) transform the basis \(x\rangle \) by \(x\rangle \rightarrow (x+1)\mod 3\rangle \) and \(x\rangle \rightarrow (x+2)\mod 3\rangle \) respectively, and work on all the basis states simultaneously. Lastly, \(\{\sigma ^{x}_{01}, \sigma ^{x}_{12}, \sigma ^{x}_{02}\}\) swaps the two basis states \(\{i\rangle ,j\rangle \}\) in the subscript of \(\sigma ^{x}_{ij}\), while leaving the third basis state unchanged. Following earlier works, we will use a simple notation for the above gates in the circuit diagrams which is shown in Fig. 1a.
Ternary Hadamard gate:
The Hadamard gate \(H_{2}\) in a twodimensional Hilbert space \({\mathscr {H}}_{2}\) is the quantum Fourier transform of the computational basis to the eigenbasis of Pauli matrix \(\sigma ^{x}\). In an analogous way, the ternary Hadamard gate \(H_{3}\) in the Hilbert space \({\mathscr {H}}_{3}\) can be defined as the following,
An experimental realization of this gate has been possible^{41} using superconducting qutrits.
Twoqutrit gates
Ternary controlled X gates:
A binary controlled X gate is a twoqubit gate that performs bitflip operation X on the target qubit, only if the control qubit is in state \(\vert 1\rangle \). The above is the standard notion, although it can be configured so that the target qubit is flipped only when the control qubit is in state \(0\rangle \). In a qutrit, there are 18 different generalized controlled X operations (three possible control states and six target flips for each of them), each of them being a \(9\times 9\) unitary matrix. As an example, if we want to flip the target qutrit state from \(0\rangle \) to \(1\rangle \) when the control qutrit state is \(2\rangle \), the corresponding unitary will be,
where \(\mathbb {I}_{d}\) is a ddimensional identity operator. The rest 17 unitaries can be constructed in a similar way.
Quantum computation in hybrid qubitqutrit systems
In a hybrid quantum system constituted of both qubits and qutrits, the single qudit gates remain unchanged. However, there can exist two or multiqudit gates which act on a composite system of qubits and qutrits.
Twoqudit hybrid gates
Hybrid controlled X gate:
For this class of gates, the control can be a qubit and the target can be a qutrit, or the vice versa. Suppose, if the control qubit is in state \(1\rangle \), \(\sigma ^{x}_{12}\) is applied on the target qutrit. The corresponding unitary is,
On the other hand, if the control is on the qutrit and the target is a qubit, and the qubit state flips when the control qutrit is in state \(2\rangle \), then the unitary can be expressed as,
where \(\sigma ^{x}\) is the qubit X gate. This unitary is same as that in Eq. (4), but as we will see in the upcoming subsections, this may not always be the case.
Multiqudit hybrid gates
Hybrid Toffoli gates:
Now suppose that there are one control qubit and one control qutrit, while the target is a qutrit. If the control qudits are respectively in state \(1\rangle \) and \(2\rangle \), the target qutrit undergoes the bitflip operation \(\sigma ^{x}_{12}\). This is analogous to the Toffoli gate or controlled controlled X gate for qubits, and we will call it hybrid Toffoli gate in this paper. It can be decomposed using simpler singlequdit and hybrid twoqudit gates. We show such a decomposition in Fig. 1b, where there are two control qubits and a target qutrit. The decomposition uses one auxiliary qutrit. If there are n control qudits, we will need \((n1)\) auxiliary qutrits. The last two hybrid gates are applied on the auxiliary qutrit to bring it back in the initial state \(0\rangle \), so that it can be used for the decomposition of another gate. In Fig. 1c, we show the decomposition of a higher order hybrid Toffoli gate in which the control is on two qubits and a qutrit, and the target is a qutrit.
Theorem 1
The complexity of a hybrid Toffoli gate with n number of control qubits and qutrits is \(4n3\).
Proof
There are n controlled X gates from n control qudits to the auxiliary qutrits, and total \(n2\) controlled X gates among all the adjacent pairs of auxiliary qutrits. The same number of gates are applied to bring back the auxiliary qutrits in state \(0\rangle \). There is one controlled X gate between the last auxiliary qutrit and the target qudit. So, the total number of gates used is \(2(n+(n2))+1=4n3\). \(\square \)
Generalized hybrid Toffoli gates:
For the case discussed above, we assumed that for a control qubit and a control qutrit, the Toffoli gate is activated when the control states are respectively \(1\rangle \) and \(2\rangle \), i.e. when the control qudits are in their highest state. In principal, the gates can be designed to be activated for any of the control states \(\{0\rangle , 1\rangle ,..., d1\rangle \}\) of a qudit. We call such gates generalized hybrid Toffoli gates. The decomposition of a generalized hybrid Toffoli gate is shown in Fig. 2, where 2k single qudit gates, k being the number of controls with generalized bitvalues, and a higher order hybrid Toffoli gate have been used. The later can be further decomposed in terms of the hybrid twoqudit gates using auxiliary qutrits as shown in Fig. 1c.
Lemma 1
The complexity of a generalized higher order hybrid Toffoli gate with n control qubits and qutrits is \(4n3+2k\). The maximum value is \(6n3\), reached when \(k=n\).
In^{44}, the authors demonstrate that the higher order Toffoli gates for qubits can be synthesized without any auxiliary quantum system, if the third energy levels of these qubits are activated. This extra energy level is used only in the intermediate steps to store information, while the input and the output of the circuit remains in the same dimensional Hilbert space. The authors also show that such a circuit has depth \(\log N\) for synthesizing a higher order Toffoli gate acting on N qubits. Clearly, the decomposition of a hybrid qubitqutrit gate can facilitate from a lower circuit depth and less number of elementary gates by using effective qutrits in place of qubits. Such a decomposition is shown in Fig. 3.
Theorem 2
The complexity of a hybrid Toffoli gate with \(n_{1}\) control qubits ( or, \(n_1 1\) effective qutrits ) and \(n_{2}\) control qutrits is \(2n+2n_{2}1\), where \(n=n_1 + n_2\).
Proof
As evident from Fig. 3b, the number of auxiliary qutrits needed in this case is \(n_{2}\). There are \(n_{1}1\) controlled X gates between \(n_{1}\) control qubits, and 2 controlled X gates for each of the \(n_{2}\) qutritauxiliary qutrit pair. Thus, the total number of gates is \(2(n_{1}1+2n_{2})+1=2n+2n_{2}1\). \(\square \)
The improvement in the number of gates by using effective qutrits is \(4n3(2n+2n_{2}1)=2n_{1}2\).
Lemma 2
The complexity of a generalized higher order hybrid Toffoli gate with \(n_{1}\) control qubits (\(n_1 1\) effective qutrits) and \(n_2\) control qutrits is \(2n+2n_{2}2+2k\).
Model
Equipped with the necessary tools to design hybrid qubitqutrit circuit, in this section, we describe our proposed RGB image representation. Before that we briefly discuss some of the existing RGB image representations, to make a clear comparison of our representation with the existing approaches. We do not discuss here the angular representation like FRQI, and stick to the encoding methods corresponding to deterministic image retrieval which is relevant for our work.
Multichannel representation for images on quantum computers (MCQI)
In this representation^{31}, a \(2^{n}\times 2^{n}\) dimensional RGB image is encoded using \(2n+3\) qubits. The first 3 qubits encode the intensities of the three channels \(\{\textrm{R, G, B}\}\) and the rest 2n qubits encode the positions. The intensities of the three channels are encoded using the angles \(\theta _{i}\) (\(i=R,G,B\)). The quantum state corresponding to the image is the following,
where \(X\rangle \) and \(Y\rangle \) are the \(2^{n}\) basis states of an nqubit system, and \(\theta _{i}\) lies in the range \([0, \pi /2]\). The 3qubit register has 8 basis states, from which six are used to encode the color information, and the coefficients corresponding to \(011\rangle \) and \(111\rangle \) are set as constants \(\sin 0\) and \(\cos 0\), so that they do not carry any information. To retrieve the images, one has to perform repeated measurements on all the three color qubits to probabilistically obtain the coefficients \(\cos \theta _{i}\) and \(\sin \theta _{i}\). Because of the probabilistic nature of the output, such an image retrieval is not accurate, and large number of measurements are required to reach a particular accuracy.
Novel quantum representation of color digital images (NCQI)
This encoding method^{33} is inspired from NEQR, where the intensities of each channel is encoded using the basis vectors of 8 qubits. So, in total there are 24 qubits needed to encode the color of a pixel. For a \(2^{n}\times 2^{n}\) dimensional image, the positions are encoded using 2n qubits. So, the total number of qubits in \(2n + 24\). The quantum state corresponding to a \(2\times 2\) image looks like the following,
where \(C_{XY}\rangle =C^{q1}_{XY}...C^{1}_{XY}C^{0}_{XY}\rangle \), \(C=\{R, G, B\}\) and \(q=8\). A projective measurement on the position and the color qubits can accurately retrieve the pixel positions and corresponding pixel colors and intensities. However, one should note that while using the real quantum processors for retrieving the images, one still has to perform a finite number of repeated measurements to obtain all the basis vectors corresponding to the intensities.
The time complexity of preparing quantum images using NCQI is quadratically less compared to that using MCQI. This advantage is analogous to the advantage of NEQR over FRQI. Also, NCQI allows for more complex color transformations, and solves the problem of probabilistic retrieval of pixel values. A limitation of both the above representations is that they consider only square images. To generalize this for rectangular images, an improved encoding method has been proposed^{35}.
Optimized quantum representation of color images
In this encoding method^{34}, the color information is stored using two entangled quantum registers. The first register with two qubits encodes the channel information, while the second register with eight qubits encodes the intensity of that channel. The pixel positions are again encoded using 2n qubits for a \(2^{n}\times 2^{n}\) classical image. The quantum image state is,
where \(C_{XY}\rangle \) \((C=R, G, B)\) is the same as defined for NCQI. This representation uses only 10 qubits to encode the colors, which is a significant improvement over NCQI.
Hybridqudit representation of color images (HQDQR)
Recently there has been a proposal of a novel qutrit representation of greyscale images^{36}, in which both the pixel positions and pixel values are encoded using qutrits. Compared to 8 qubits in NEQR, it needs at least 6 qutrits to encode the 256 shades of grey. Since \(3^6 > 256 \), a number of the energy levels remain redundant, which can be used for error correction. In this work, we show that a total of 7 qutrits are required to encode the color information of an RGB image. The color channel \(\{\textrm{R,G,B}\}\) can be encoded using the three levels of a qutrit. With this qutrit, a register of 6 qutrits is entangled, which encodes the information about the intensity of each color. Additionally, we consider rectangular images instead of square ones, for which the pixel positions can be encoded using quantum registers constituted of only qubits or qutrits, or both where it is appropriate.
First, we consider the most general case of an \(M \times N\) dimensional classical image such that \(M=3^{m}\) and \(N=2^{n}\). The initial quantum state of all the three registers is,
Now, Hadamard operator \(H_{3}^{\otimes m} \otimes H_{2}^{\otimes n}\) is applied on the qudits of the last register to transform the state of this register to a fully superposed state.
Now, \({\mathscr {H}}_{3}\) is applied on the second register to prepare the following state,
We assume that the states \(0\rangle \), \(\vert 1\rangle \) and \(\vert 2\rangle \) represent respectively the color channels R, G and B. In the next step, for each pixel position \(YX\rangle \) and for each color channel, a number of controlled X operations is used to flip the qutrits in the first register, where the control lies on the qudits in the first and second register. We can express this operation as,
where \(\Omega _{XY}=\bigotimes \limits _{i=0}^{5}\Omega _{XY}^{i,C}\), \(C_{XY}\rangle = C^{5}_{XY}C^{4}_{XY}..C^{0}_{XY}\rangle \), \(C=\{R, G, B\}\), and each \(\Omega _{XY}^{i,C}\) is a higher order generalized hybrid Toffoli gate flipping the \(i^{\textrm{th}}\) qubit of the color channel C, in position \(YX\rangle \). Equation (12) is our desired quantum representation. As an example, we consider a \(3\times 2\) dimensional RGB image shown in Fig. 4 and its corresponding quantum image state \(I\rangle \). The different steps for encoding this image are shown in Fig. 5, where each block surrounded by thin rectangular border stands for one particular pixel position. Thus, by the full use of quantum superposition and entanglement, in place of 24 qubits needed to store the RGB color information, we need only 7 qutrits, when enough auxiliary qutrits are available. Note that, this encoding method works whenever \(M \times N \le 2^{n}\times 3^{m}\), for which the extra basis states in Eq. (10) corresponds to extra pixels in the quantum image for which all three color channels have intensity 0.
Special cases
Above we considered both qubits and qutrits to encode the pixel positions of a rectangular image. However, depending on the dimension of the image, it might be optimum to use only qubits or only qutrits to encode the positions, to minimize the redundancy in the number of energy levels. In this following subsection, we discuss the quantum representation for RGB images in such cases.
Allqubit third register
Suppose the dimension of an image is \(M\times N\) such that \(M=2^{m}\) and \(N=2^{n}\). The quantum image state in this case becomes,
The generalized higher order Toffoli gates now has only qubits as the control, and a qutrit as the target. It is possible to decompose such gates using auxiliary qutrits as shown in Fig. 1, and using effective qutrits as in Fig. 3. One can also use auxiliary qubits, the decomposition then can be obtained in terms of Toffoli gates and hybrid Toffoli gates, as shown in Fig. 6. Of course, one can use an extra auxiliary qubit to decompose the Toffoli gate in Fig. 6 into controlledX gates. We choose to use Toffoli gate since it is already known that a higher order Toffoli gate with p (\(p>2\)) controls, can be decomposed into \(4p8\) Toffoli gates, when \(p2\) auxiliary qubits are present^{45}.
Allqutrit third register
If the image dimension is such that \(M=3^{m}\) and \(N=3^{n}\), the quantum image state becomes,
The generalized higher order Toffoli gates acts only on qutrits in this case, both as control and target. We do not show the decomposition of these gates, because it can be obtained in the same way as shown in Figs. 1 and 2.
Complexity of the encoding method
We analyze the complexity of the quantum image encoding method in two steps.

1.
There are \(m+n+1\) single qudit gates applied in the first step to encode the pixel positions and color channels, the complexity of which is \({\mathscr {O}}(m+n+1)\).

2.
There are \(2^{n}\times 3^{m}\) pixels, each pixel having three channels. For each channel, one needs to flip maximum 6 qutrits to encode the intensity. So the maximum number of generalized higher order hybrid Toffoli gates required for each channel is 6. Now, a generalized higher order hybrid Toffoli gate with \(m+n+1\) control qudits can be decomposed using maximum of \((6(m+n+1)3)\) elementary gates. So the total complexity of this step is no more than \((18(2^{n}\times 3^{m})(6(m+n+1)3)\) which is \({\mathscr {O}}(N)\), i.e. linear in the number of pixels.
So, the total complexity of the image encoding process is \({\mathscr {O}}(N)\). It is to be noted that, though the NCQI and OCQR encoding method discussed earlier has similar order of complexity, the number of elementary gates used for encoding is much less for HQDQR. A comparison between different RGB image representations and the number of elementary gates used has been presented in Table 1. From the table, it is easy to see that, the total number of pixels \(2^{2n}\) or \(2^{n}\times 3^{m}\) remains common for all complexity values, but the multiplication factor is smallest for HQDQR.
Let us compare the depth of the HQDQR encoding circuit with the depth of other encoding methods. All the representations in Table 1 uses a layer of singlequbit gates in the first step to prepare the superposition of pixel positions, which adds unit depth to the circuit. Following that, controlled gates are applied consecutively in time which encode the pixel values. Thus, the time depth of an encoding circuit mainly depends on the number of controlled gates used. From Table 1, it is clear that MCQI uses maximum number of gates (quadratic in pixel number), thus having maximum depth. The depth of NCQI and OCQR are comparable to each other, especially in the limit \(n \gg 1\). As discussed in the last paragraph, HQDQR uses least number of elementary gates, so the time depth of HQDQR is minimum compared to the other three encoding methods.
Image compression
The complexity of the encoding method, being linear in the number of pixels, becomes significantly high for highresolution images. It is possible to drastically reduce the number of necessary gates for the encoding by using the minimization of logical functions. Here, the logical functions correspond to the bit values of pixel positions. This is a classical procedure, which has been previously discussed in^{30,32,36} for images encoded using only qubits or qutrits. For our proposed representation, however, both qubits and qutrits are used to encode the pixel positions. Hence, for the bestachieved compression, we must employ an algebra applicable on a combination of binary and ternary logical variables. In the following, we briefly explain the idea of image compression for a simple exemplary image.
To start with, let us consider a \(2\times 3\) greyscale image as shown in Fig. 7a. In Fig. 7b–g we show the 6 bitplanes corresponding to 6 qutrits in the first register, i.e. the \(i^{\textrm{th}}\) bitplane shows the state of the \(i^{\textrm{th}}\) qutrit for all the pixel positions. Let us denote the ternary states \(\{0, 1, 2\}\) respectively by \(\{x_{+}, x_{0}, x_{}\}\), and the binary states \(\{0, 1\}\) by \(\{x, {\overline{x}}\}\). Now we consider Fig. 7b, in which all the pixels along the \(1^{\textrm{st}}\) column has state \(1\rangle \) for the first qutrit. The pixel positions along this particular column are \(\vert 00\rangle \), \(\vert 10\rangle \) and \(\vert 20\rangle \) respectively. It requires 3 generalized Toffoli gates to set the intensities of these three pixels. However, if we consider the sum S of the logical expressions of these pixel positions, and apply the ternary logic algebra^{46} as shown below,
we see that instead of using three generalized Toffoli gates, we can encode these pixels by using a single controlledX gate, where the control is only on the position qubit being in state \(\vert 0\rangle \). Similarly, in the first row of Fig. 7b, the pixels positions are \(\vert 00\rangle \) and \(\vert 01\rangle \). We use the minimization of the logical expression as following
so that these two pixels can be encoded using one ternary controlled X gate, where the control is on the position qutrit being in state \(\vert 0\rangle \). This idea of image compression for greyscale intensities is translated into RGB image by following the same procedure for each of the color channel intensities. The best achievable compression depends on both the image as well as the encoding method. For example, in^{30} the authors achieve \(90.63\%\) compression, whereas in^{32} the compression obtained was \(97.28\%\), and the compression obtained using qutrits in^{36} was \(47.26\%\).
Basic color image processing
In this section, we demonstrate some common RGB image operation using HQDQR encoding.
Channel swapping
The color channel swapping operation CSO is performed to swap the intensities of any two color channels. For our quantum image representation, it can be achieved by applying one of qutrit X gates \(\{\sigma ^{x}_{01},\sigma ^{x}_{12},\sigma ^{x}_{02}\}\), whichever applies. For example, to swap the red and green channel, one needs to apply \(\sigma ^{x}_{01}\) on the second register.
For swapping red and blue channel on the other hand, we have to apply \(\sigma ^{x}_{02}\). The computational complexity of this operation is \({\mathscr {O}}(1)\).
One channel operation
The one channel operation OCO performs a particular transformation to any one of the color channel intensities. For example, the red channel can be transformed by the following,
where \(R^{\prime }_{XY}\rangle =R_{XY}^{\prime 5}..R_{XY}^{\prime 0}\rangle \) is the new intensity of the red channel. This is achieved by using a higher order hybrid Toffoli gate with \(m+n+1\) control qudits and a maximum of six target qutrits.
Experiment
To test our proposed image encoding in an ideal quantum system, we use Google Cirq’s quantum simulator, which provides an architecture of hybrid qudits and corresponding gates. The simulator is a classical simulator which mimics the behaviour of a quantum computer. We build the circuit of Fig. 5, and measure all the registers to retrieve the image state. The result is presented in Fig. 8a. The probability amplitudes of the resulting peaks fluctuate around the expected value \(\big (\frac{1}{3\sqrt{2}}\big )^{2}\approx 0.0556\). This fluctuation may arise because of the random number generator used in the measurement constructor in Cirq. The state for which all the indiviadual qubits and qutrits are in state \(\vert 0\rangle \) does not appear in \(\vert I\rangle \), although it appears in the measurement outcome with negligible probability. We calculate the fidelity F of the quantum state vector generated from the simulated circuit with respect to \(\vert I \rangle \) and get the value \(F \approx 1\) in this case.
Next, we test the performance of the HQDQR image encoding circuit in presence of noise. We take into account two types of error that can occur in a quantum circuit. The first one is gate error which occurs due to the imperfect implementation of a gate. The other is idle error which occurs due to the decoherence and energy dissipation of a qudit because of its interaction with the environment. In our noise simulation, we model the gate error using depolarizing channel and the idle error using amplitude damping and phase damping channel.
Depolarizing channel: When a quantum state \(\rho \) is subject to depolarizing channel, it evolves to a mixture of itself and other evolved states due to a number of different noise channels. For a qubit the most general effect of depolarizing channel can be expressed in the Kraus operator form as \(\rho \rightarrow (1p_{x}p_{y}p_{z})\rho + \frac{p_{x}}{3}\sigma _{x}\rho \sigma _{x}^{\dagger } + \frac{p_{y}}{3}\sigma _{y}\rho \sigma _{y}^{\dagger } + \frac{p_{z}}{3}\sigma _{z}\rho \sigma _{z}^{\dagger }\), where \(p_{x}\), \(p_{y}\) and \(p_{z}\) are the strengths of bitflip (\(\sigma _{x}\)), bitphase flip (\(\sigma _{y}\)) and phaseflip (\(\sigma _{z}\)) channel respetively. We consider symmetric depolarizing channel for which \(p_{x}=p_{y}=p_{z}\). For a qutrit depolarizing channel, the Kraus operators are Cartesian product of \(\{\mathbb {I}_{3}, \sigma _{+1}^{x}, (\sigma _{+1}^{x})^{2}\}\) and \(\{\mathbb {I}_{3}, z, z^{2}\}\) where
Thus the qutrit depolarizing channel is a combined effect of 8 different error channels. The two qutrit depolarizing channel Kraus operators can be obtained by taking the Cartesian product of the singlequtrit depolarizing channel Kraus operators. Similarly, the qubitqutrit depolarizing channel is obtained from the Cartesian product of singlequbit and singlequtrit Kraus operators. More details on the qutrit depolarizing channel can be found in the paper by Gokhale et al.^{44}.
Amplitude damping channel: The amplitude damping channel models the transition of a qudit from higher energy levels to lower energy levels. For a qubit, the only possible transition is \(\vert 1\rangle \rightarrow \vert 0\rangle \) with decay probability \(\lambda \). The Kraus operators for a qubit amplitude damping channel are
for a qutrit there is additional transition \(\vert 2\rangle \rightarrow \vert 1\rangle \) with decay probability \(\lambda _{21}\). We do not consider the transition \(\vert 1\rangle \rightarrow \vert 0\rangle \) since it is comparatively suppressed is SC transmon qudits^{47}, which is for example used in IBMQ processors. The Kraus operators of a qutrit amplitude damping channel are
Phase damping channel: Phase damping or dephasing is the main source of decoherence in a qudit. Due to phase damping the offdiagonal elements of the density matrix decays with time and eventually a pure state becomes a mixed state. The Kraus operators for a qubit Phase damping channel are
The Kraus operators of a qutrit phase damping channel are the following.
The dephasing rate \(\gamma \) is different for a qubit and a qutrit.
The decay probabilities \(\lambda _{ij}\)s and the dephasing rate \(\gamma \) depend on the gate time \(\Delta t\) of single or twoqudit gates, the relaxaton time \(T_{1}\) and pure dephasing time \(T_{\phi }\) respectively according to the equations,
Here \(T_{1}^{ij}\) is the relaxation time between energy levels \(\vert i\rangle \) and \(\vert j\rangle \). In Table 2, we present the values of the noise parameters in the currently functional or experimentallevel SC qudit quantum processors. In IBMQ qubit processors, both \(T_{1}\) and total dephasing time \(T_{2}\) varies in the wide range from several tens of \(\mu \textrm{s}\) to 150 \(\mu \textrm{s}\). We work with an intermediate value of \(T_{1} = T_{2} \approx 100 \mu \textrm{s}\). Thus the pure dephasing time becomes \(T_{\phi } = (\frac{1}{T_{2}}  \frac{1}{2T_{1}})^{1} \approx 200 \mu \textrm{s}\). The singlequbit and twoqubit gate errors in IBMQ processors are of the order of \(10^{4}\) and \(10^{3}\) respectively. The \(T_{1}\), \(T_{2}\) and \(\Delta t\) corresponding to qutrits are collected from the work by Blok et al.^{47} and the noise strength is calculated using those values. The gate errors corresponding to qutrits are collected from the paper by Morvan et al.^{48}. Since we do not have the benchmarking data of a qubitqutrit gate, we take the depolarizing error rate of these gates to be same as a twoqutrit gate.
Cirq provides inbuilt functions for applying the qubit noise channels, whereas the qubitqutrit and qutrit noise channels are constructed by us in the Cirq framework using the Kraus operators. Before applying the error channels, we construct the circuit of Fig. 5 as a collection of Moments. In Cirq, a Moment is constituted of gates that act independently on different sets of qudits, thus they all act during the same abstract time slice. Each moment is then followed by application of gate errors corresponding to all the gates used in that moment, which is followed by application of idle errors on all the qudits. For more details on how the error channels are added to the circuit, please see the paper by Gokhale et al.^{44}.
We consider the following two scenarios for our noise simulation.

1.
All the noise parameters are chosen according to Table 2.

2.
Anticipating the improvement of noiserobustness in nearfuture SC quantum processors, we reduce all the noise strengths by one order of magnitude. This means for qubits the single and twoqubit gate errors become respectively \(10^{5}\) and \(10^{4}\), \(\lambda \) and \(\gamma \) becomes respectively \(10^{4}\) and \(10^{5}\). Similar changes follow for the qutrit noise parameters.
We present the results of the noise simulation for the above two scenarios in Fig. 9a and b respectively. From this, we see that the quantum image state preparation for the stateoftheart SC qudit quantum circuit is highly inefficient. A large number of peaks emerge in the output. Some of the peaks are relatively higher than others, but not all of them correspond to the quantum image state \(\vert I \rangle \). Looking at Table 2, the twoqutrit gate errors are highest which seems to contribute most to the noisy performance. The fidelity of the generated state is \(F = 0.054\). However, when we consider the improved noise regime, in spite of appearence of additional peaks with small probabilities, the basis states corresponding to the quantum image state shows much higher probabilities. In this case, the image preparation remains plausible, and the fidelity is \(F = 0.5377\).
It is crucial to check if the qubitonly image encoding methods perform better than HQDQR in the current SC qudit processors. For this, we compare HQDQR with OCQR. We choose OCQR over the other two encodings because MCQI has quadratic complexity, and NCQI requires 27 qubits to encode \(\vert I\rangle \) which greatly slows down the noise simulation. If we choose noise parameters according to Table 2, the fidelity of OCQR is \(F_{OCQR} = 0.1865\) which is higher than the corresponding HQDQR fidelity. Thus OCQR provides a better quantum image state preparation compared to HQDQR in current SC qudit processors. Again, the reason for this is the high twoqutrit gate errors. To verify this, we reduce twoqutrit gate errors to 0.01 keeping all other noise parameters unchanged. Now the fidelity for HQDQR becomes \(F =0.4793 \) which is much better than OCQR.
Interestingly, singlequbit gate error of the order of \(10^{5}\), and \(T_{1}\) and \(T_{2}\) times of orders of milisecond have already been observed in experiments with SC qubits^{49,50,51}. Also, the increasing interest in qutrit quantum computing implies that the improvement of qutrit quantum processors is imminent. Thus we can hope that the commercially available quantum processors in near future will achieve the improved noise regime we are considering here.
Discussion
Quantum image processing is a promising venture towards achieving speedup in image processing, which in turn is an indispensable task in a plethora of everyday applications. Standing in the era of NISQ devices, it is important to optimize the number of quantum units as well as the depth of a quantum circuit, in order to minimize the effect of noise in the output. In this work, we proposed Hybridqudit quantum representation (HQDQR) of RGB images, which uses only 7 qutrits to encode the information about color channels and their intensity. When compared with the existing encoding methods of RGB images with deterministic image retrieval, our representation uses least number of quantum units to encode the color information. Moreover, we considered both qubits and qutrits to encode the position information of the pixels, which can be an optimum choice while encoding a general rectangular image while keeping the number of redundant energy levels low. The complexity of HQDQR is polynomial in the number of pixels. We showed that HQDQR can be achieved by using much less number of elementary gates compared to the existing encoding methods, and it has the minimum circuit depth compared to them. The complexity can be further improved by using compression of logical expression corresponding to the pixel positions. Our noise simulation results show that in nearfuture SC quantum processors, HQDQR performs better than qubitonly image encoding methods. HQDQR naturally gives rise to a hybrid qubitqutrit circuit. We demonstrate decomposition of higher order qubitqutrit gates in terms of simpler single qudit and twoqudit gates in these systems. HQDQR can be used to check the performance of quantum convolutional neural networks for image classification. The current trend of research on higher dimensional quantum units and corresponding gates in these systems, indicates that quantum processing units including qudits will soon become available to users all over the world^{38}, and thus our work will be a strong candidate for processing of RGB images.
Data availability
All data generated or analysed during this study are included in the manuscript.
References
Muthukrishnan, A. & Stroud, C. R. Multivalued logic gates for quantum computation. Phys. Rev. A 62, 052309. https://doi.org/10.1103/PhysRevA.62.052309 (2000).
Leuenberger, M. N. & Loss, D. Quantum computing in molecular magnets. Nature 410, 789–793. https://doi.org/10.1038/35071024 (2001).
Bartlett, S. D., de Guise, H. & Sanders, B. C. Quantum encodings in spin systems and harmonic oscillators. Phys. Rev. A 65, 052316. https://doi.org/10.1103/PhysRevA.65.052316 (2002).
Klimov, A. B., Guzmán, R., Retamal, J. C. & Saavedra, C. Qutrit quantum computer with trapped ions. Phys. Rev. A 67, 062313. https://doi.org/10.1103/PhysRevA.67.062313 (2003).
Ralph, T. C., Resch, K. J. & Gilchrist, A. Efficient Toffoli gates using qudits. Phys. Rev. A 75, 022313. https://doi.org/10.1103/PhysRevA.75.022313 (2007).
Gottesman, D. Faulttolerant quantum computation with higherdimensional systems. In Selected Papers from the First NASA International Conference on Quantum Computing and Quantum Communications, QCQC ’98, 302313 (SpringerVerlag, Berlin, Heidelberg, 1998).
Luo, M. & Wang, X. Universal quantum computation with qudits. Sci. Chin. Phys. Mech. Astron. 57, 1712–1717. https://doi.org/10.1007/s1143301455519 (2014).
Luo, M.X., Chen, X.B., Yang, Y.X. & Wang, X. Geometry of quantum computation with qudits. Sci. Rep. 4, 4044. https://doi.org/10.1038/srep04044 (2014).
Dogra, S. & Dorai, K. Determining the parity of a permutation using an experimental NMR qutrit. Phys. Lett. A 378(46), 3452–3456. https://doi.org/10.1016/j.physleta.2014.10.003 (2014).
Gedik, Z. et al. Computational speedup with a single qudit. Sci. Rep. 5, 14671. https://doi.org/10.1038/srep14671 (2015).
Adcock, M. R., HØyer, P. & Sanders, B. C. Quantum computation with coherent spin states and the close hadamard problem. Quantum Inf. Process. 15, 1361–1386. https://doi.org/10.1007/s1112801512290 (2016).
Lu, H.H. et al. Quantum phase estimation with timefrequency qudits in a single photon. Adv. Quantum Technol. 3(2), 1900074. https://doi.org/10.1002/qute.201900074https://onlinelibrary.wiley.com/doi/abs/10.1002/qute.201900074 (2019).
Gao, X., Erhard, M., Zeilinger, A. & Krenn, M. Computerinspired concept for highdimensional multipartite quantum gates. Phys. Rev. Lett. 125, 050501. https://doi.org/10.1103/PhysRevLett.125.050501 (2020).
Wang, Y., Hu, Z., Sanders, B. C. & Kais, S. Qudits and highdimensional quantum computing. Front. Phys.https://doi.org/10.3389/fphy.2020.589504 (2020).
Narvaez, C. E. Q. Universality for sets of threevalued qubit gates, https://doi.org/10.48550/ARXIV.2109.07282 (2021).
Su, Q.P., Zhang, Y., Bin, L. & Yang, C.P. Hybrid controlledsum gate with one superconducting qutrit and one catstate qutrit and application in hybrid entangled state preparation. Phys. Rev. A 105, 042434. https://doi.org/10.1103/PhysRevA.105.042434 (2022).
GonzálezCuadra, D., Zache, T. V., Carrasco, J., Kraus, B. & Zoller, P. Hardware efficient quantum simulation of nonabelian gauge theories with qudits on Rydberg platforms. Phys. Rev. Lett. 129, 160501. https://doi.org/10.1103/PhysRevLett.129.160501 (2022).
Karácsony, M., Oroszlány, L. & Zimborás, Z. Efficient qudit based scheme for photonic quantum computing (2023). Preprint at arXiv:2302.07357.
Cao, S. et al. Emulating two qubits with a fourlevel transmon qudit for variational quantum algorithms (2023). Preprint at arXiv:2303.04796.
Kerntopf, P., Perkowski, M. & Khan, M. On universality of general reversible multiplevalued logic gates. In Proceedings. 34th International Symposium on MultipleValued Logic, 68–73, https://doi.org/10.1109/ISMVL.2004.1319922 (2004).
Bullock, S. S., O’Leary, D. P. & Brennen, G. K. Asymptotically optimal quantum circuits for \(d\)level systems. Phys. Rev. Lett. 94, 230502. https://doi.org/10.1103/PhysRevLett.94.230502 (2005).
Di, Y.M. & Wei, H.R. Elementary gates for ternary quantum logic circuit (2012). Preprint at arXiv:1105.5485.
Li, W.D., Gu, Y.J., Liu, K., Lee, Y.H. & Zhang, Y.Z. Efficient universal quantum computation with auxiliary Hilbert space. Phys. Rev. A 88, 034303. https://doi.org/10.1103/PhysRevA.88.034303 (2013).
Mischuck, B. & Mølmer, K. Qudit quantum computation in the Jaynescummings model. Phys. Rev. A 87, 022341. https://doi.org/10.1103/PhysRevA.87.022341 (2013).
Daboul, J., Wang, X. & Sanders, B. C. Quantum gates on hybrid qudits. J. Phys. A: Math. Gen. 36, 2525–2536. https://doi.org/10.1088/03054470/36/10/312 (2003).
Khan, F. S. & Perkowski, M. Synthesis of multiqudit hybrid and dvalued quantum logic circuits by decomposition. Theor. Comput. Sci. 367, 336–346. https://doi.org/10.1016/j.tcs.2006.09.006 (2006).
Dogra, S., Dorai, A. & Dorai, K. Implementation of the quantum Fourier transform on a hybrid qubitqutrit NMR quantum emulator. Int. J. Quant. Inf. 13, 1550059–394. https://doi.org/10.1142/S0219749915500598 (2015).
Zhang, Y., Lu, K. & Gao, Y. Qsobel: A novel quantum image edge extraction algorithm. Sci. Chi. Inf. Sci. 58, 1–13. https://doi.org/10.1007/s1143201451589 (2015).
Yao, X.W. et al. Quantum image processing and its application to edge detection: Theory and experiment. Phys. Rev. X 7, 031041. https://doi.org/10.1103/PhysRevX.7.031041 (2017).
Le, P. Q., Dong, F. & Hirota, K. A flexible representation of quantum images for polynomial preparation, image compression, and processing operations. Quantum Inf. Process. 10, 63–84. https://doi.org/10.1007/s111280100177y (2011).
Sun, B. et al. A multichannel representation for images on quantum computers using the rgb\(\alpha \) color space. In 2011 IEEE 7th International Symposium on Intelligent Signal Processing, 1–6, https://doi.org/10.1109/WISP.2011.6051718 (2011).
Zhang, Y., Lu, K., Gao, Y. & Wang, M. NEQR: A novel enhanced quantum representation of digital images. Quantum Inf. Process. 12, 2833–2860. https://doi.org/10.1007/s111280130567z (2013).
Sang, J., Wang, S. & Li, Q. A novel quantum representation of color digital images. Quantum Inf. Process. 16, 1–14. https://doi.org/10.1007/s1112801614630 (2017).
Liu, K., Zhang, Y., Lu, K., Wang, X. & Wang, X. An optimized quantum representation for color digital images. Int. J. Theor. Phys. 57, 2938–2948. https://doi.org/10.1007/s1077301838134 (2018).
Su, J., Guo, X., Liu, C., Lu, S. & Li, L. An improved novel quantum image representation and its experimental test on IBM quantum experience. Sci. Rep. 11, 13879. https://doi.org/10.1038/s41598021934717 (2021).
Dong, H., Lu, D. & Li, C. A novel qutrit representation of quantum image. Quantum Inf. Proc. 21, 108. https://doi.org/10.1007/s11128022034508 (2022).
Richards, R. Arithmetic Operations in Digital Computers (Creative Media Partners, LLC, 2021).
Developers, C. Cirq, https://doi.org/10.5281/zenodo.6599601 (2022). See full list of authors on Github: https://github.com/quantumlib/Cirq/graphs/contributors.
Rigetti computing. https://www.rigetti.com/.
Khan, M. A., Kerntopf, P. & Perkowski, M. A. Multioutput galois field sum of products synthesis with new quantum cascades. In 2013 IEEE 43rd International Symposium on MultipleValued Logic, 146, https://doi.org/10.1109/ISMVL.2003.1201399 (IEEE Computer Society, Los Alamitos, CA, USA, 2003).
Yurtalan, M. A., Shi, J., Kononenko, M., Lupascu, A. & Ashhab, S. Implementation of a walshhadamard gate in a superconducting qutrit. Phys. Rev. Lett. 125, 180504. https://doi.org/10.1103/PhysRevLett.125.180504 (2020).
Goss, N. et al. Highfidelity qutrit entangling gates for superconducting circuits, https://doi.org/10.48550/ARXIV.2206.07216 (2022).
Luo, K. et al. Experimental realization of two qutrits gate with tunable coupling in superconducting circuits, https://doi.org/10.48550/ARXIV.2206.11199 (2022).
Gokhale, P. et al. Asymptotic improvements to quantum circuits via qutrits. In Proceedings of the 46th International Symposium on Computer Architecture, ISCA ’19, 554566, https://doi.org/10.1145/3307650.3322253 (Association for Computing Machinery, New York, NY, USA, 2019).
Yang, G., Song, X., Hung, W. N. N., Xie, F. & Perkowski, M. A. Group theory based synthesis of binary reversible circuits. In Theory and Applications of Models of Computation (eds Cai, J.Y. et al.) (Springer, 2006).
Vranesic, Z., Lee, E. & Smith, K. A manyvalued algebra for switching systems. IEEE Trans. Comput. c–19, 964–971 (1970).
Blok, M. S. et al. Quantum information scrambling on a superconducting qutrit processor. Phys. Rev. X 11, 021010. https://doi.org/10.1103/PhysRevX.11.021010 (2021).
Morvan, A. et al. Qutrit randomized benchmarking. Phys. Rev. Lett. 126, 210504. https://doi.org/10.1103/PhysRevLett.126.210504 (2021).
Barends, R. et al. Superconducting quantum circuits at the surface code threshold for fault tolerance. Nature 508, 500–503. https://doi.org/10.1038/nature13171 (2014).
Reagor, M. et al. Quantum memory with millisecond coherence in circuit qed. Phys. Rev. B 94, 014506. https://doi.org/10.1103/PhysRevB.94.014506 (2016).
Earnest, N. et al. Realization of a \(\rm \Lambda \) system with metastable states of a capacitively shunted fluxonium. Phys. Rev. Lett. 120, 150504. https://doi.org/10.1103/PhysRevLett.120.150504 (2018).
Acknowledgements
The work was financially supported by the European Union’s Horizon 2020 research and innovation programme under FETOPEN Grant Agreement No. 828946 (PATHOS). We acknowledge the use of Google Cirq platform.
Author information
Authors and Affiliations
Contributions
All authors made equal contribution to this paper.
Corresponding author
Ethics declarations
Competing interests
The authors declare no competing interests.
Additional information
Publisher's note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Rights and permissions
Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article’s Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article’s Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecommons.org/licenses/by/4.0/.
About this article
Cite this article
Das, S., Caruso, F. A hybridqudit representation of digital RGB images. Sci Rep 13, 13671 (2023). https://doi.org/10.1038/s41598023399069
Received:
Accepted:
Published:
DOI: https://doi.org/10.1038/s41598023399069
This article is cited by

Qutrit representation of quantum images: new quantum ternary circuit design
Quantum Information Processing (2024)
Comments
By submitting a comment you agree to abide by our Terms and Community Guidelines. If you find something abusive or that does not comply with our terms or guidelines please flag it as inappropriate.