Quantum Image Segmentation Based on Grayscale Morphology

The classical image segmentation algorithm based on grayscale morphology can effectively segment images with uneven illumination, but with the increase of image data, the real-time problem will emerge. In order to solve this problem, a quantum image segmentation algorithm is proposed in this article, which can use a quantum mechanism to simultaneously perform morphological operations on all pixels in a grayscale image, and which then quickly segments the image into a binary image. In addition, several quantum circuit units, including dilation, erosion, bottom-hat transformation, top-hat transformation, etc., are designed in detail, and then, they are combined together to construct the complete quantum circuits for segmenting the novel enhanced quantum representation images. For a <inline-formula><tex-math notation="LaTeX">$2^{n} \times 2^{n}$</tex-math></inline-formula> image with <inline-formula><tex-math notation="LaTeX">$q$</tex-math></inline-formula> grayscale levels, the complexity of our algorithm can be reduced to O<inline-formula><tex-math notation="LaTeX">$(n^{2}+q)$</tex-math></inline-formula>, which is an exponential speedup than the classic counterparts. Finally, the experiment is conducted on IBM Q to show the feasibility of our algorithm in the noisy intermediate-scale quantum era.


I. INTRODUCTION
T HE image processing technology is the basis of com- puter vision, and it is widely used in many fields.With the improvement of the performance of image acquisition devices, the quality of images is getting better and better, and the amount of data is also increasing, which also requires more computing power while the image is being processed.However, due to the limitation of some factors, the development of classical computers is close to the limit, so it will consume a lot of time when processing largescale data, which will lead to the emergence of real-time problem.In recent years, quantum image processing, as an interdisciplinary subject of image processing and quantum computing, has received extensive attention from researchers [1]- [3].Due to the unique superposition and entanglement properties of quantum computing, quantum image processing can achieve at most an exponential speedup than its classical counterpart, which is very meaningful.
Quantum image representation model is the primary task of quantum image processing [4], [5].At present, scholars have done a lot of research in this area and proposed many quantum image representation models.The most commonly used methods can be mainly divided into two types, and one is to encode the image color information into the probability amplitude, for example, the flexible representation of quantum image (FRQI) [6], the multi-channel RGB images representation of quantum images (MCQI) [7], a normal arbitrary superposition state of quantum image (NASS) [8] and quantum probability image encoding representation (QPIE) [9].This encoding method can efficiently encode images using fewer qubits, but it also makes it more difficult to retrieve images.To solve this problem, a novel enhanced quantum representation (NEQR) [10] is proposed, which is an encoding method that uses some sequences of qubits to encode images, which encodes the position information and the grayscale value information into three entangled qubit sequences, such that images can be retrieved quickly with few measurements.Therefore, the NEQR model is widely used due to its simplicity of operation.By improving the position information and color information, a series of encoding methods have been proposed, such as an improved NEQR (IN-EQR) [11], a generalized model of NEQR (GNEQR) [12], and a novel quantum representation of color digital images (NCQI) [13].With the development of quantum image repre-sentation models, corresponding quantum image processing algorithms have also developed rapidly, such as geometrical transformation of quantum image [14]- [16], quantum image steganography based on least significant bit (LSB) [17], feature extraction of quantum image [12], quantum image watermarking [11], [18]- [21], quantum image filtering [22], quantum image scaling [23], quantum image matching [24], quantum image edge detection [25]- [30], quantum image segmentation [31]- [36], etc.
Image segmentation is the basis of image processing.Although classical image segmentation algorithms are relatively mature, quantum image segmentation algorithms are still in their infancy.In 2014, Caraiman et al [32].proposed a histogram-based quantum image segmentation algorithm to segment the image according to the distribution of pixel grayscale values in the histogram, which can achieve exponential acceleration than the classical algorithm, but there is no specific oracle implementation circuit.One year later, they [33] proposed a quantum image segmentation algorithm based on a single threshold and gave an oracle circuit.However, due to the high quantum cost, the algorithm could not be simulated in the noise mesoscale quantum (NISQ) era.In 2018, Chakraborty et al. [34] designed a multiple quantum circuit for threshold based color image segmentation, which is a meaningful research on color image segmentation.In 2019, Xia et al. [35] designed a quantum comparator and binarized the quantum image using a single threshold.They designed a detailed segmentation circuit, but its complexity is still too high.In 2020, Yuan et al. [36] proposed a double threshold quantum image segmentation algorithm based on the quantum comparator they designed.Because of its low quantum cost, it is feasible in this NISQ era.However, the above research only uses the threshold value to segment the image, and does not consider the influence of illumination, which is invalid for complex image (image with uneven illumination) segmentation.In the real world, the influence of uneven illumination on images is everywhere, which brings great challenges to image segmentation.Classical image segmentation algorithms have done a lot of research to solve this problem, but its complexity is very high, and the realtime problem is gradually emerging.The existing quantum image segmentation methods do not consider the impact of illumination on the image, so they cannot segment the image containing uneven illumination, which is inappropriate in practical use.Therefore, a quantum version algorithm is needed to solve this problem.Morphology is a new image processing theory, and Yuan et al. [37] first conducted research on quantum morphology image processing.They focused on the dilation and erosion of quantum binary images and grayscale images, but the complexity was exponential, which is very high.In 2016, Yuan et al. [38] improved their algorithm to reduce the complexity to the polynomial level, but it is not used to solve specific problems.In 2019, Fan et al. [39] used the basic knowledge of grayscale morphology to study gradient images, which further expands the quantum image morphology research.After that, Li et al. [40] made practical applications of morphological theory, such as edge detection, image enhancement.As far as we know, morphological theory can also be well applied to image segmentation with uneven illumination.In the grayscale level image, the top-hat transform structure element moves below the grayscale level to obtain the open operation image.Then we subtract the open operation image from the original image, and the background can be removed.The bottomhap transform structure element moves above the grayscale level to obtain a closed operation image.Then we subtract the original image from the closed operation image, and the background can be removed.Therefore, the morphological operation can well remove the uneven illumination in the image, which is beyond other methods.However, each pixel in the image needs to be processed individually, so it requires a lot of computation time when the scale of image increase, which leads to the real-time problem.In order to solve the problem, a quantum image segmentation algorithm using the grayscale morphology theory is proposed.Unlike classical methods, quantum methods can take advantage of the parallelism of quantum computing to process the quantum superposition state pixels of the input image, which greatly speeds up the classical counterpart.
In a nutshell, the main contributions of this work are as follows: • A quantum image segmentation algorithm based on grayscale morphology is firstly proposed, which can use quantum mechanism to simultaneously perform morphological operations on all pixels in a grayscale image and quickly segment the image with uneven lighting into a binary image.• Several specific quantum circuit units, including dilation, erosion, bottom hat transformation, top hat transformation, etc., are designed in detail by using fewer qubits and quantum gates.And then based on these units, the complete quantum circuits are designed to segment the NEQR images.• We verify the superiority and feasibility of our proposed algorithm by analyzing the circuit complexity and performing simulation experiments on IBM Q, respectively.
The rest of this paper is organized as follows.Section II introduces the principle of the NEQR representation model and the classical grayscale morphology.In Sect.III, some basic quantum operation modules are introduced, then, a series of quantum circuit units are designed and some relevant quantum states equations are given.Section IV analyzes the circuit complexity of our algorithm and the experiment is shown in Sect.V. Finally, the conclusion is drawn in Sect.VI.

