A Quantum Image Segmentation Method Based on Local Adaptive Threshold

By introducing local adaptive threshold and NEQR quantum image representation model into the quantum image segmentation algorithm, combining quantum comparator and binarization circuit, the problem of poor complex image segmentation effect in the prior art is solved, efficient segmentation of uneven light images is achieved, and exponential acceleration advantages are achieved.

CN115311315BActive Publication Date: 2025-06-10NANJING UNIV OF INFORMATION SCI & TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210851312.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-19
Publication Date
2025-06-10
Estimated Expiration
2042-07-19

AI Technical Summary

Technical Problem

Existing quantum image segmentation algorithms are not effective when processing complex images, especially when the image light is uneven.

Method used

Using a quantum image segmentation method based on local adaptive thresholds, the image is segmented through local adaptive thresholds and quantum cyclic shift operations using NEQR quantum image representation model, quantum comparator, quantum subtractor and quantum binarization circuit.

Benefits of technology

Effective segmentation of quantum images containing uneven illumination is achieved, and has an exponential acceleration effect compared to classic image segmentation algorithms.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115311315B_ABST
    Figure CN115311315B_ABST
Patent Text Reader

Abstract

The present invention discloses a quantum image segmentation method based on local adaptive threshold, which specifically relates to the technical fields of quantum computing and quantum image processing. The method uses the NEQR quantum image representation model, local adaptive threshold, quantum comparator, quantum subtractor, and quantum binarization circuit to implement the segmentation of quantum images, and relates to a quantum image segmentation method based on local adaptive threshold. The present invention uses the NEQR quantum image representation model to represent quantum images. To solve the real-time problem of classical digital image processing and the problem that existing quantum segmentation algorithms cannot segment images with uneven illumination, local adaptive threshold is adopted, and quantum cyclic shift operations, quantum subtractors, quantum comparators, and quantum binarization circuits are used to segment images. Compared with classical image segmentation algorithms, our algorithm has exponential acceleration, and thus we can segment quantum images with uneven illumination better.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical fields of quantum computing and quantum image processing. More specifically, the present invention relates to a method for segmenting quantum images by using a NEQR quantum image representation model, a local adaptive threshold, a quantum comparator, a quantum subtractor, and a quantum binarization circuit, and relates to a quantum image segmentation method based on a local adaptive threshold. Background Art

[0002] With the increasing requirements for image quality, the amount of image data has also increased rapidly, which requires a large amount of computing power to process the image data. Quantum image processing combines quantum computing and digital image processing and uses the unique superposition and parallelism of quantum computing to rapidly improve the computing speed, stores classical images in qubits, and turns them into quantum images. Therefore, a representation model for quantum images is needed. The quantum image representation models are mainly divided into two categories. With the development of the quantum image representation model, the corresponding quantum image processing algorithms have also developed rapidly. The current quantum image processing algorithms mainly include: geometric transformation of quantum images, quantum image steganography, quantum image feature extraction, quantum image scrambling, quantum image watermarking, quantum image filtering, quantum image matching, quantum image edge detection, quantum image segmentation, etc.

[0003] However, most of the current QIP algorithms are only theoretically feasible because they use too many quantum resources, which is not suitable in this noisy intermediate-scale quantum (NISQ) era. The quantum image segmentation algorithm is the basis of image processing. In recent years, it has gradually developed from theoretical feasibility to practical feasibility. However, the segmentation effect on complex images is not good enough. The above algorithms all use a global fixed threshold for segmentation. When encountering complex images with uneven illumination, effective segmentation cannot be performed. Therefore, a quantum image segmentation method based on a local adaptive threshold is proposed. This method designs a quantum image segmentation method based on a local adaptive threshold to solve the real-time problem of classical digital image processing and the problem that the existing quantum segmentation algorithms cannot segment images with uneven illumination; and to meet the purpose of accurately segmenting quantum images. Summary of the Invention

[0004] In order to overcome the above-mentioned defects of the prior art, an embodiment of the present invention provides a quantum image segmentation method based on a local adaptive threshold to solve the problems raised in the above background art.

[0005] To achieve the above object, the present invention provides the following technical solution: A quantum image segmentation method based on a local adaptive threshold, comprising the following steps:

