1 Introduction

Along with the bright prospect of quantum computers [1, 2], quantum algorithms [3,4,5] and quantum image processing have inspired interest by researchers in recent years. Until the arrival of practical quantum computers, the first task in this direction was the construction of a pattern for capturing and storing the images on quantum computers.

A great number of research results concerning quantum image representation exist in the literature, i.e., Qubit Lattice [6], Entangled Image [7], Real Ket [8], a flexible representation for quantum images (FRQI) [9], multi-channel representation of quantum image (MCRQI) [10], a normal arbitrary quantum superposition state (NASS) [11], quantum representation for log-polar images [12], and a novel enhanced quantum representation (NEQR) [13].

During these existing quantum image models, one representative model refers to color image: multi-channel representation for quantum images (MCRQI) [10]. Inspired by FRQI, MCRQI is constructed on the basis of quantum rotation gate and it captures \(RGB\alpha \) channels information. But, MCRQI uses three qubits to store the color information for each pixel in an image, so some digital image processing operations, for example the complex color operations, cannot be performed based on MCRQI.

In this paper, a novel quantum representation for color digital images (NCQI) is proposed to improve the MCRQI model. The new representation utilizes the basis state of a qubit sequence to store the color value of every pixel. Hence, to store the color digital image in quantum computer, two entangled qubit sequences are employed to store the whole image, which denote the color value and position information of all the pixels. Through analyses and comparisons with MCRQI, the following advantages of NCQI have been demonstrated:

  1. 1.

    The time complexity of preparing the NCQI quantum image experiences an approximately quadratic decrease compared to MCRQI.

  2. 2.

    More image operations can be executed conveniently based on NCQI than MCRQI, especially some complex color transformation, such as addition (subtraction), compression, complement operation, feature extraction and so on.

Because of these advantages, the newly proposed model is more flexible and better suited to carry out quantum image processing operations.

The rest of the paper is organized as follows. Section 2 discusses the related work. Section 3 describes the newly proposed NCQI model, presents the procedures of quantum image preparation. Accurately color transformations based on NCQI and the comparisons with other models are depicted in Sect. 4. Finally, we draw conclusions and outline future research directions.

2 Related work

Based on the analysis of existing FRQI quantum image representation, a novel enhanced quantum representation (NEQR) for digital images is proposed [13]. NEQR uses the basis state of a qubit sequence to store the grayscale value of each pixel in the image for the first time, instead of the probability amplitude of a qubit, as in FRQI. Also NEQR employs two entangled qubit sequences to store the grayscale and position information and stores the whole image in the superposition of the two qubit sequences. Suppose that the gray range of an image is \(\left[ {0,2^q - 1} \right] \), binary sequence \(C_{yx}^{q - 1} C_{yx}^{q - 2} \cdots C_{yx}^1 C_{yx}^0 \) encodes the grayscale value \(f\left( {y,x} \right) \) of the corresponding pixel \(\left( {y,x} \right) \) as in Eq. (1):

$$\begin{aligned} f\left( {y,x} \right) = C_{yx}^{q - 1} C_{yx}^{q - 2} \cdots C_{yx}^1 C_{yx}^0 ,C_{yx}^k \in \left[ {0,1} \right] ,f\left( {y,x} \right) \in \left[ {0,2^q - 1} \right] \end{aligned}$$
(1)

The representative expression of a quantum image for a \(2^n \times 2^n\) image is described as follows [10]:

$$\begin{aligned} \left| I \right\rangle = \frac{1}{{2^n }}\sum \limits _{y = 0}^{2^n - 1} {\sum \limits _{x = 0}^{2^n - 1} {\left| {f\left( {y,x} \right) } \right\rangle \left| y \right\rangle \left| x \right\rangle } } \end{aligned}$$
(2)

Position information includes the vertical information and the horizontal information. \(\left| y \right\rangle \left| x \right\rangle = \left| {y_{n - 1} y_{n - 2} \cdots y_0 } \right\rangle \left| {x_{n - 1} x_{n - 2} \cdots x_0 } \right\rangle \). \(\left| y \right\rangle \) encodes the vertical information and \(\left| x \right\rangle \) encodes the horizontal information. NEQR needs \(q + 2n\) qubits to represent a \(2^n \times 2^n \) image with gray range \(2^q \).