II. RELATED WORK A. NEQR
The NEQR model stores the grayscale information (C) and positional information (Y and X) of a classical image in three qubit sequences respectively, and entangles the position and grayscale information to form a complete quantum image.For a classical image with a size of 2 n × 2 n and a grayscale range of [0, 2 q − 1], 2n qubits are required to store the position information of the Y-axis and X-axis.Then, q qubits are required to store the grayscale value information.The expression is shown in Eq. 1 [10]. where Figure 1 shows an example of a grayscale image of size 2 × 2, and the corresponding NEQR expression of which is given as follows.

B. CLASSICAL GRAYSCALE MORPHOLOGY 1) Grayscale dilation and erosion
Grayscale morphology is extended from binary morphology, which allows grayscale images to be processed with morphological operations as well.Grayscale morphology also includes two basic operations: dilation and erosion, but the original "AND" and "OR" operations are turned into a problem of finding local extremes.The formula expression is as follows.element will increase the amount of calculation and affect the result image.Therefore, in practical use, flat structure elements are often used to perform the grayscale dilation operation.At this time, B N = 0, and the dilation operation is simplified as follows. [ where F represents the original image, B represents the structure element, and D B represents the region of B. In this case, the dilation operation is to find the maximum value of the overlapping area of F and B, and assign it to the center pixel of the overlapping area.Similar to the dilation operation, the erosion operation can be expressed as follows.
(5) Among them, B N represents the non-flat structure element, and D B N represents the region of B N .Also in practical use, flat structure elements are often used for grayscale erosion operation.In this case, B N = 0, and the erosion operation is simplified as follows.
where F represents the original image, B represents the structure element, and D B represents the region of B. In this case, the erosion operation is to find the minimum value of the overlapping area of F and B, and assign it to the center pixel of the overlapping area.We use different structure elements for different images to get better results, and the commonly used structuring elements are shown in Fig. 2.

2) Bottom hat transformation and top hat transformation
In the practical application of image segmentation, there will be uneven light in the image, which will make it difficult to find the objects and bring errors to the segmentation.Morphological bottom hat and top hat transformation can solve this problem very well.As shown in Fig. 3, it is an image with uneven background illumination.When the image is directly segmented, part of the text will be lost; when the bottom hat transformation is used, the background with uneven illumination in the image is deleted.So that the complete text information can be obtained by performing the binaryzation operation.
The bottom hat transformation of the grayscale image F is defined as the result of the image closing operation minus the original image.Specifically, the image is first dilated and then eroded, and finally we subtract the original image from the processed image.The bottom hat transformation can get the dark area in the original image, so it is also called the black bottom hat transformation.The definitions are as follows.
The top hat transformation of grayscale image F is defined as the original image minus the result image of the opening operation.Firstly, the image is eroded, then it is dilated, and finally we subtract the previously obtained image from the original image.The top hat transformation can get the bright area in the original image, so it is also called the white top hat transformation, and it can be expressed as follows.

