A median filtering method and system for quantum color images

Through the quantum color image median filtering method, the QRMW model and the parallelism of qubits are used to optimize the quantum image expression, solve the problem of low efficiency of quantum image median filtering in the existing technology, and achieve more efficient quantum color image processing.

CN114494056BActive Publication Date: 2024-08-23CHONGQING UNIV OF POSTS & TELECOMM
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210073686.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-21
Publication Date
2024-08-23
Estimated Expiration
2042-01-21

AI Technical Summary

Technical Problem

In the existing technology, quantum image median filtering has not yet been perfected, especially when processing color images and large-size images, and the generated quantum circuits are complex, resulting in many qubits and low efficiency.

Method used

A quantum color image median filtering method is used to express quantum color images through the QRMW model, optimizing the image expression process, using the parallelism of qubits to perform median filtering, reducing redundant quantum components, and improving algorithm performance. Specific steps include preparing the QRMW expression of the image to be processed, performing circular shifts and qubit settings, using quantum comparators and controlled exchangers for median finding, and converting the image through quantum measurements.

Benefits of technology

The efficiency and performance of quantum image median filtering are improved, making it easier to implement under classical computers, supporting the processing of larger-size images, and reducing the complexity and number of bits of quantum circuits.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114494056B
    Figure CN114494056B
Patent Text Reader

Abstract

The invention discloses a quantum color image median filtering method and system, comprising: preparing a quantum color image to be processed and a QRMW expression of its eight-neighborhood color image; searching for the median of the prepared quantum color image and its eight-neighborhood color image according to a quantum circuit of a quantum color image median filtering algorithm to obtain a quantum color image expression; measuring the quantum color image expression, obtaining information of each component from the quantum image expression, and converting the information of each component into a quantum color image; quantum preparation of nine color images is achieved at the same time, and auxiliary quantum bits in the quantum circuit are reused, and auxiliary images are added to reduce the number of quantum bits in the quantum circuit and reduce redundant quantum elements, thereby greatly improving the performance of the quantum image expression algorithm; and the quantum color image median filtering algorithm of the invention can be implemented on a quantum simulator.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of quantum computing, and in particular relates to a median filtering method and system for quantum color images. Background Art

[0002] Quantum image processing is an interdisciplinary subject that combines quantum computing with visual information processing. It prepares algorithms for the popularization of quantum computers. It mainly processes visual data and is also a core topic in many application fields. Unlike classical image processing, quantum image processing is an interdisciplinary subject that integrates quantum mechanics, computer science, and information science. The parallelism, superposition, and measurement uncertainty of quantum image processing are fundamental advantages over classical image processing.

[0003] Image median filtering is an important preprocessing step in image processing. Since digital images are often inevitably interfered by noise during transmission and use due to imperfections in imaging systems, transmission media, and recording equipment, which degrades the image quality and affects subsequent image processing, image enhancement techniques are often used to improve the image quality before further processing. In the field of classical image processing, the research on image median filtering has been relatively mature, but quantum image median filtering has only been proposed by researchers in recent years and is in its infancy and is not yet perfect. At present, quantum image median filtering is in the processing of grayscale images, and the complexity of the overall quantum circuit it generates requires many quantum bits. Therefore, how to use the unique parallelism of quantum to design a more efficient quantum color image median filtering scheme is a topic worthy of further exploration. Summary of the invention

[0004] The technical problem to be solved by the present invention is how to obtain an efficient quantum circuit for quantum color image median filtering. The purpose is to provide a method and system for median filtering of quantum color images, using a new quantum color image storage model QRMW to express quantum color image median filtering, optimizing the preparation process of the processed image and its field based on the QRMW expression, greatly improving the performance of the quantum image expression algorithm, making it easier to simulate on a classical computer, and providing the possibility of processing quantum images of larger sizes, thereby improving the capability of the quantum image algorithm.

[0005] The present invention is achieved through the following technical solutions:

[0006] A median filtering method for quantum color images comprises the following steps:

[0007] S1. Prepare the QRMW expression of the quantum color image to be processed and its eight-neighborhood color image;

[0008] S2. According to the quantum circuit of the quantum color image median filter algorithm, the prepared quantum color image and its eight-neighborhood color images are searched for the median value to obtain the quantum color image expression;