Figure 1 illustrates a \(2 \times 2\) grayscale image and its representative expression in NEQR. In this figure, because the gray scale ranges between 0 and 255, eight qubits are needed in NEQR to store the grayscale information for the pixels.

Fig. 1
figure 1

A \(2 \times 2\) example image and its representative expression in NEQR

3 Quantum representation for color digital images

A novel quantum representation model NCQI is proposed to overcome the weakness of the existing quantum image models. In this section, the new representation is depicted in detail as well as its preparation.

3.1 NCQI

In this paper, we focus on color digital images in Cartesian coordinate system. A \(4 \times 4\) color digital image example sampled in Cartesian coordinates is shown in Fig. 2.

Fig. 2
figure 2

A \(4 \times 4\) color image example sampled in Cartesian coordinates (Color figure online)

Inspired by the NEQR quantum image model [13], we propose a novel NCQI model to store and process color digital images in quantum computer. The range of x and y is assumed to be \(\left[ {0,2^n - 1} \right] \) and \(\left[ {0,2^n - 1} \right] \) respectively. The quantum image representation NCQI can be shown in the following equation:

$$\begin{aligned} \left| {I} \right\rangle = \frac{1}{{2^{n} }}\sum \limits _{y = 0}^{2^n - 1} {\sum \limits _{ x = 0}^{2^n - 1} {\left| {c\left( {y ,x } \right) } \right\rangle } } \otimes \left| {y x } \right\rangle \end{aligned}$$
(3)

where \({\left| {c\left( {y ,x } \right) } \right\rangle }\) denotes the color value of the corresponding pixel, and it can be encoded by the binary sequence \({R_{q - 1} \cdots R_0 G_{q - 1} \cdots G_0 B_{q - 1} \cdots B_0 }\).

$$\begin{aligned} \left| {c\left( {y ,x } \right) } \right\rangle = \left| {\underbrace{R_{q - 1} \cdots R_0 }_{Red}\underbrace{G_{q - 1} \cdots G_0 }_{Green}\underbrace{B_{q - 1} \cdots B_0 }_{Blue}} \right\rangle \end{aligned}$$
(4)

The value range of every channel (RGB) is \(\left[ {0,2^q - 1} \right] \). Equation (3) indicates the whole NCQI model is stored into a normalized quantum superposition state. There are three parts, i.e., the color information \({c\left( {y ,x } \right) }\), the vertical position y, and the horizontal position x to represent one pixel. The tensor product of these three qubit sequences constitutes the basis state of NCQI. \(2n + 3q\) qubits are employed to store image information into a NCQI state for a \(2^n \times 2^n\) color image with every channel RGB ranged \(\left[ {0,2^q - 1} \right] \).

Fig. 3
figure 3

A \(4 \times 4\) color image and its quantum representation expression of NCQI (Color figure online)

An example of a \(4 \times 4\) color image with three channels RGB ranged \([0, 2^8-1]\), i.e., \(n=2,q = 8\) is shown in Fig. 3. Equation expressed in Fig. 3 depicts the whole NCQI is stored into a normalized quantum superposition state, in which each basis represents one pixel.

3.2 Quantum image preparation

Under the quantum mechanism, image information is stored into a quantum superposition state firstly. Then, it will be processed according to the quantum principle. How to prepare NCQI from quantum computer will be discussed.

At the beginning, for a \(2^n \times 2^n \) color image with every channel ranged \([0, 2^q-1]\), a quantum register with \(2n + 3q\) qubits needs to be initialised as seen in the following equation:

$$\begin{aligned} \left| I \right\rangle _0 = \left| 0 \right\rangle ^{ \otimes 2n + 3q} \end{aligned}$$
(5)

Figure 4 depicts the flow of preparation about NCQI model. The whole procedure is divided into two steps.

Fig. 4
figure 4

Flow of preparing the NCQI model. The initial state will be transformed into the NCQI via two steps

Step 1 We construct an empty NCQI with size \(2^n \times 2^n \) denoted as the middle state \(\left| I \right\rangle _1 \).

Two common single quantum gates I and H are shown in following, which will be utilized to build the important quantum operation \(U_1 \) of step 1 as in (6).