[0006] Step 1: Prepare the NEQR quantum image: Since it is currently impossible to directly obtain a quantum image, we need to convert a classical image into an NEQR image. (2n + q) qubits are required to store a classical image of size 2 n ×2 n . In addition, an additional 4q qubits are needed to store the gray values of the 4-neighborhood pixel window, and another q qubits are required to copy the gray values of the original image. The quantum expression is as follows:

[0007]

[0008] Step 2: Circular shift: According to the neighborhood window, we need to perform circular shifts on the original image I to prepare a set of quantum images, so that we can process all neighborhoods in the image simultaneously. First, we shift the positions of the original image one unit upward, downward, leftward, and rightward respectively. A new NEQR image can be obtained for each circular shift in each direction. Therefore, we have a total of 5 NEQR images. The pixels at the same position in these 5 NEQR images are exactly the 4-neighborhood window pixels in the original image.

[0009]

[0010] Since the gray value of the NEQR image is in a superposition state, when we operate on the neighborhood window of a certain pixel in the original image, we can operate on the neighborhood windows of all pixels simultaneously. In addition, since we still need to use the original image after sorting, but the five images have been mixed together during the sorting process, we need to use the CNOT gate to copy the original image into an additional 3 qubits for subsequent binarization operations. The quantum expression is as follows:

[0011]

[0012] Step 3: Calculate the threshold: To facilitate sorting the pixels in the neighborhood window, we construct the QCS based on the QC. When the output y of the QC is 0, we use the CSWAP gate to swap the positions of a and b, which can make the larger value serve as the input for the next comparator to find the largest number in the neighborhood window. Use the QCS to sort the 4-neighborhood window pixels in the image and find their median. We compare the central pixel of the 4-neighborhood window with the other pixels in turn, and each time after the comparison, we take the larger number as an input for the next comparator, and finally find the largest number C 1 . In this way, we can find three large numbers C 1 C 2 C 3 . At this time, C 3This is the median we are looking for.

[0013] Step 4: Adjust the threshold. Additionally, to adjust the threshold, we need to use QS to subtract a constant C from the found median, so that we can obtain the threshold T.

[0014] Step 5: Quantum binary circuit. We use QC to compare the original image with the threshold, and then according to the comparison result, change the gray value of the pixels greater than or equal to the threshold to 1, and the others to 0. We use the reset operation to set c q-1 ...c 1 to zero. When the output result y of QC is 0, and c 0 = 0, we use the CNOT gate and the Toffoli gate to set c 0 to 1. When the output result y of QC is 1, and c 0 = 1, we use the CNOT gate and the Toffoli gate to set c 0 to 0. Finally, we can obtain a binary image.

[0015] Step 6: Analyze the complexity: In quantum information processing, the complexity of the circuit depends on the number of basic gates used. Single-qubit and two-qubit gates are the basic quantum logic gates and can operate on any qubit. Therefore, in this paper, the complexity of the circuit is calculated by the number of single-qubit and two-qubit gates (quantum cost). The quantum cost 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 quantum cost is 5. Taking a digital image of size 2 n ×2 n as an example, we will discuss the complexity of the circuit in 4 steps.

[0016] In the first step, we need to prepare the classical image into a NEQR image. The computational complexity of this stage does not exceed O(qn2 2n ), because each pixel will be operated one by one. However, our algorithm processes quantum images instead of classical images. Therefore, generally, the complexity of this step is not considered in the research of quantum image processing algorithms. So we consider the complexity of this step to be 0.

[0017] In the second step, we need to use the CT operation to perform a cyclic shift on the image. The complexity of CT is O(n 2 ). Additionally, we also use q CNOT gates to copy the gray value of the original image, and its quantum cost is q. So the complexity of this step is O(n 2 +q).

[0018] In the third step, we use 9 QCSs and 1 QS to calculate the threshold T. A QCS consists of 1 QC and q CSWAP gates. A QC requires 3q - 2 Toffoli gates, q - 1 CNOT gates, and 2(q - 1) reset gates. So the quantum cost of a QC is 18q - 13. In addition, the quantum cost of a CSWAP gate is 3, and q CSWAP gates are required. So the quantum cost of a QCS is 21q - 13. A QS requires 4q - 7 Toffoli gates, 4q - 4 CNOT gates, and 3q - 4 reset gates. Therefore, the quantum cost of a QS is 27q - 43. As can be seen from the above analysis, the complexity of this step is O(q).