[0009] S3. Measure the quantum color image expression, obtain the information of each component from the quantum image expression, and convert it into a quantum color image according to the information of each component.

[0010] Furthermore, the specific process of S1 includes:

[0011] S11, obtaining basic information of the quantum color image to be processed, wherein the basic information includes grayscale information of the image, size information of the image, pixel position information and color channel information;

[0012] S12, cyclically shifting the quantum color image to be processed to obtain eight neighborhood color images, and the quantum color image to be processed and the eight neighborhood color images together obtain nine images to be processed;

[0013] Since the grayscale information of the eight neighborhood color images is related to the quantum color image to be processed, a neighborhood color image can be obtained each time the original image is cyclically shifted, and eight neighborhood images can be obtained by performing eight cyclic shifts.

[0014] S13, according to the basic information of the quantum color image to be processed, setting the quantum bits corresponding to the nine images to be processed;

[0015] S14. According to the set quantum bits, grayscale information, common pixel position information and color channel information of each of the nine images to be processed are prepared to obtain a quantum sequence of unique mapping of pixel position information, color channel information and grayscale information.

[0016] Furthermore, the quantum bit setting method is:

[0017] If the grayscale value of the grayscale information of the quantum color image to be processed is set in the range of [0, 2 m ], size 2 n ×2 n , then the grayscale information corresponding to each of the nine images to be processed is set with m qubits, and a total of 9×m qubits are set. If there are i color channels in the color channel information, then i-1 qubits are set to represent the color channel, and 2n qubits and 2 auxiliary qubits are set to represent the pixel position information shared by the nine images to be processed.

[0018] Furthermore, in step S14, the process of uniquely mapping the pixel position information and the grayscale information specifically includes:

[0019] S141, traversing pixel information of nine images to be processed, that is, for each image to be processed, scanning each pixel information in the image in turn, the pixel information including grayscale information, color channel information and pixel position information;

[0020] S142, preparing each pixel in the image to be processed:

[0021] According to the initial states of the quantum bits corresponding to the pixel position information and the quantum bits corresponding to the color channel, an H-gate transformation is performed to prepare a superposition state of the pixel position and the color channel corresponding to each pixel;

[0022] The required pixel position information and color channel information are transferred to the auxiliary quantum bits, and the change of the grayscale value is controlled by the auxiliary quantum bits to obtain a unique mapping relationship between the pixel position information and the grayscale information;

[0023] According to the unique mapping relationship between pixel position information and grayscale information, after obtaining the grayscale value corresponding to the pixel position and color channel, the two auxiliary quantum bits are set to zero using a zeroing gate, and all operations performed on the pixel position information are restored;

[0024] S143, repeat step S142 until the preparation of all pixels in all images to be processed is completed.

[0025] Furthermore, the specific process of median filtering in step S2 includes:

[0026] S21, the image to be processed and the eight-neighborhood color image are combined into a 3×3 filtering template, and the pixels in the template are compared and sorted using a quantum comparator:

[0027] First, compare and sort the three pixels in each row of the 3×3 filter template;

[0028] Then compare and sort the three pixels in each column of the 3×3 filter template;

[0029] S22, compare the maximum pixel value of the first row, the middle pixel value of the second row, and the minimum pixel value of the third row of the sorted 3×3 filter template in pairs, and the final middle value is the median value of the 3×3 filter template.

[0030] Furthermore, the quantum comparator outputs only one comparison result, and two auxiliary bits are used to complete the comparison sorting in the whole process, and the auxiliary bits of the quantum comparator will not increase with the increase of the quantum comparison bits; the comparison sorting process is ascending sorting, and the three pixels in each row of the 3×3 filter template are sorted in ascending order from left to right, and then the three pixels in each column of the 3×3 filter template are sorted in ascending order from top to bottom; the specific process of ascending sorting is:

[0031] The three pixels are compared in pairs to obtain the larger value of the two pixels, and the larger value is placed on the right or bottom using a quantum controlled switch; after the ascending order is completed, the maximum value of the three pixels is placed on the far right or bottom.

[0032] Furthermore, the specific process of step S3 includes:

[0033] Measure the quantum color image expression to obtain the probability amplitude information of each state in the quantum image;