$$\begin{aligned} I= & {} \left[ {\begin{array}{*{20}c} 1 &{} 0 \\ 0 &{} 1 \\ \end{array}} \right] \\ H= & {} \frac{1}{{\sqrt{2} }}\left[ {\begin{array}{*{20}c} 1 &{} 1 \\ 1 &{} { - 1} \\ \end{array}} \right] \end{aligned}$$
$$\begin{aligned} U_1 = I^{ \otimes 3q} \otimes H^{ \otimes 2n} \end{aligned}$$
(6)

Equation (7) represents the quantum transformation from the initial state \(\left| I \right\rangle _0\) to the middle state \(\left| I \right\rangle _1\) via using the quantum operator \(U_1\).

$$\begin{aligned} U_1 \left( {\left| I \right\rangle _0 } \right)= & {} I^{ \otimes 3q} \otimes H^{ \otimes 2n} (\left| 0 \right\rangle ^{2n + 3q}) \nonumber \\= & {} \left| 0 \right\rangle ^{3q} \otimes \frac{1}{{\sqrt{2^n } }}\sum \limits _{y = 0}^{2^n - 1} {\left| y \right\rangle \otimes \frac{1}{{\sqrt{2^n } }}\sum \limits _{x = 0}^{2^n - 1} {\left| x \right\rangle } } \nonumber \\= & {} \frac{1}{ {2^{n} }}\sum \limits _{y = 0}^{2^n - 1} {\sum \limits _{x = 0}^{2^n - 1} {\left| 0 \right\rangle ^{3q} } } \otimes \left| {y x } \right\rangle = \left| I \right\rangle _1 \end{aligned}$$
(7)

The middle state \(\left| I \right\rangle _1 \) is an empty quantum image with size \(2^n \times 2^n \). Every pixel is stored into a normalized quantum superposition state and the color value is 0.

Step 2 We set the color value for all pixels in the middle state \(\left| I \right\rangle _1 \). Because the size of color image is \(2^n \times 2^n \), \(2^{2n} \) sub-operations are required to set color value for every pixel.

For pixel \(\left( {y ,x } \right) \), the quantum operation for color value setting is \(\Omega _{y x } \) as in (8). \(\Omega _{y x } \) contains 3q quantum oracles \(\Omega _{yx}^i \) which is shown in (9). In this operation, every qubit in the color value qubit sequence is processed according to the binary code of the color value \(c\left( {y ,x } \right) \) in (4). When \(C_i = 1\), the ith qubit will be operated by a controlled gate 2n-CNOT. Otherwise, nothing will be operated on the qubit. The transformation of \(\Omega _{y x } \) to set color value for the pixel is shown in (10).

$$\begin{aligned}&\Omega _{yx} = \mathop \otimes \limits _{i = 0}^{3q - 1} \Omega _{yx}^i \end{aligned}$$
(8)
$$\begin{aligned}&\Omega _{yx}^i :\left| 0 \right\rangle \rightarrow \left| {0 \oplus C_i } \right\rangle \end{aligned}$$
(9)
$$\begin{aligned}&\Omega _{yx}: \mathop \otimes \limits _{i = 0}^{3q - 1} \left| 0 \right\rangle \rightarrow \mathop \otimes \limits _{i = 0}^{3q - 1} \left| {0 \oplus C_i } \right\rangle = \mathop \otimes \limits _{i = 0}^{3q - 1} \left| {C_i } \right\rangle = \left| {c\left( {y ,x } \right) } \right\rangle \end{aligned}$$
(10)

Here, \(\left| {C_i } \right\rangle = \left| {R_i } \right\rangle ,i = 2q, \cdots , 3q - 1\), \(\left| {C_i } \right\rangle = \left| {G_i } \right\rangle ,i = q, \cdots ,2q - 1\), \(\left| {C_i } \right\rangle = \left| {B_i } \right\rangle ,i = 0, \cdots ,q - 1\).

The sub-operation to set color value for pixel \(\left( {y ,x } \right) \) will not affect other pixels. For every sub-operation in step 2, the unitary operation \(U_{y x } \) is expressed in the following equation:

$$\begin{aligned} U_{y x } = \left( {I^{ \otimes 3q} \otimes \sum \limits _{j = 0}^{2^n - 1} {\sum \limits _{i = 0,ji \ne y x }^{2^n - 1} {\left| {ji} \right\rangle \left\langle {ji} \right| } } } \right) + \Omega _{y x } \otimes \left| {y x } \right\rangle \left\langle {y x } \right| \end{aligned}$$
(11)