III. QUANTUM IMAGE SEGMENTATION ALGORITHM BASED ON GRAYSCALE MORPHOLOGY A. QUANTUM OPERATIONS
(1) Quantum comparator The quantum comparator can compare the numerical magnitudes of two binary qubit sequences.It takes two qubit sequences |A⟩ and |B⟩ as input and outputs the two sequences and their comparison result y.Inspired by the quantum bit string comparator (QBSC) [41], our comparator also compares bit-by-bit.The comparison results for each bit are processed using three auxiliary qubits.If A ≥ B, then y = 0; if A < B, then y = 1.
The detailed quantum circuit diagram is shown in Fig. 4.
Compared with the existing quantum comparators, our comparators use fewer quantum gates and fewer qubits, as shown in Tab. 1, which is very necessary in this NISQ era.
For further sorting operation, we use a CSWAP gate at the output of the comparator to control the output order  The quantum image cyclic shift transformation (CT ) operation [15] can shift the positions of all pixels in an image, so that each pixel in the image can obtain its neighbor pixels at the same time.For example, if we move the image up by one unit (CT y+ ), then the pixels in the image change from S(X, Y ) to S(X, Y + 1).The unitary operation for cyclic shift of a 2 n × 2 n NEQR image is shown below.7 shows a schematic diagram of the X-axis cyclic shift transformation.(4) Quantum copy operation In order to copy the grayscale value of the image, we need to use the Copy operation [42] to complete.It is implemented with CNOT gates and auxiliary qubits.The circuit is shown in Fig. 8, |x⟩ represents the original value and |0⟩ is used to store the copied value.

B. THE QUANTUM IMAGE SEGMENTATION ALGORITHM
In order to achieve the segmentation of images with uneven illumination, our proposed quantum image segmentation algorithm can be described as Algorithm 1.
In the second step, we use the cyclic shift operation to shift the original image |I⟩ one unit in four directions: up, down, left, and right.Each translation requires the CT

C. QUANTUM CIRCUIT IMPLEMENTATION OF THE ALGORITHM
(1) Quantum image preparation According to the NEQR model, 2n qubits are needed to store the position information, and q qubits are needed to store the grayscale value information.In addition, additional 4q qubits are also required to store the grayscale values of the 4-neighborhood pixels.Because the neighborhood window will be shuffled after grayscale morphological processing, in order to process the original image later, we still need additional q qubits to store   Algorithm 1 The quantum image segmentation algorithm.