[0034] According to the probability amplitude information of each state in the quantum image, the quantum color image after median filtering is converted into a quantum color image for display.

[0035] Furthermore, by utilizing the package management and environment management functions provided by the open source quantum computing toolkit QISKIT, the IBMQ simulation cloud platform, and Anaconda, the Python language was used to simulate and implement quantum division operations to simulate the median filtering process of quantum color images.

[0036] In another aspect, the present invention provides a median filtering system for quantum color images, comprising:

[0037] A quantum image preparation module is used to prepare the quantum color image to be processed and the QRMW expression of its eight-neighborhood color image;

[0038] A median filter module is used to search for the median of the prepared quantum color image and its eight-neighborhood color images according to the quantum circuit of the quantum color image median filter algorithm to obtain a quantum color image expression;

[0039] The quantum image restoration module is used to measure the quantum color image expression, obtain the information of each component from the quantum image expression, and convert it into a quantum color image according to the information of each component.

[0040] Furthermore, the median filtering module includes:

[0041] A quantum comparator is used to compare and sort the three pixels in each row and column of the 3×3 filter template in ascending order;

[0042] A quantum controlled switch, used for adjusting the position of the pixel according to the comparison result of the quantum comparator;

[0043] The median search module is used to combine the image to be processed and the eight-neighborhood color image into a 3×3 filter template, and compare the maximum pixel value of the first row, the middle pixel value of the second row, and the minimum pixel value of the third row in the adjusted 3×3 filter template in pairs to find the middle value of these three pixels, which is the median of the 3×3 filter template.

[0044] Compared with the prior art, the present invention has the following advantages and beneficial effects:

[0045] The present invention optimizes the preparation process of the quantum color image to be processed and its eight-neighborhood color image based on QRMW expression, realizes quantum preparation of nine color images at the same time, reuses auxiliary quantum bits in the quantum circuit, and adds auxiliary images to reduce the number of quantum bits in the quantum circuit and reduce redundant quantum elements, thereby greatly improving the performance of the quantum image expression algorithm; and the quantum color image median filtering algorithm of the present invention can be implemented on a quantum simulator. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] In order to more clearly illustrate the technical solutions of the exemplary embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only illustrate certain embodiments of the present invention and should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.

[0047] Figure 1 is an overall flow chart of the method in an embodiment of the present invention;

[0048] Figure 2 A classic schematic diagram of a quantum color image to be processed provided by an embodiment of the present invention, Figure 2 2(b), 2(c), 2(d), 2(e), 2(f), 2(g), 2(h), and 2(i) are classic schematic diagrams of their eight-neighborhood images;

[0049] Figure 3 This is a diagram showing the output result after preparing the quantum circuit for the image of an embodiment of the present invention;

[0050] Figure 4 A pixel quantum circuit diagram of the same color channel at the same position of the image to be processed and its eight-neighborhood image prepared based on the QRMW expression of the present invention;

[0051] Figure 5 The specific circuit diagram of the two-bit quantum comparator used in the present invention;

[0052] Figure 6 This is a specific circuit diagram of the quantum controlled switch used in the present invention;

[0053] Figure 7 A specific circuit diagram of a quantum comparator for comparing and exchanging three values ​​used in the present invention;

[0054] Figure 8 A quantum circuit diagram for finding the median in a 3×3 filter template for the present invention;

[0055] Fig. 9 This is the output result diagram after the color image median filtering quantum circuit of the present invention;

[0056] Fig.10 is a probability histogram after the quantum color image median filtering measurement in an embodiment of the present invention;

[0057] Fig.11 It is a schematic diagram of a quantum color image converted after median filtering in an embodiment of the present invention. DETAILED DESCRIPTION

[0058] In order to make the objectives, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with embodiments and drawings. The exemplary embodiments of the present invention and their description are only used to explain the present invention and are not intended to limit the present invention.

[0059] Example 1

[0060] like Figure 1 As shown, this embodiment provides a method for median filtering of a quantum color image, comprising the following steps:

[0061] S1. Based on the QRMW (Quantum representation of multi wavelength images) quantum model, the QRMW expression of the quantum color image to be processed and its eight-neighborhood color image is prepared, and the expression is shown in formula (1);