Applying sub-operation \(U_{y x } \) on the middle state \(\left| I \right\rangle _1 \) can be shown in Eq. (12).

$$\begin{aligned} {U_{y x } \left( {\left| I \right\rangle _1 } \right) }= & {} \left[ {\left( {I^{ \otimes 3q} \otimes \sum \limits _{j = 0}^{2^n - 1} {\sum \limits _{i = 0,ji \ne y x }^{2^n - 1} {\left| {ji} \right\rangle \left\langle {ji} \right| } } } \right) + \Omega _{y x } \otimes \left| {y x} \right\rangle \left\langle {y x } \right| } \right] \nonumber \\&\times \left( {\frac{1}{{2^{n}}}\sum \limits _{y = 0}^{2^n - 1} {\sum \limits _{x = 0}^{2^n - 1} {\left| 0 \right\rangle ^{ \otimes 3q} \left| {y x } \right\rangle } } } \right) \nonumber \\= & {} {\frac{1}{{2^{n}}}\sum \limits _{j = 0}^{2^n - 1} {\sum \limits _{i = 0, ji \ne y x}^{2^n - 1} {\left| 0 \right\rangle ^{ \otimes 3q} \left| {ji} \right\rangle } } + \Omega _{y x} \left| 0 \right\rangle ^{ \otimes 3q} \left| {y x} \right\rangle } \nonumber \\= & {} {\frac{1}{{ {2^{n} } }}\sum \limits _{j = 0}^{2^n - 1} {\sum \limits _{i= 0, ji \ne y x}^{2^n - 1} {\left| 0 \right\rangle ^{ \otimes 3q} \left| {ji} \right\rangle } } + \left| {c\left( {y ,x } \right) } \right\rangle \left| {y x} \right\rangle } \end{aligned}$$
(12)

From (12), every sub-operation \(U_{y x }\) sets the color value for the relevant pixel. In order to set the color value for all pixels, the whole operation \(U_2 \) is designed as the following equation shown in (13).

$$\begin{aligned} U_2 = {\mathop {\varPi }\limits _{y = 0}^{2^n - 1}} {\mathop {\varPi }\limits _{x = 0}^{2^n - 1}} U_{y x } \end{aligned}$$
(13)

The function of unitary operation \(U_2 \) can be described as the following way:

$$\begin{aligned} U_2 \left( {\left| I \right\rangle _1 } \right)= & {} {\mathop {\varPi } \limits _{y = 0}^{2^n - 1}} {\mathop {\varPi }\limits _{x = 0}^{2^n - 1}} U_{y x }\left( {\left| I \right\rangle _1 } \right) \nonumber \\= & {} \mathop \varPi \limits _{s = 0}^{2^n - 1} {\mathop {\varPi }\limits _{t= 0, st \ne y x}^{2^n - 1}}U_{st } \left( {\frac{1}{{ {2^{n} } }}\sum \limits _{j = 0}^{2^n - 1} {\sum \limits _{i = 0, ji \ne y x}^{2^n - 1} {\left| 0 \right\rangle ^{3q} \left| {j i } \right\rangle } + \left| {c\left( {y ,x } \right) } \right\rangle \left| {y x } \right\rangle } } \right) \nonumber \\= & {} \frac{1}{{ {2^{n} } }}\sum \limits _{y = 0}^{2^n - 1} {\sum \limits _{x = 0}^{2^n - 1} {\left| {c\left( {y ,x } \right) } \right\rangle } } \left| {y x } \right\rangle \nonumber \\= & {} \left| I\right\rangle \end{aligned}$$
(14)

After these two above steps, the whole quantum image preparation process has been completed. The corresponding NCQI state is prepared.

In order to show the validity of our quantum image model, we calculate the time complexity of preparation procedure.

Theorem 1

In order to store a \(2^n \times 2^n \) color image with every channel (RGB) ranged \([0, 2^q-1]\) into a NCQI model, the whole preparation will cost no more than \(O\left( 3q+2n+{6qn\cdot 2^{2n} } \right) \).

Proof

The whole preparation is divided into two steps. The time complexity is analyzed as follows.

