# Quantum pixel representations and compression for N-dimensional images

In this section, we extend our new circuit implementation to (U_text {FRQI}) for grayscale data at different image representations which correspond to definitions 1 and 2. The main difference between all the representations is the definition of the color encoding in the quantum state (|c_krangle) of Definition 2. As long as we express this color mapping in terms of a combination of (R_y) rotations, we can use our compressed implementation for uniform control (R_y) rotations.

### IFRQI

The improved FRQI method introduced by Khan 7 combines ideas from FRQI and NEQR representations. It improves the measurement problem for FRQI by allowing only 4 discrete overlaps which stand out at most during projective measurement in the calculation base. The IFRQI color mapping for a grayscale image with a bit depth of 2p is defined as follows.

### Definition 5

(IFRQI mapping) For a grayscale image of NOT pixels where each pixel (pack) has a grayscale value (g_k in [0, 2^{2p}-1]) with binary representation (b^0_k b^1_k cdots b^{2p-1}_k)the IFRQI state (|I_text {IFRQI}rangle) is defined by definition 2 with the color mapping used in (2) given by

begin{aligned} |c_krangle = |c_k^0 c_k^1 cdots c_k^{p-1}rangle , end{aligned}

(19)

or for (i = 0, ldots , p-1)

begin{aligned} |c_k^irangle&= cos (theta _k^i) |0rangle + sin (theta _k^i)|1rangle ,&theta _k^i&= { left{ begin{array}{ll} 0, &{} text {if } b^{2i}_k b^{2i+1}_k = 00 frac{pi }{5}, &{} text {if } b^{2i}_k b^{2i+1}_k = 01 frac{pi }{2} – frac{pi }{5}, &{} text {if } b^{2i}_k b^{2i+1}_k = 10 frac{pi }{2}, &{} text {if } b^{2i}_k b^{2i +1}_k = 11 end{array}right. }. end{aligned}

We observe that the IFRQI mapping combines two bits of color information into one rotation. It follows that for an image of bit depth 2pwe can prepare (|I_text {IFRQI}rangle) using the circuit shown in Fig. 3a with p evenly controlled (R_y) rotations. Rotation angles (varvec{theta}^i) correspond to 2 bitsI and (2i+1) of all NOT pixels according to the values ​​defined in Definition 5. These uniformly controlled rotations can be compressed independently with our compression algorithm. The gate and qubit complexity for IFRQI with our method compared to Khan 7 are listed in Table 2.

### NEQR

The idea of ​​NEQR is to use a color mapping that directly encodes the length (to one) bit string for grayscale information in computation base states on (to one) qubits. The NEQR states for different colors are therefore orthogonal and can be distinguished with a single projective measurement in the calculation basis. In our QPIXL framework, the NEQR mapping can be defined as follows.

### Definition 6

(NEQR mapping) For a grayscale image of NOT pixels where each pixel (pack) has a value (g_k in [0, 2^{ell }-1]) with binary representation (b^0_k b^1_k cdots b^{ell -1}_k)the NEQR state (|I_text {NEQR}rangle) is defined by definition 2 with the color mapping used in (2) given by

begin{aligned} |c_krangle = |c_k^0 c_k^1 cdots c_k^{ell -1}rangle , end{aligned}

(20)

or

begin{aligned} |c_k^irangle&= cos (theta _k^i) |0rangle + sin (theta _k^i)|1rangle ,&theta _k^i&= { left{ begin{array}{ll} 0, &{} text {if } b^{i}_k = 0 frac{pi }{2}, &{} text {if } b^{i}_k = 1 end{array}right. }. end{aligned}

By choosing the angles of rotation (theta ^i_k) orthogonal, we ensure that the color information in (|I_text {NEQR}rangle) can be recovered by a single projective measurement. The NEQR state can be prepared through the circuit shown in Fig. 3b, where uniformly controlled rotations can again be compressed with our method. The gate complexities for uncompressed circuits are listed in Table 2.

### MCRQI

If we want to extend FRQI applicability from grayscale image data to color image data, we need to allow different color channels. This approach has been dubbed multi-channel representation of quantum images (MCRQI).11. We adapt their definition for RGB image data to our formalism and make some minor changes.

### Definition 7

(MCRQI mapping) For a color image of NOT RGB pixels, where the color of each pixel (pack) is given by an RGB triple ((r_k,g_k,b_k) in left[ 0, Kright])the MCRQI state (|I_{text {MCRQI}}rangle) is defined by definition 2 with the color mapping used in (2) given by

begin{aligned} |c_krangle = |r_k g_k b_krangle , end{aligned}

(21)

or

begin{aligned} |r_krangle&= cos (theta _k) |0rangle + sin (theta _k)|1rangle ,&theta _k&= frac{pi /2}{ K} , r_k, |g_krangle&= cos (phi _k) |0rangle + sin (phi _k)|1rangle ,&phi _k&= frac{pi /2} {K}, g_k, |b_krangle&= cos (gamma _k) |0rangle + sin (gamma _k)|1rangle ,&gamma _k&= frac{pi /2 }{K}, b_k. end{aligned}

We see that to encode the color information for an RGB image, we only need 2 more qubits than the grayscale data, which is a significant improvement over the classical case. Additionally, we encode the color mapping as a tensor product of three qubit states, while Sun et al.11 encodes information into the coefficients of color qubits, which entangles their state. Our implementation has the advantage that the different color channels are easily processed separately, while the color information can still be retrieved thanks to the normalization constraint.

The implementation of the circuit (|I_{text {MCRQI}}rangle) for the RGB mapping defined in Definition 7, then simply combines three uniformly controlled rotation circuits with different target qubits and coefficient vectors determined by the respective color intensities, as shown in Figure 3c. As the RGB color channels are independent of each other and the uniform control (R_y) gates have different target qubits, each of them can be compressed separately. The asymptotic gate complexity of our method compared to the work of Sun et al.11 is listed in Table 2. As this work essentially uses the construction of Le et al.5we obtain a quadratic improvement before compression.

### INCQI

Like the NEQR, the (I)NCQI uses color mapping directly encoding the length (to one) bit string for each color value in an RGB(alpha) image in the calculation base indicated on (to one) qbits. Therefore, this QIR can also be easily represented by our QPIXL framework through the mapping defined as follows.

### Definition 8

(INCQI mapping) For a color image of N RGB(alpha) pixels, where the color of each pixel (pack) is given by a tuple ((r_k,g_k,b_k,alpha _k)) and each channel value in the range ([0, 2^{ell }-1]) has a binary representation, the INCQI state (|I_{text {INCQI}}rangle) is defined by definition 2 with the color mapping used in (2) given by

begin{aligned} |c_krangle = |r_kg_kb_kalpha _krangle = |r_k^0r_k^1dots r_k^{ell -1}g_k^0g_k^1dots g_k^{ell -1 }b_k^0b_k^1dots b_k^{ell -1}alpha _k^0alpha _k^1dots alpha _k^{ell -1}rangle end{aligned}

(22)

or

begin{aligned} |r_k^irangle&= cos (theta _k^i) |0rangle + sin (theta _k^i)|1rangle ,&theta _k^i&= { left{ begin{array}{ll} 0, &{} text {if } b^{i}_k = 0 frac{pi }{2}, &{} text {if } b^{i}_k = 1 end{array}right. }. |g_k^irangle&= cos (phi _k^i) |0rangle + sin (phi _k^i)|1rangle ,&phi _k^i&= {left { begin{array}{ll} 0, &{} text {if } b^{i}_k = 0 frac{pi }{2}, &{} text {if } b^{ i}_k = 1 end{array}right. }. |b_k^irangle&= cos (gamma _k^i) |0rangle + sin (gamma _k^i)|1rangle ,&gamma _k^i&= {left { begin{array}{ll} 0, &{} text {if } b^{i}_k = 0 frac{pi }{2}, &{} text {if } b^{ i}_k = 1 end{array}right. }. |alpha _k^irangle&= cos (psi ^i) |0rangle + sin (psi _k^i)|1rangle ,&psi _k^i&= {left { begin{array}{ll} 0, &{} text {if } b^{i}_k = 0 frac{pi }{2}, &{} text {if } b^ {i}_k = 1 end{array}right. }. end{aligned}

The above definition applies very similarly to the NCQI12removing only the channel (alpha) of the equation. The INCQI state can be prepared via the circuit shown in Figure 3d. This circuit is constructed using a NEQR circuit for each channel of the ICNQI. As with previous QIRs, the uniformly controlled rotations used here can also be compressed with our method. The gate complexities for uncompressed circuits are listed in Table 2.

### Other plugins

We note that multiple extensions and combinations of the ideas presented in this section are possible. For example, when MCRQI is a color version of FRQI and (I)NCQI is a color version of NEQR, we can define a color version of IFRQI in the same way. We can also adapt IFRQI to group an arbitrary number of bits instead of the two-bit pairing of Definition 5. This reduces the required number of qubits and gates at the cost of quantum states which are less distinguishable and therefore require more of measures. It is even possible to use different QPIXL mappings for different RGB color channels. For example, we can use FRQI mapping for the red channel, IFRQI mapping for the green channel, and NEQR mapping for the blue channel. Moreover, a generalized version of NEQR (GNEQR) has been proposed by Li et al.46, which is based on NEQR, INEQR and NCQI. GNEQR uses (n+4el +2) qubits to represent an image with (2^n) pixels and bit depth of (to one) for 4 color channels. Using similar ideas described in this section, a QPIXL-based GNEQR would need (n+4ell) total number of qubits.

Finally, although we presented this discussion for image data in an RGB ((alpha)) space, as in the work of Sun et al.11, our approach can be easily adapted to different color spaces and even to multi-spectral or hyper-spectral data. In fact, different scientific applications frequently use images in different color spaces depending on the type of analysis needed. For example, the Y’CbCr space is known for its applicability to image compression. The I1I2I3 was created specifically targeting image segmentation. The HED space is advantageous in the medical field for the analysis of specific tissues. Similarly, multi-spectral and hyper-spectral data are used in fields such as geosciences and biology, for example, where experts acquire different satellite images and mass spectrometry images respectively. In all these cases, our general definition of quantum representations of pixels can be directly applied.