[0019] In the fourth step, to set the constant Z, we also need q reset gates and q NOT gates, so the quantum cost is 2q and the complexity is O(q).

[0020] In the fifth step, we perform a quantum binarization (QB) operation on the image. The operation circuit requires 2 Toffoli gates, 2 CNOT gates, and q - 1 reset gates. So the quantum cost of this step is q + 11 and the complexity is O(q).

[0021] Therefore, the complexity of the complete algorithm is O(n 2 +q). On a classical computer, for an image of size 2 n ×2 n , image segmentation needs to be performed separately for each pixel. Therefore, the complexity of the classical segmentation algorithm is not less than O(2 2n ). Therefore, our scheme achieves an exponential speedup.

[0022] Technical effects and advantages of the present invention:

[0023] Compared with some existing quantum image segmentation algorithms, the NEQR quantum image representation model is used to represent quantum images. To solve the real-time problem of classical digital image processing and the problem that existing quantum segmentation algorithms cannot segment images with uneven illumination, local adaptive thresholds are adopted, and quantum cyclic shift operations, quantum subtractors, quantum comparators, and quantum binarization circuits are used to segment images. Compared with classical image segmentation algorithms, our algorithm has an exponential speedup, and thus we can segment quantum images with uneven illumination better. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] Figure 1 Schematic diagram of the quantum comparator QC of the present invention.

[0025] Figure 2 Schematic diagram of the quantum subtractor QS of the present invention.

[0026] Figure 3 Schematic diagram of the complete quantum splitting circuit of the present invention.

[0027] Figure 4 Schematic diagram of the overall process of the present invention.

[0028] Figure 5 Schematic diagram of the QCS circuit of the present invention.

[0029] Figure 6 Schematic diagram of the median calculation circuit of the present invention.

[0030] Figure 7 Schematic diagram of the threshold T circuit of the present invention.

[0031] Figure 8 Schematic diagram of the implementation circuit for binarization of the present invention.

[0032] Figure 9 Schematic diagram of the original image in the schematic diagram of the image of the present invention.

[0033] Figure 10 Schematic diagram of the implementation circuit for quantum image preparation in the quantum image preparation circuit of the present invention.

[0034] Figure 11 Probability histogram of the result image of the present invention.

[0035] Figure 12 Schematic diagram of the result image of the present invention. Detailed implementation manners

[0036] In order to make the objectives, technical solutions and advantages of the present invention clearer and more understandable, the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.

[0037] The main process of implementing the technical solution of the present invention is as Figures 1-6 shown, and the specific steps are as follows:

[0038] First step: Prepare a NEQR quantum image. Randomly select a grayscale digital image with a size of 2 2 ×2 2 , and the grayscale range is [0, 7]. Therefore, 2×2 + 3 qubits are required to store two quantum images. The quantum expression is as follows:

[0039]

[0040] As shown in Appendix Figure 9 and Appendix Figure 10 .

[0041] Step 2: Quantum image cyclic shift. Shift the obtained quantum image. We translate the positions of the original image one unit upward, downward, leftward, and rightward respectively.

[0042]

[0043]

[0044] Step 3: Calculate the threshold. We use QCS to sort the pixels in the four-neighborhood window of the image and find their median. We compare the central pixel of the four-neighborhood window with the other pixels in turn. After each comparison, we take the larger number as an input to the next comparator. Finally, we find the largest number C. 1 In this way, after three rounds of comparison, we can find three large numbers C. 1 C 2 C 3 At this time, C 3 is the median we are looking for.

[0045] Step 4: Adjust the threshold. To adjust the threshold, we need to use QS to subtract a constant C = 001 from the found median, so as to obtain the threshold T. As described in the appendix Figure 7 .