Firstly, quantum operator \(U_1 \) is used in step 1. From Eq. (6), we see that \(U_1 \) will cost \(O\left( {3q +2n} \right) \) since it contains \(3q + 2n\) single quantum gates.

Secondly, the main function of \(U_2\) in step 2 is to set color value for all the pixels in the quantum image. The whole operation contains \(2^{2n} \) sub-operations \(U_{y x } \) shown in (12).

Every sub-operation \(U_{y x } \) executes the quantum operation \({\Omega _{y x } }\) to assign color value for the relevant pixel. In the operation, the i-th qubit in the color value qubit sequence \(\mathop \otimes \limits _{i = 0}^{3q - 1} \left| {C_i } \right\rangle \) is applied by a controlled quantum gate if \(C_i \) of color value \({c\left( {y ,x } \right) }\) is equal to 1, \(i = 0, \cdots 3q - 1\). We note that the controlled quantum gates are 2n-CNOT which can be decomposed into no more than \(O\left( {2n} \right) \) single quantum gate [13]. So the whole complexity of \(U_{y x } \) is \(O\left( {3q \cdot {2n} } \right) \). There are \(2^{2n} \) sub-operations \(U_{y x } \); therefore, the complexity of step 2 is cost no more than \(O\left( {3q \cdot {2n} \cdot 2^{2n} } \right) \).

On account of the above analysis, for a \(2^n \times 2^n \) color image with every channel (RGB) ranged \([0, 2^{q}-1]\), the time complexity of the whole quantum image preparation of NCQI is no more than \(O\left( 3q+2n+{6qn \cdot 2^{2n} } \right) \), which is approximately linear to the size of the color image. \(\square \)

4 NCQI-based image processing operations

In classical image processing, there are many fundamental operations, such as geometric transformation, color transformation. In this section, we discuss the color and geometric transformations on NCQI.

4.1 Color transformations for NCQI images

(To describe conveniently, we call RGB as three channels in this paper). Different from the existing color quantum image models, color encoding information of NCQI has the form of \(\left| {c\left( {y ,x } \right) } \right\rangle = \left| {\underbrace{R_{q - 1} \cdots R_0 }_{Red}\underbrace{G_{q - 1} \cdots G_0 }_{Green}\underbrace{B_{q - 1} \cdots B_0 }_{Blue}} \right\rangle \), which can represent three channels (RGB) information. In the following, we introduce the channel swapping operation and one channel swapping operation.

4.1.1 Channel swapping operation

Definition 1

The channel swapping operations acting on NCQI are operations CSO\(_{RG} \), CSO\(_{RB} \) and CSO\(_{GB} \), which can realize the aim of swapping the value of R and G, R and B, G and B. The output form of quantum image after applying CSO operations is described as Eq. (15).

$$\begin{aligned} \mathrm{{CSO}}_{C1,C2} \left( {\left| I \right\rangle } \right)= & {} \mathrm{{CSO}}_{C1,C2} \left( \frac{1}{{2^n }}\sum \limits _{y = 0}^{2^n - 1} \sum \limits _{x = 0}^{2^n - 1} \left| R_{q - 1} \cdots R_0 G_{q - 1} \cdots G_0 B_{q - 1} \right. \right. \nonumber \\&\left. \left. \cdots B_0 \right\rangle \left| {yx} \right\rangle \right) \nonumber \\= & {} \frac{1}{{2^n }}\sum \limits _{y = 0}^{2^n - 1} \sum \limits _{x = 0}^{2^n - 1} \mathrm{{CSO}}_{C1,C2} \left( \left| R_{q - 1} \cdots R_0 G_{q - 1} \right. \right. \nonumber \\&\left. \left. \cdots G_0 B_{q - 1} \cdots B_0 \right\rangle \right) \left| {yx} \right\rangle \end{aligned}$$
(15)

where, \(C_1 ,C_2 \in \left\{ {R,G,B} \right\} \), \(C_1 \ne C_2 \)