11) (2) Quantum image cycle shift transformation
In order to be able to process all pixels in the image at the same time, we perform cyclic shift transformation on the NEQR image according to the structure element window, so that we can get a quantum image set, as shown in Tab. 2. In this way, the pixels at the same position (Y, X) in the image set are composed of the neighborhood pixels of the structure element window of the original image.In this way, when we process the pixels in the same position in the image set, we can process all the pixels in the structure element area.We take a 3 × 3 image as an example, as shown in Fig. 10, and the images are stored in the quantum registers in the superposition state.In order to get the neighborhood pixels, we use the cyclic shift transformation to move the original image up, down, left, right, and store it in the auxiliary qubit(four other quantum registers).In this way, we can process all the neighboring pixels at once.Furthermore, before proceeding to the next step, we need to copy the original image into auxiliary qubits, so that the original image can be manipulated again after the dilation and erosion operation.The quantum state expression of the quantum image set after cyclic shift transformation is shown below.
(3) Bottom hat transform/Top hat transform When performing the bottom hat transformation operation, we need to dilate the image first, then erode the image, and finally subtract the original image.The top hat transformation first erode the image, then dilate the image, and finally use the original image subtract the result image of the previous step.When performing the dilation operation on the image, we need to perform a cycle shift operation on the original image according to the method in the previous step to obtain the neighborhood window pixels.Then the QCL module is used to find the pixel with the largest grayscale in the neighborhood window.After performing the reset operation on other neighborhood pixels, we copy its maximum grayscale value to the original image (the center point of the neighborhood window) using the copy operation.This completes the dilation operation, and the specific circuit is shown in the Fig. 11(a).When performing the erosion operation, we also need to perform a cycle shift operation on the original image, and then use the QCS module to find the pixel with the smallest grayscale value in the neighborhood window, and finally copy it to the original image, so that the image can be processed with erosion operation, and the specific circuit is shown in the Fig.

11(b).
We combine these two operations and use auxiliary qubits to replicate the original image for subsequent operations.Then, the obtained image and the original image are subtracted by the quantum subtractor, so that the bottom hat transformation or the top hat transformation can be performed.The specific quantum circuit is shown in Fig. 12. (4) Quantum image binaryzation After the bottom hat transformation or the top hat transformation, we can remove the uneven lighting in the image.At this time, the binaryzation operation of the image can get better results.We use a QC to compare the grayscale value of the image after morphologically transformation with the threshold we set, and convert the grayscale value of pixels greater than or equal to the threshold to 1, and the others to 0. Since we only measure the qubit c 0 we need at the end, no operations are required for c q−1 , ..., c 1 , and if the QC output y = 0 and c 0 = 0, then we use CNOT gate and Toffoli gate to set c 0 to 1.If the QC output y = 1 and c 0 = 1, we use CNOT gate and Toffoli gate to set c 0 to 0. Finally, we can get a binary image, and the specific binaryzation circuit is shown in Fig. 13.The complete quantum circuits of grayscale morphological image segmentation are shown in Fig. 14.