[0062]

[0063] where |I> represents the quantum color image, Indicates pixel value, |ch λ > represents the color channel, and |YX> represents the position information.

[0064] Specifically, the preparation process includes:

[0065] S11, obtaining basic information of the quantum color image to be processed, wherein the basic information includes grayscale information of the image, size information of the image, pixel position information and color channel information;

[0066] S12, cyclically shifting the quantum color image to be processed to obtain eight neighborhood color images, and the quantum color image to be processed and the eight neighborhood color images together obtain nine images to be processed;

[0067] Since the grayscale information of the eight-neighborhood color image is related to the quantum color image to be processed, a neighborhood color image can be obtained by cyclically shifting the original image. After performing eight cyclic shifts, eight neighborhood images can be obtained. Figure 2 As shown. Figure 2 In the figure, we can see that the formation process of the nine images is as follows: first, the original quantum color image to be processed is Figure 2 (a) Perform an upward circular shift to obtain Figure 2 (c); then perform a circular shift to the right to obtain Figure 2 (d); and then perform a circular shift downward to obtain Figure 2 (f); and then perform a circular shift downward to obtain Figure 2 (i); then perform a circular shift to the left, and we get Figure 2 (h); then circularly shift leftward, we get Figure 2 (g); and then perform a circular shift upward to obtain Figure 2 (e); then circularly shift upward to obtain Figure 2 (b).

[0068] S13, according to the basic information of the quantum color image to be processed, setting the quantum bits corresponding to the nine images to be processed;

[0069] Specifically, if the grayscale value of the grayscale information of the quantum color image to be processed is set in the range of [0, 2 m ], size 2 n ×2 n , then the grayscale information corresponding to each image in the nine images to be processed is set with m qubits, and a total of 9×m qubits are set. If there are i color channels in the color channel information, i-1 qubits are set to represent the color channels. In this embodiment, there are 3 color channels, and 2 qubits are required to represent the color channels. Since the quantum color image to be processed and its eight-neighborhood image share pixel position information, 2n qubits and 2 auxiliary qubits are required to represent the pixel position information shared by the nine images to be processed.

[0070] For example, Figure 2 The images to be processed are all 4×4 color images with 8 gray levels, that is, the grayscale information requires 27 quantum bits, the color channel information requires 2 quantum bits, the position information requires 4 quantum bits, and 2 quantum bits are required as auxiliary bits.

[0071] S14. According to the set quantum bits, grayscale information, common pixel position information and color channel information of each of the nine images to be processed are prepared to obtain a quantum sequence of unique mapping of pixel position information, color channel information and grayscale information.

[0072] Prepare the grayscale information of nine images to be processed, and prepare quantum circuits based on the optimized images to achieve unique mapping between pixel position information and grayscale information. Specifically:

[0073] S141, traversing pixel information of nine images to be processed, that is, for each image to be processed, sequentially scanning each pixel information in the image, the pixel information including grayscale information, color channel information and pixel position information; converting the obtained pixel information into the required quantum sequence to achieve unique mapping between grayscale information and position information;

[0074] S142, preparing each pixel in the image to be processed:

[0075] Step 1: Perform an H-gate transformation according to the initial states of the quantum bits corresponding to the pixel position information and the quantum bits corresponding to the color channel to prepare a superposition state of the pixel position and the color channel corresponding to each pixel;

[0076] Step 2: Pass the required pixel position information and color channel information to the auxiliary qubit, use the auxiliary qubit to control the change of grayscale value, and obtain the unique mapping relationship between pixel position information and grayscale information; prepare for the unique mapping of position information, color channel information and grayscale information. Auxiliary qubits will be used in this process, because the superposition state representing the position information cannot change during the entire process of image preparation. Therefore, in this embodiment, the required position information and color channel information are passed to the auxiliary qubit, and the auxiliary qubit controls the change of grayscale value, so as to achieve the unique mapping relationship between position information and grayscale information.

[0077] Step 3: According to the unique mapping relationship between the pixel position information and the grayscale information, the grayscale value corresponding to the pixel position and the color channel is obtained, so that the preparation of one pixel is completed. Then, the two auxiliary quantum bits are set to zero using the zeroing gate so that they can be reused when preparing the next pixel; and all operations on the pixel position information are restored;