[0046] Step 5: Binarization. We use QC to compare the original image with the threshold. Then, according to the comparison results, we change the gray value of the pixels greater than or equal to the threshold to 1, and the others to 0. We use the reset operation to set c2c1 to zero. When the QC output result y = 0 and c 0 = 0, we use the CNOT gate and the Toffoli gate to set c 0 to 1. When the QC output result y = 1 and c 0 = 1, we use the CNOT gate and the Toffoli gate to set c 0 to 0. Finally, we can obtain a binary image. As described in the appendix Figure 8 .

[0047] Step 6: Obtain the result. A simulation experiment was carried out on IBM Q. In the probability histogram of the quantum image, the vertical axis represents the probability of the measured qubit sequence, and the horizontal axis represents each pixel information and other auxiliary qubit information. Each qubit sequence is in the order from top to bottom. The gray value information C and the position information P of the result image are marked in the figure. The remaining qubits form a complete circuit and have no impact on the image representation. To reduce the measurement complexity, we only measured the gray value and position information qubits of the result image. The schematic diagram of the result image is as follows, where the position information and the gray value information have been marked. As described in the appendix Figure 11and annex Figure 12 as described above

[0048] It should be noted that in this document, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variation thereof is intended to cover non-exclusive inclusion, such that a process, method, article or device comprising a series of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article or device.

[0049] Although the embodiments of the present invention have been shown and described, those of ordinary skill in the art can understand that various changes, modifications, substitutions and variations can be made to these embodiments without departing from the principles and spirit of the present invention. The scope of the present invention is defined by the appended claims and their equivalents.

Claims

1. A quantum image segmentation method based on local adaptive threshold, comprising the following steps: Step 1: Prepare the NEQR quantum image: Since quantum images cannot be directly obtained currently, classical images need to be converted into NEQR images. (2n + q) qubits are required to store a classical image with a size of 2 n ×2 n . Meanwhile, an additional 4q qubits are needed to store the gray values of the 4-neighborhood pixel window, and another q qubits are required to copy the gray values of the original image. The quantum expression is shown as follows: Step 2: Circular shift: According to the neighborhood window, the original image I needs to be circularly shifted to prepare a quantum image set, so that all neighborhoods in the image can be processed simultaneously. First, the positions of the original image are translated one unit upward, downward, left, and right respectively. A new NEQR image can be obtained for each circular shift in each direction. Therefore, there are a total of 5 NEQR images. The pixels at the same position in these 5 NEQR images are exactly the 4-neighborhood window pixels in the original image; Since the gray value of the NEQR image is in a superposition state, when operating on the neighborhood window of a certain pixel in the original image, the neighborhood windows of all pixels can be operated on simultaneously. In addition, since the original image is needed after sorting, but the five images have been mixed together during the sorting process, it is necessary to use the CNOT gate to copy the original image into an additional 3 qubits for subsequent binarization operations. The quantum expression is as follows: Step 3: Calculate the threshold: To facilitate the sorting of the pixels in the neighborhood window, QCS is constructed based on QC. When the output y of QC is 0, the CSWAP gate is used to swap the positions of a and b. This allows the larger value to be used as the input for the next comparator to find the largest number in the neighborhood window. The QCS is used to sort the pixels in the four-neighborhood window of the image, and their median is found. The central pixel of the four-neighborhood window is compared with the other pixels in turn, and the larger number is used as an input for the next comparator after each comparison. Finally, the largest number C is found. 1 In this way, three large numbers C can be found after three rounds of comparison. 1 C 2 C 3 At this time, C 3 is the median to be found. Step 4: Adjust the threshold. To adjust the threshold, it is necessary to use QS to subtract a constant C from the found median, so as to obtain the threshold T; Step 5: Quantum Binary Circuit: Use QC to compare the original image with the threshold. Then, according to the comparison result, convert the grayscale value of pixels greater than or equal to the threshold to 1, and the others to 0. Use the reset operation to set c q-1 ...c 1 to zero. When the QC output result y = 0 and c 0 = 0, use the CNOT gate and the Toffoli gate to set c 0 to 1. When the QC output result y = 1 and c 0 = 1, use the CNOT gate and the Toffoli gate to set c 0 to 0. Finally, a binary image can be obtained.

Citation Information

Patent Citations

  • Quantum image shearing method based on NEQR expression

    CN106683041A

  • Quantum image adaptive segmentation method based on NEQR expression

    CN112258543A