IV. CIRCUIT COMPLEXITY ANALYSIS
In quantum image processing, the complexity of the algorithm is determined by the basic quantum logic gates used in the circuit, and single-qubit gates and double-qubit gates can form arbitrarily complex quantum logic gates [43].Therefore, in this paper, the number of single/double-qubit quantum logic gates is used to calculate the complexity of the circuit, and their complexity are set as unit 1.Therefore, the complexity of a NOT gate, a reset gate or a CNOT gate is 1.A Toffoli gate can be composed of 5 two-qubit gates, so its complexity is 5 [43].The quantum cost of different quantum circuits are shown in Tab. 3. Taking a digital image of size 2 n × 2 n and grayscale value of [0, 2 q − 1] as an example, we will discuss the complexity of the circuit as follows.
In the research of quantum image processing, we are dealing with quantum images, but since it cannot be obtained directly at this stage, it is necessary to prepare digital images into quantum images.Therefore, the complexity of the process of preparing the quantum image is not calculated in the complexity of the quantum image processing algorithm [26], [28], so we consider the complexity of this stage to be 0.
When the quantum image is cyclically shifted, we need to use the CT operation to prepare the quantum image set, and the complexity of this operation is O(n 2 ) [44].In addition, we also need a Copy operation (q CNOT gates) to copy the original image into auxiliary qubits for backup, which has a complexity of O(q).So, the complexity of a CT operation is O(n 2 + q).
The quantum operations used to perform a bottom-hat or top-hat transform on an image are roughly the same, including a copy operation, a dilation operation, an erosion operation, and a subtraction operation.The dilation or erosion operation includes a cyclic shift operation, 4 QCL (QCS) operations, q reset operations and 1 Copy operation (q CNOT gates).The complexity of a QCL or a QCS is O(q), and the complexity of a reset operation and a copy operation is also O(q).So the complexity of the dilation or erosion operation is O(n 2 + q + 4q + q + q)=O(n 2 + q), and the complexity of the subtractor operation is also O(q).So the complexity of bottom hat transformation or top hat transformation is O(q + n 2 + q + n 2 + q + q)=O(n 2 + q).
The quantum binaryzation circuit includes a quantum comparator, two CNOT gates, a reset gate and two Toffoli gates.In addition, q NOT gates are required to set the threshold, and the complexity of a quantum comparator is O(q), so the overall complexity of this part is O(q + 2 + 1 + 10 + q)=O(q).According to the above complexity analysis, we can know that the complexity of the quantum image segmentation algorithm based on grayscale morphology is O(q + n 2 + q + q)=O(n 2 + q).The classical grayscale morphological image segmentation needs to process each pixel separately, so its complexity is not less than O(2 2n ).Therefore our algorithm can achieve exponential speedup than the classical algorithm, which can better solve the real-time problem encountered by the classical algorithm.
In addition, our algorithm is compared with other wellknown segmentation algorithms.For convenience, we simplify the algorithm in [32], [34] to HIS and MQCTIS, and the comparison results are shown in Tab. 4. HIS needs to count the grayscale value of each pixel in the image, and then select an appropriate threshold according to the histogram.Therefore, its complexity is O( √ 2 2n t), which includes retrieval of t object pixels [32].In order to achieve multi-level threshold of color image segmentation, MQCTIS uses the logic of quantum oracle or quantum black box, and the quantum oracle circuit is built using a quantum string comparator, some basic quantum gates and a set of fredkin gates, which requires the complexity of the algorithm to be O(2 2n log2 2n ), where 2 2n is the number of pixels in the image.Therefore, the complexity of our proposed segmentation algorithm is far lower than the above segmentation algorithms.

V. EXPERIMENT
IBM opened a quantum cloud computing platform IBM Q (IBM Quantum Experience) [45] in 2017, which includes a quantum toolkit Qiskit [46], so researchers can use Qiskit to create, compile, and run quantum computing program on quantum computers or simulators.Users can compile the Python language into the OpenQASM language through the environment created by Qiskit and anaconda, and then create a quantum circuit.After running the quantum circuit on IBM Q and measuring it, we can get the probability histogram of the qubit sequence.There are currently a total of 24 quantum computers and 5 quantum simulators on IBM Q and they support up to 8192 executions of quantum circuits.But because of the preciousness of qubits, we can only use quantum computers with 5 qubits, which is far from enough.So we can only use the quantum simulator 'ibm_qasm_simulator' to run our quantum circuits, which has 32 qubits and supports all the quantum logic gates we use.When used, it is mainly called by the statement "backend=IBMQ.get_provider('ibmq').get_backend('ibmq_qasm_simulator')".In order to verify the feasibility of our algorithm on IBM Q, without affecting the experimental results, we selected a classical image whose size is 4 × 4 and the grayscale value is [0,7].The schematic diagram of the image is as shown in Fig. 15.Y and X represent the coordinates of the pixel, and the grayscale value information has been marked in the figure.
According to the 4 × 4 image given above, we perform bottom hat transformation segmentation and top hat transformation segmentation on it respectively to demonstrate the feasibility of our algorithm.Since the task time of ibm_qasm_simulator is limited to 10000 seconds (about 2.7 hours), in order to reduce the running time of the circuit, we only measure the required qubits (the grayscale value information and the position information of the image).Figure 16 is the probability histogram of the resulting image, where the abscissa is the measured qubit sequence, and the ordinate is the probability of each qubit sequence.In the order from top to bottom, the third qubit is the gray value of the resulting image pixel (C=0 or 1), and the next four qubits are the corresponding position YX.The rest of the qubits are used to make up the complete circuit and we do not need to pay attention to the result.Figure 17 is the schematic diagram of the result image after top hat transformation and the bottom hat transformation.As can be seen from Fig. 16 and Fig. 17, our algorithm can accurately achieve the function of grayscale morphological segmentation.