[0078] S143, repeat step S142 until the preparation of all pixels in all images to be processed is completed.

[0079] This embodiment provides a specific example of preparing position information: if the initial state of the quantum bit corresponding to the known pixel position information is |0>, an H-gate transformation is performed to prepare the position information of the image. Figure 2 For the color image to be processed in, a total of 6 quantum bits are required to perform H-gate transformation on the position information and channel information, and a superposition state with 16×4 components is obtained, representing three different color channels, where 00 represents the R channel, 01 represents the G channel, 10 represents the B channel, and 11 is a redundant channel.

[0080] When the Qiskit quantum simulation system runs a quantum circuit, the output quantum sequence from left to right corresponds to the quantum circuit from bottom to top. According to the information represented by the quantum bits from bottom to top in the quantum circuit, it can be known that the first 27 bits of each component in each of the above 16 components represent the pixel value of the nine neighborhoods, the next two bits represent the color channel information, the next four bits are the position information, and the last two bits are auxiliary bits. The quantum sequences listed later are all presented in this order. That is, only the required position information and color channel information are obtained through the above H-gate transformation, while the grayscale information is still 0. Figure 3 Taking the second data 00100010110010101001001011111101111 as an example to illustrate the prepared image, it is inverted to 11110111111010010010101001101000100. At this time, the output of the corresponding image preparation quantum circuit from top to bottom is the first 27 bits 11110111111010010010101010011 is the grayscale information in the 3×3 filter template, the next 2 bits 01 are the color channel information, the next 4 bits 0001 are the position information bits, and the last 2 bits 00 are auxiliary bits. The auxiliary quantum bits are prepared to realize the unique mapping process of position information to grayscale information. The 64 quantum sequences in the quantum image system exist simultaneously when they are not collapsed.

[0081] S2. According to the quantum circuit of the quantum color image median filter algorithm formed by the above process, the prepared quantum color image and its eight-neighborhood color images are searched for the median to obtain the quantum color image expression;

[0082] In this embodiment, a quantum circuit for each pixel in the nine neighborhood images of the image to be processed is given, such as Figure 4 Shown is a quantum circuit diagram with the preparation positions of Y=“00”, X=“00” and CH=“00”, and the grayscale value and corresponding quantum bit information of 000011011000001010011011011.

[0083] In this embodiment, no matter how many quantum bits represent the position information and color channel information, the position information can always be transmitted through these two auxiliary quantum bits, and transmitted to one of the auxiliary quantum bits using the above multiplexing method. Therefore, the number of auxiliary quantum bits in this embodiment does not increase with the increase of image size, and the complexity of the quantum circuit is greatly reduced, fewer quantum bits are used, and fewer quantum comparators are used in the following median search process, thereby improving the calculation speed and saving computing resources.

[0084] Specifically, the process of finding the median is:

[0085] S21, the image to be processed and the eight-neighborhood color image are combined into a 3×3 filtering template, and the pixels in the template are compared and sorted using a quantum comparator:

[0086] First, compare and sort the three pixels in each row of the 3×3 filter template;

[0087] Then compare and sort the three pixels in each column of the 3×3 filter template;

[0088] The quantum comparator outputs only one comparison result, and uses two auxiliary bits to complete the comparison sorting in the whole process, and the auxiliary bits of the quantum comparator will not increase with the increase of quantum comparison bits; the comparison sorting process is ascending sorting, and the three pixels in each row of the 3×3 filter template are sorted in ascending order from left to right, and then the three pixels in each column of the 3×3 filter template are sorted in ascending order from top to bottom; the specific process of ascending sorting is:

[0089] The three pixels in each row are compared, the first pixel is compared with the second pixel, and the larger value of the two pixels is obtained as the comparison result. The control bit of the quantum controlled switch is set to the result bit of the former quantum comparator, and the first pixel and the second pixel are acted on, and the larger value is arranged at the position of the second pixel. Similarly, the second pixel is compared with the third pixel to obtain the comparison result. Through the quantum controlled switch, the maximum value of the three pixel values ​​is arranged at the position of the third pixel. Finally, the first pixel is compared with the second pixel to obtain the comparison result. Through the quantum controlled switch, the control bit is the result bit of the former comparator. Finally, the sorting result of the three pixels in each row is: the middle value of the pixel value is arranged at the position of the second pixel, and the minimum value of the three pixel values ​​is arranged at the position of the first pixel. The sorting method of the three pixels in each column is carried out in the same way as each row.