$$\begin{aligned} \mathrm{{CSO}}_{R,G} \left( {\left| {R_{q - 1} \cdots R_0 G_{q - 1} \cdots G_0 B_{q - 1} \cdots B_0 } \right\rangle } \right)= & {} \left| G_{q - 1} \cdots G_0 R_{q - 1} \right. \\&\left. \cdots R_0 B_{q - 1} \cdots B_0 \right\rangle \\ \mathrm{{CSO}}_{R,B} \left( {\left| {R_{q - 1} \cdots R_0 G_{q - 1} \cdots G_0 B_{q - 1} \cdots B_0 } \right\rangle } \right)= & {} \left| B_{q - 1} \cdots B_0 G_{q - 1} \right. \\&\left. \cdots G_0 R_{q - 1} \cdots R_0 \right\rangle \\ \mathrm{{CSO}}_{G,B} \left( {\left| {R_{q - 1} \cdots R_0 G_{q - 1} \cdots G_0 B_{q - 1} \cdots B_0 } \right\rangle } \right)= & {} \left| R_{q - 1} \cdots R_0 B_{q - 1} \right. \\&\left. \cdots B_0 G_{q - 1} \cdots G_0 \right\rangle \end{aligned}$$

Obviously, from Eq. (15), we see that CSO operation is only applied to the color encoding qubits. We just need to use q quantum swap gate to construct CSO operation.

Figure 5 shows an example of two-channel swapping operation and realization of quantum circuits. (a) Is the original image. (b) Is the R, G swapping output image from (a). (c) Is the R, B swapping output image from (a). (d) Is the G, B swapping output image from (a). (e) Is the quantum circuit of swapping R and G. (f) Is the quantum circuit of swapping R and B. (g) Is the quantum circuit of swapping G and B.

Fig. 5
figure 5

A \(2 \times 2\) example of two-channel swapping operation and realization of quantum circuits

4.1.2 One channel operation

Definition 2

The One Channel operation (OCO) on NCQI are the operations OCO\(_{R} \), OCO\(_{G} \) and OCO\(_{B} \), which can realize the aim of changing the value of R channel, G channel and B channel. The output form of quantum image after utilizing OCO operations is described as Eq. (16).

$$\begin{aligned} \mathrm{{OCO}}_Z \left( {\left| I \right\rangle } \right)= & {} \mathrm{{OCO}}_Z \left( {\frac{1}{{2^n }}\sum \limits _{y = 0}^{2^n - 1} {\sum \limits _{x = 0}^{2^n - 1} {\left| {R_{q - 1} \cdots R_0 G_{q - 1} \cdots G_0 B_{q - 1} \cdots B_0 } \right\rangle \left| {yx} \right\rangle } } } \right) \nonumber \\= & {} \frac{1}{{2^n }}\sum \limits _{y = 0}^{2^n - 1} \sum \limits _{x = 0}^{2^n - 1} \mathrm{{OCO}}_Z \left( {\left| {R_{q - 1} \cdots R_0 G_{q - 1} \cdots G_0 B_{q - 1} \cdots B_0 } \right\rangle } \right) \left| {yx} \right\rangle \nonumber \\ \end{aligned}$$
(16)

where \(Z \in \left\{ {R,G,B} \right\} \).

$$\begin{aligned} \mathrm{{OCO}}_R \left( {\left| {R_{q - 1} \cdots R_0 G_{q - 1} \cdots G_0 B_{q - 1} \cdots B_0 } \right\rangle } \right)= & {} \left| R'_{q - 1} \cdots R'_0 G_{q - 1} \right. \\&\left. \cdots G_0 B_{q - 1} \cdots B_0 \right\rangle \\ \mathrm{{OCO}}_G \left( {\left| {R_{q - 1} \cdots R_0 G_{q - 1} \cdots G_0 B_{q - 1} \cdots B_0 } \right\rangle } \right)= & {} \left| R_{q - 1} \cdots R_0 G'_{q - 1} \right. \\&\left. \cdots G'_0 B_{q - 1} \cdots B_0 \right\rangle \\ \mathrm{{OCO}}_B \left( {\left| {R_{q - 1} \cdots R_0 G_{q - 1} \cdots G_0 B_{q - 1} \cdots B_0 } \right\rangle } \right)= & {} \left| R_{q - 1} \cdots R_0 G_{q - 1} \right. \\&\left. \cdots G_0 B'_{q - 1} \cdots B'_0 \right\rangle \end{aligned}$$

Obviously, we can utilize the combination of NOT gate to design OSO operation to change one fixed channel’s information.