VI. CONCLUSION
While various morphological algorithms are quite mature in classical image processing, how to use quantum mechanisms to improve processing efficiency is still in its infancy.In order to solve the real-time problem of segmenting the uneven illumination image, a quantum image segmentation algorithm based on grayscale morphology is firstly proposed, which uses quantum mechanism to perform grayscale morphology process on all pixels in an image at the same time, and then quickly segment a grayscale image into a binary image.The complexity of our algorithm has been greatly improved compared with other algorithms.
In the image segmentation algorithm based on morphology, the selection of structure elements will influence the segmentation effect to a certain extent.In this paper, we just consider one simple scenario, i.e., using a fixed crossshaped structure element.Therefore, how to adaptively select the appropriate structure elements according to the image characteristics is one of our future work.
3) where B N represents the origin symmetric transformation of the non-flat structure element ∧ B N , and D B N represents the region of B N .x and y are incremented so that the midpoint of B N can access every pixel in F .However, non-flat structure

FIGURE 2 .
FIGURE 2. The schematic diagram of the structuring windows.

3 of
A and B, as shown in the Fig. 5, QCS means A ′ ≥ B ′ , QCL means A ′ < B ′ .(2) Quantum subtractor operation The quantum subtractor can realize the subtraction operation of two binary qubit sequences A and B. It takes A and B as inputs and outputs the result of A − B. By performing a bit-by-bit subtraction operation on a 0 − b 0 , a 1 − b 1 , ..., a n−1 − b n−1 , and retaining the borrow information for the next bit, the subtract operation can be completed using 2 auxiliary qubits.The specific implementation circuit is shown in Fig. 6. (3) Cycle shift transformation

FIGURE 4 .
FIGURE 4. Implementation circuit of the quantum comparator.

FIGURE 5 .
FIGURE 5. Implementation circuit of the QCS and QCL.

FIGURE 6 .
FIGURE 6. Implementation circuit of the quantum subtractor.

FIGURE 7 .
FIGURE 7. The schematic diagram of the X-axis cyclic shift transformation.

FIGURE 8 .
FIGURE 8.The quantum circuit realization of Copy operation.

FIGURE 9 .
FIGURE 9.The workflow of our proposed algorithm.

FIGURE 10 .
FIGURE 10.Schematic diagram of quantum image cyclic shift transformation.

FIGURE 11 .
FIGURE 11.The implementation circuit for dilation and erosion operations.

( a )
The implementation circuit for bottom hat transformation.(b) The implementation circuit for top hat transformation.

FIGURE 12 .FIGURE 13 .
FIGURE 12.The implementation circuit for bottom hat transformation and top hat transformation.

FIGURE 14 .
FIGURE 14.The complete implementation circuits for grayscale morphological segmentation.
(a) The probability histogram of bottom hat transformation.(b) The probability histogram of top hat transformation

FIGURE 16 .
FIGURE 16.The probability histograms of bottom hat transformation and top hat transformation.
(a) The schematic diagram of the resulting image of bottom hat transformation.(b) The schematic diagram of the resulting image of top hat transformation.

FIGURE 17 .
FIGURE 17.The schematic diagram of the resulting image of bottom hat transformation and top hat transformation.

TABLE 1 .
Comparison of different quantum comparators.
: Using the cyclic shift operation to prepare a quantum image set of |I⟩.3: Using the quantum image set, the NEQR image |I⟩ is morphologically processed by dilation/erosion operation, and the result image is named |G⟩.4: Using the cyclic shift operation again to prepare the quantum image set of |G⟩.5: Using the quantum image set of |G⟩, the NEQR image |G⟩ is processed by erosion/dilation operation, and the result image is named |F ⟩. 6: Using the subtractor to make |F ⟩ − |I⟩ / |I⟩ − |F ⟩, then the top hat transform/bottom hat transform result |B⟩ is obtained.7: Using the comparator and the segmentation operation to segment |B⟩, and finally the binary image |S⟩ is obtained.
1: Preparing the quantum image |I⟩ based on NEQR model.28: The quantum measurement operation is performed to retrieve the classical image, and the algorithm ends.) the grayscale information of the original image.The quantum state expression is as follows.

TABLE 2 .
Specific operations for shifting the image.

TABLE 3 .
The quantum cost and complexity of different quantum circuit.

TABLE 4 .
Complexity comparison of different algorithms.
FIGURE 15.The Schematic of original image.