[0090] S22, compare the maximum pixel value of the first row, the middle pixel value of the second row, and the minimum pixel value of the third row of the sorted 3×3 filter template in pairs, and the final middle value is the median value of the 3×3 filter template.

[0091] S3. Measure the quantum color image expression, obtain the information of each component from the quantum image expression, and convert it into a quantum color image according to the information of each component. Measure the quantum color image expression to obtain the probability amplitude information of each state in the quantum image; according to the probability amplitude information of each state in the quantum image, convert the quantum color image after median filtering into a quantum color image for display. That is, restore the quantum color image to be processed after median filtering.

[0092] To improve the filtering effect of median filtering, the filtering process of the above quantum circuit can be simulated to provide an evaluation criterion for the quantum image processing operation of this time, so as to adjust the subsequent process. Optionally, in this embodiment, the open-source quantum computing toolkit QISKIT, the IBMQ (IBM Quantum) quantum simulation cloud platform, and the package management and environment management functions provided by Anaconda are used to simulate and implement the quantum division operation in Python language to simulate the median filtering process of quantum color images.

[0093] In the above embodiment, a quantum comparator and a quantum controlled-swap are used to complete the median filtering algorithm for quantum color images.

[0094] (1) Quantum comparator

[0095] As Figure 5 shown, the implementation principle of the quantum comparator is as follows:

[0096] If a composite system |a>|b> composed of two n-bit quantum states is given, a quantum bit string |a> = |a n-1 a n-2 ...a 0 | and the comparison string |b> = |b n- 1 b n-2 ...b 0 | are operated. The QBSC is the unitary evolution shown as follows:

[0097] U CMP |a>|b>|0>|0> = |a>|b>|0>|c> (2)

[0098] where is the total number of quantum bits contained in the composite system. The implementation of the comparator also requires another 2 auxiliary quantum bits initialized to 0; does not carry any useful information, and the last quantum bit state carries the result information obtained by comparison. and are the two quantum bit strings for comparison respectively. For example, when a < b, then c = 1 and ; when a ≥ b, then c = 0. The increase in the number of bits of the quantum bit strings participating in the comparison in the implementation of the comparator will not cause an increase in the number of bits of the auxiliary quantum bits.

[0099] (2) Quantum controlled-swap

[0100] As Figure 6 shown, the principle of the quantum controlled-swap is as follows:

[0101] Given a composite system consisting of two n-bit quantum states |a>|b>, a quantum controlled switch is used to implement the operation of quantum bit strings and bit strings when the input result is 1. The unitary evolution of its representation is:

[0102] U swap |a>|b>=|b>|a> (3)

[0103] (3) Quantum color image median filtering algorithm

[0104] The principle of this algorithm is as follows:

[0105] Let the original image be f (x,y) , g (x,y) For the output image, the algorithm can be described as: using a 3×3 filter window to perform median replacement on each pixel value in the original image. It can be seen that in the process of median replacement, it is necessary to complete the median search based on the comparison interaction composed of the quantum comparator and the quantum controlled switch.

[0106] The principle of median finding is as follows:

[0107] like Figure 7 As shown, the quantum comparator and quantum controlled switch mentioned above are used to compare the three horizontal values ​​in the 3×3 filter window in pairs, and the larger value is placed on the right, so that the rightmost value is the maximum value of each row. Then the values ​​after the horizontal comparison are compared vertically, and the larger value is placed on the bottom, so that the value at the bottom of the four lines is the maximum value of each column. Then the maximum value of the first row, the middle value of the second row, and the minimum value of the third row are compared in pairs, and the middle value obtained is the middle value in the 3×3 filter window, as shown in Figure 8 As shown, the unitary evolution of its representation is:

[0108] U sort |a〉|b〉|c〉|e〉|f>|g>|h>|i>|j>=|a′>|b′>|c′>|e′〉|med>|g′〉|h′〉|i′〉|j′〉 (4)