In addition, since the color encoding information has the form of \(\left| {c\left( {y ,x } \right) } \right\rangle = \left| {\underbrace{R_{q - 1} \cdots R_0 }_{Red}\underbrace{G_{q - 1} \cdots G_0 }_{Green}\underbrace{B_{q - 1} \cdots B_0 }_{Blue}} \right\rangle \). We can simultaneously change three channels of one pixel.

Figure 6 shows an example of changing three channels of one pixel and realization of quantum circuits. (a) Is the original image. (b) Is the output image from (a) when changing the first pixel’s three channel information. (c) Is the output image from (a) when changing the second pixel’s three channel information. (d) Is the output image from (a) when changing the third pixel’s three channel information. (e) Is the quantum circuit corresponding to (b). (f) Is the quantum circuit corresponding to (c). (g) Is the quantum circuit corresponding to (d).

Fig. 6
figure 6

A \(2 \times 2\) example of changing channels operation and realization of quantum circuits

Note: RGB value and the binary qubits form corresponding to the first pixel in (b), the second pixel in (c) and the third pixel in (d) of Fig. 6 are shown in Table 1. There are some successive 0 in binary qubits form, which can be abbreviated. For example, 00100010 can be abbreviated into \(q_1 1q_2 10\), which \(q_1 = 00\), \(q_2 = 000\).

In Fig. 6, we use the abbreviation quantum states, such as \(R_{s1} ,G_{s1} ,G_{s2} ,B_{s1} ,B_{s2} \) in (e), \(G_{s3} ,B_{s3} \) in (f), and \(R_{s2} ,B_{s4} \) in (g) to simply the quantum circuit. The concrete quantum states they representative can be shown in Table 2.

4.2 Geometric transformations for NCQI images

For the quantum images in the model NCQI, the quantum circuits of the geometric transformations consist of a sequence of unitary quantum gates acting on the position qubit sequence. Since every pixel is represented as a basis of the quantum superposition state, the positions after transform will be computed simultaneously for all the pixels in the image.

Table 1 RGB value of the first pixel in (b), the second pixel in (c) and the third pixel in (d)

Again, NCQI takes the same method to store position information just like NEQR and FRQI. So the geometric transformations based on NEQR and FRQI are also applicable to NCQI, such as translation [14], cycle shift [15], flip [16], nearest-neighbor interpolation [17, 18] and so on.

4.3 Comparison with other models

In this section, we compare NCQI with MCRQI, especially in the aspect of color transformation and preparation complexity.

Firstly, in Table 3, we discuss different color transformations which are suitable for NCQI. Since NCQI adopts binary qubit sequence to encode color information, while MCRQI use angles to represent color information, most listed color transformations in Table 3 are appropriate for NCQI. The algorithms about addition and subtraction, halving, complement, classification, feature extraction and image compression can be designed following the way existed in NEQR [15]. But, image segmentation and steganography should be explored further.

Table 2 Concrete qubits about abbreviate qubits shown in Fig. 6
Table 3 Color transformation for different quantum image models

Then, complexities in preparation process for different quantum image models are analyzed in Table 4. Obviously, the preparation efficiency is

$$\begin{aligned} O\left( {\mathrm{{NCQI}}} \right) < O\left( {\mathrm{{MCRQI}}} \right) \end{aligned}$$

Comparison results reveal that NCQI can achieve a quadratic speedup in quantum image preparation than MCRQI. It is more flexible and better suited to conduct color quantum image processing.

Table 4 Preparation complexity for different quantum image models

5 Conclusion

In this paper, in order to store and process the color digital images in quantum computer, a novel quantum image representation (NCQI) is proposed. All pixels are stored into a normalized superposition state and can be operated simultaneously since RGB value of each pixel is encoded and stored by the basis state of a qubit sequence. Complexity comparisons reveal that NCQI can achieve a quadratic speedup in quantum image preparation than MCRQI. Meanwhile, NCQI-based image processing operations are also discussed. Most common color transformations can be executed conveniently based on NCQI. Hence, the newly proposed NCQI model is more flexible and better suited to conduct color quantum image processing. Other future work will entail, especially in the aspect of designing quantum image processing algorithm, such as image steganography, retrieving and segmentation. In addition, we will find some inspirations from the model MNCQI, which uses a two-qubits sequence to be the index of channels, R, G, B, alpha, as well as entangled with a value sequence, to establish a better model.