[0109] After the interactive comparison operation, the probability amplitude information of each state can be obtained only after the quantum image system is measured, such as Fig.10 As shown, this is the probability histogram of quantum measurement after median filtering. Fig.11 This is a schematic diagram of the image after filtering out noise points. From the experimental results, we can see that the matrix representation of the processed image is for:

[0110]

[0111]

[0112]

[0113] After simulating the above quantum circuit, we get Fig. 9 The simulation results of the quantum color image median filtering are shown in FIG. 1 , where the quantum color image to be processed is 4×4 in size and has a grayscale value range of [0, 8] 4×4 The simulation results in Table 1 include the running compilation time, the number of measurements, and the number of basic quantum logic gates, which can provide an evaluation criterion for the quantum image processing operation.

[0114] Table 1

[0115] Quantum image manipulation Image size Time(s) Number of measurements Quantum color image processing 4×4 195.33 1024

[0116] Example 2

[0117] This embodiment provides a quantum color image median filtering system, including:

[0118] A quantum image preparation module is used to prepare the quantum color image to be processed and the QRMW expression of its eight-neighborhood color image;

[0119] A median filter module is used to search for the median of the prepared quantum color image and its eight-neighborhood color images according to the quantum circuit of the quantum color image median filter algorithm to obtain a quantum color image expression;

[0120] The quantum image restoration module is used to measure the quantum color image expression, obtain the information of each component from the quantum image expression, and convert it into a quantum color image according to the information of each component.

[0121] Furthermore, the median filtering module includes:

[0122] A quantum comparator is used to compare and sort the three pixels in each row and column of the 3×3 filter template in ascending order;

[0123] A quantum controlled switch, used for adjusting the position of the pixel according to the comparison result of the quantum comparator;

[0124] The median search module is used to combine the image to be processed and the eight-neighborhood color image into a 3×3 filter template, and compare the maximum pixel value of the first row, the middle pixel value of the second row, and the minimum pixel value of the third row in the adjusted 3×3 filter template in pairs to find the middle value of these three pixels, which is the median of the 3×3 filter template.

[0125] Among them, the implementation principles of the quantum comparator, quantum controlled switch and median search module in this embodiment 2 and the median filtering algorithm are consistent with those in embodiment 1, so they are not repeated in this embodiment.

[0126] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media that include computer-usable program code.

[0127] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices, and computer program products according to the embodiments of the present application. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0128] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0129] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0130] A person of ordinary skill in the art can understand that all or part of the steps in realizing the above-mentioned facts and methods can be completed by instructing the relevant hardware through a program, and the program involved or the program described can be stored in a computer-readable storage medium. When the program is executed, it includes the following steps: At this time, the corresponding method steps are derived, and the storage medium can be ROM / RAM, a disk, an optical disk, etc.

[0131] The specific implementation methods described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific implementation method of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.

Claims

1. A median filtering method for quantum color images, characterized in that: The following steps are involved: S1. Prepare the QRMW expression of the quantum color image to be processed and its eight-neighborhood color image; S2. According to the quantum circuit of the quantum color image median filter algorithm, the prepared quantum color image and its eight-neighborhood color images are searched for the median value to obtain the quantum color image expression; S3, measuring the quantum color image expression, obtaining information of each component from the quantum image expression, and converting it into a quantum color image according to the information of each component; The specific process of S1 includes: S11, obtaining basic information of the quantum color image to be processed, wherein the basic information includes grayscale information of the image, size information of the image, pixel position information and color channel information; S12, cyclically shifting the quantum color image to be processed to obtain eight neighborhood color images, and the quantum color image to be processed and the eight neighborhood color images together obtain nine images to be processed; S13, according to the basic information of the quantum color image to be processed, setting the quantum bits corresponding to the nine images to be processed; S14, according to the set quantum bits, prepare the grayscale information, common pixel position information and color channel information of the nine images to be processed, and obtain a quantum sequence of unique mapping of pixel position information, color channel information and grayscale information; The method for setting the quantum bit is: If the grayscale value setting range of the grayscale information of the quantum color image to be processed is [0, 2 m ], and the size is 2 n ×2 n , then the grayscale information corresponding to each image in the nine images to be processed is set with m qubits, and a total of 9×m qubits are set. If there are i color channels in the color channel information, then i-1 qubits are set to represent the color channel, and 2n qubits and 2 auxiliary qubits are set to represent the pixel position information shared by the nine images to be processed; The specific process of median filtering in step S2 includes: S21, the image to be processed and the eight-neighborhood color image are combined into a 3×3 filtering template, and the pixels in the template are compared and sorted using a quantum comparator: First, compare and sort the three pixels in each row of the 3×3 filter template; Then compare and sort the three pixels in each column of the 3×3 filter template; S22, compare the maximum pixel value of the first row, the middle pixel value of the second row, and the minimum pixel value of the third row of the sorted 3×3 filter template in pairs, and the final middle value is the median value of the 3×3 filter template.

2. The method for median filtering of quantum color images according to claim 1, characterized in that: In step S14, the process of uniquely mapping the pixel position information and the grayscale information specifically includes: S141, traversing pixel information of nine images to be processed, where the pixel information includes grayscale information, color channel information, and pixel position information; S142, preparing each pixel in the image to be processed: According to the initial states of the quantum bits corresponding to the pixel position information and the quantum bits corresponding to the color channel, an H-gate transformation is performed to prepare a superposition state of the pixel position and the color channel corresponding to each pixel; The required pixel position information and color channel information are transferred to the auxiliary quantum bits, and the change of the grayscale value is controlled by the auxiliary quantum bits to obtain a unique mapping relationship between the pixel position information and the grayscale information; According to the unique mapping relationship between pixel position information and grayscale information, after obtaining the grayscale value corresponding to the pixel position and color channel, the two auxiliary quantum bits are set to zero using a zeroing gate, and all operations performed on the pixel position information are restored; S143, repeat step S142 until the preparation of all pixels in all images to be processed is completed.

3. The method for median filtering of quantum color images according to claim 1, characterized in that: The quantum comparator outputs only one comparison result, and uses two auxiliary bits to complete the comparison sorting in the whole process. The comparison sorting process is ascending sorting. The three pixels in each row of the 3×3 filter template are sorted in ascending order from left to right, and then the three pixels in each column of the 3×3 filter template are sorted in ascending order from top to bottom. The specific process of ascending sorting is: The three pixels are compared in pairs to obtain the larger value of the two pixels, and the larger value is placed on the right or bottom using a quantum controlled switch; after the ascending order is completed, the maximum value of the three pixels is placed on the far right or bottom.

4. The method for median filtering of quantum color images according to claim 1, characterized in that: The specific process of step S3 includes: Measure the quantum color image expression to obtain the probability amplitude information of each state in the quantum image; According to the probability amplitude information of each state in the quantum image, the quantum color image after median filtering is converted into a quantum color image for display.

5. The method for median filtering of quantum color images according to claim 1, characterized in that: By using the open source quantum computing toolkit QISKIT, the IBMQ simulation cloud platform, and the package management and environment management functions provided by Anaconda, the Python language is used to simulate and implement quantum division operations to simulate the median filtering process of quantum color images.

6. A quantum color image median filtering system, the quantum color image median filtering system is used to execute the quantum color image median filtering method according to any one of claims 1 to 5, characterized in that: include: A quantum image preparation module is used to prepare the quantum color image to be processed and the QRMW expression of its eight-neighborhood color image; A median filter module is used to search for the median of the prepared quantum color image and its eight-neighborhood color images according to the quantum circuit of the quantum color image median filter algorithm to obtain a quantum color image expression; The quantum image restoration module is used to measure the quantum color image expression, obtain the information of each component from the quantum image expression, and convert it into a quantum color image according to the information of each component.

7. The median filtering system for quantum color images according to claim 6, characterized in that: The median filtering module comprises: A quantum comparator is used to compare and sort the three pixels in each row and column of the 3×3 filter template in ascending order; A quantum controlled switch, used for adjusting the position of the pixel according to the comparison result of the quantum comparator; The median search module is used to combine the image to be processed and the eight-neighborhood color image into a 3×3 filter template, and compare the maximum pixel value of the first row, the middle pixel value of the second row, and the minimum pixel value of the third row in the adjusted 3×3 filter template in pairs to find the middle value of these three pixels, which is the median of the 3×3 filter template.