Encrypted image search method based on quantum homomorphic K-nearest neighbor algorithm
Through the encrypted image search method based on the quantum homomorphic K nearest neighbor algorithm, the problems of low image retrieval accuracy and low efficiency in the prior art are solved, and high security and efficient image search in the cloud environment are realized, ensuring user privacy and Data security.
Patent Information
- Application Number
- CN202411423031.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-12
- Publication Date
- 2025-01-10
- Estimated Expiration
- 2044-10-12
AI Technical Summary
Existing content-based image retrieval solutions have problems such as low retrieval accuracy, low efficiency and key leakage in image search, and it is difficult to design high-security encryption technology to protect user privacy and data security.
The encrypted image search method based on the quantum homomorphic K nearest neighbor algorithm is adopted. By acquiring and encrypting the image feature vectors, encoding them into quantum states, and using cloud servers to perform exchange tests and Grover algorithm query, ensuring the security and availability of image search.
It improves the security and efficiency of image search, ensures user privacy and data protection, and avoids the problems of low retrieval accuracy and key leakage.
Smart Images

Figure CN119293820A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the quantum field, and specifically relates to an encrypted image search method based on a quantum homomorphic K-nearest neighbor algorithm. Background Art
[0002] With the popularization of cloud computing technology and the development of image processing technology, image search has become an important research field. In image search, users upload images and search, and the system will return results related to the image. However, with the increase in the amount of image data and the development of image processing algorithms, the security issues of image search have become increasingly important. Images uploaded by users may contain personal privacy information, such as faces, ID card numbers, etc. Cloud computing service providers need to take measures to ensure that user privacy is not leaked. Image search systems need to store a large amount of image data, which may contain important information such as commercial secrets. Cloud computing service providers need to ensure the security of data to prevent data from being maliciously acquired or tampered with. Image search algorithms may be attacked, such as adversarial attacks, model inversion, etc., resulting in inaccurate search results. Cloud computing service providers need to take measures to ensure the security of the algorithm to prevent the algorithm from being attacked or tampered with. Therefore, the security issues of cloud computing image search are crucial to ensuring user privacy and data security. Cloud computing service providers need to take corresponding measures to ensure the security and reliability of image search.
[0003] Existing content-based image retrieval schemes can support image retrieval while ensuring image privacy, but these schemes still have inherent defects, such as low retrieval accuracy, low retrieval efficiency, key leakage, etc. Inappropriate feature preservation mechanisms and inefficient ciphertext descriptors lead to lower performance than expected. Therefore, how to design encryption technology with high security and how to extract effective features from ciphertext images are still obstacles to privacy-preserving content-based image search. Summary of the invention
[0004] The purpose of the present invention is to provide an encrypted image search method based on a quantum homomorphic K-nearest neighbor algorithm, which can ensure the security and availability of images in a cloud environment while maintaining retrieval accuracy.
[0005] The present invention provides an encrypted image search method based on a quantum homomorphic K-nearest neighbor algorithm, comprising the following steps:
[0006] S1. Obtain a database image, extract an image feature vector, encrypt the feature, and send the encrypted database image feature vector to a cloud server;
[0007] S2. The cloud server encodes the encrypted database image features obtained in step S1 into quantum states and constructs an index;
[0008] S3. The user extracts and encrypts the features of the image to be queried, and sends the encrypted query request to the cloud server;
[0009] S4. The cloud server encodes the encrypted features of the query image into quantum states, and uses an exchange test to calculate the similarity between the query image and the database image;
[0010] S5. Based on the quantum phase estimation algorithm, the similarity obtained in step S4 is encoded into the quantum state, and then the K images with the highest similarity in the database image are queried based on the Grover algorithm, and the images are sent to the query image user;
[0011] S6. The query image user decrypts the K encrypted images obtained in step S5 to obtain image search results, thus completing the encrypted image search.
[0012] Step S1 includes the following steps:
[0013] Obtain a database image, crop the image to a preset size, then downsample it, standardize the grayscale value of the downsampled image, and convert it into a feature vector of a preset length;
[0014] The obtained feature vector is then encrypted and sent to the cloud server.
[0015] The encryption comprises the following steps:
[0016] For a grayscale image I of size m×n, a set of pixel value encryption keys is randomly generated and a set of pixel location encryption keys in, is the pixel value encryption key; θ xy Encryption key for the pixel value at (x, y); Keying groups for pixel locations; is the pixel position row encryption key, is the pixel position column encryption key, and
[0017] For the grayscale image I, the pixel value at (x, y) is C xy ∈[0,255], the angle parameter is
[0018] The generated pixel value encryption key is used to encrypt the pixel value of the grayscale image I, which is expressed using the following formula:
[0019] α xy =α' xy +θ xy
[0020] Among them, α xyis the angle parameter of the encrypted grayscale image I;
[0021] The pixel position encryption of the grayscale image I is performed using the generated pixel position encryption key, including the following steps:
[0022] Encrypt a in the key based on the pixel position i Transform each row of pixels in the grayscale image I, specifically: for the i-th row of pixels, if a i = 0, no operation is performed. i =1, then swap positions with (i+1)modm rows of pixels;
[0023] Encrypt b in the key based on the pixel position j Transform each column of the grayscale image I, specifically: for the jth column of pixels, if b j = 0, no operation is performed. j =1, the positions of the pixels in the (j+1)modn columns are swapped.
[0024] Step S2 is specifically as follows: the cloud server encodes the encrypted image features obtained in step S1 into quantum states and constructs an index; wherein the quantum state of a single m×n encrypted image is represented by the following formula:
[0025]
[0026] Among them, |I e > is the quantum state encrypted image; x is the horizontal coordinate index of the image; y is the vertical coordinate index of the image; x * is the horizontal coordinate index of the encrypted image; * is the ordinate index of the encrypted image; is the tensor product symbol; is the quantum state encoded by the pixel value of the encrypted image at position (x,y), and And the quantum state of the encrypted image satisfies the normalization condition, which is expressed by the following formula:
[0027]
[0028] Among them, ||I e || is the binary norm of the quantum state encrypted image;
[0029] Encode the encrypted database image features and obtain 2 λ The encrypted grayscale image of size m×n is expressed using the following formula:
[0030]
[0031] in, is the i-th quantum state encrypted grayscale image; |i> is the index of the i-th quantum state encrypted grayscale image; is the horizontal coordinate index of the i-th encrypted image; is the vertical coordinate index of the i-th encrypted image; is the quantum state encoded by the pixel value of the i-th encrypted image at the (x, y) position; the quantum state of the encrypted grayscale image satisfies the normalization condition and is expressed by the following formula:
[0032]
[0033] in, For 2 λ The second norm of the quantum state encrypted image.
[0034] Step S3 is as follows: the user uses step S1 to extract image features from the query image Q. For a grayscale image Q of size m×n, the pixel value at (x, y) in the image is B xy ∈[0,255], calculate the angle parameter And encrypting using the same key according to step S1 to obtain the feature vector of the encrypted image Q includes the following steps:
[0035] The generated pixel value encryption key is used to encrypt the pixel value of the grayscale image Q, which is expressed using the following formula:
[0036] B xy =B' xy +θ xy
[0037] Among them, B xy is the angle parameter of the encrypted grayscale image I;
[0038] The pixel position encryption of the grayscale image Q is performed using the generated pixel position encryption key, including the following steps:
[0039] Encrypt a in the key based on the pixel position i Transform each row of pixels in the grayscale image Q. Specifically, for the pixels in the i-th row, if a i = 0, no operation is performed. i =1, then swap positions with (i+1)modm rows of pixels;
[0040] Encrypt b in the key based on the pixel position j Transform each column of the grayscale image Q, specifically: for the jth column of pixels, if b j = 0, no operation is performed. j =1, the positions of the pixels in the (j+1)modn columns are swapped.
[0041] The feature vector of the encrypted image Q is then sent to the cloud server through a query request.
[0042] Step S4 includes the following steps:
[0043] The encoding method in step S2 is used to encode the encrypted image Q into a quantum state, which is represented by the following formula:
[0044]
[0045] Among them, |Q e > is the quantum state image to be queried; is the quantum state encoded by the angle parameter of the encrypted grayscale image Q, and
[0046] The initial quantum state of the exchange test is expressed using the following formula:
[0047]
[0048] Where |0> is the auxiliary quantum bit; |I e > is the quantum state database image; |Q e > is the quantum state image to be queried;
[0049] Perform the H gate operation on the auxiliary quantum bit to obtain the quantum state of the exchange test stage, which is expressed by the following formula:
[0050]
[0051] Perform the exchange gate operation on the auxiliary quantum bit, the quantum state database image, and the quantum state query image to obtain the exchange test two-stage quantum state, which is expressed by the following formula:
[0052]
[0053] Then perform the H gate operation on the auxiliary quantum bit to obtain the three-stage quantum state of the exchange test, which is expressed by the following formula:
[0054]
[0055] The probability of measuring the first quantum bit to be 0 is The probability of measuring 1 is Calculate the quantum state inner product of the encrypted database image and the query image, using the following formula:
[0056]
[0057] Calculate the similarity between the encrypted database image and the query image. The greater the similarity, the more similar the two images are. Use the following formula for calculation:
[0058]
[0059] Among them, d(I e ,Q e ) is the similarity between the encrypted database image and the query image.
[0060] Step S5 is specifically as follows:
[0061] The similarity obtained in step S4 is encoded into the quantum state, and the total quantum state is expressed using the following formula:
[0062]
[0063] Where N is the total number of database images; is the similarity measure substate between the query image and the i-th database image;
[0064] Based on the Grover algorithm, the cloud server extracts database images as the search object set, queries the K images with the highest similarity, and returns them to the user. The query process includes the following steps:
[0065] Randomly select a similarity ground state in the search object set as a threshold;
[0066] Use Grover's algorithm to search for other ground states with values greater than All ground states of
[0067] If the search result is not empty, a base state is randomly selected from the search result as the threshold and the previous step is repeated; the final threshold is output and deleted from the search object set;
[0068] Repeat the above steps K times to obtain K database images with the highest similarity as output results, and send the output results to the user.
[0069] Step S6 is as follows: the user receives the encrypted image R and decrypts it. The angle parameter vector of the encrypted image R is Decrypting the pixel value and pixel position separately includes the following steps:
[0070] Decrypt the pixel value using the pixel value encryption key used in step S1 and calculate the decrypted angle parameter Calculate the pixel value at position (x, y)
[0071] Decrypting the pixel position using the pixel position encryption key used in step S1 includes the following steps:
[0072] Encrypt a in the key based on the pixel position iTransform each row of pixels in the encrypted image R. Specifically, for the pixels in the i-th row, if a i = 0, no operation is performed. i =1, then swap positions with (i+1)modm rows of pixels;
[0073] Encrypt b in the key based on the pixel position j Transform each column of pixels in the encrypted image R, specifically: for the jth column of pixels, if b j = 0, no operation is performed. j =1, then swap positions with (j+1)modn columns of pixels;
[0074] Finally, the decrypted image search results are obtained, completing the encrypted image search.
[0075] The present invention discloses an encrypted image search method based on quantum homomorphic K-nearest neighbor algorithm, which uses quantum computing services of cloud platform to realize encrypted image search and ensure the security of private image data. At the same time, the method of the present invention utilizes the characteristics of quantum homomorphic encryption and quantum nearest neighbor, and uses Grover algorithm to search similarity, thereby improving the search efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0076] Figure 1 Schematic diagram of the process of the present invention
[0077] Figure 2 Schematic diagram of the quantum circuit for exchange testing in the method of the present invention. DETAILED DESCRIPTION
[0078] The present invention provides an encrypted image search method based on a quantum homomorphic K-nearest neighbor algorithm, the flow chart of which is as follows: Figure 1 As shown, the following steps are included:
[0079] S1. Obtaining a database image, extracting an image feature vector, encrypting the feature, and sending the obtained encrypted database image feature vector to a cloud server, including the following steps:
[0080] Obtain a database image, crop the image to a preset size, then downsample it, standardize the grayscale value of the downsampled image, and convert it into a feature vector of a preset length;
[0081] The obtained feature vector is then encrypted and sent to the cloud server.
[0082] The encryption comprises the following steps:
[0083] For a grayscale image I of size m×n, a set of pixel value encryption keys is randomly generated and a set of pixel location encryption keys in, The secret key for pixel value encryption; θ xy Encryption key for the pixel value at (x, y); encrypting a key set for a pixel location; is the pixel position row encryption key, is the pixel position column encryption key, and
[0084] For the grayscale image I, the pixel value at (x, y) is C xy ∈[0,255], the angle parameter is
[0085] The generated pixel value encryption key is used to encrypt the pixel value of the grayscale image I, which is expressed using the following formula:
[0086] α xy =α' xy +θ xy
[0087] Among them, α xy is the angle parameter of the encrypted grayscale image I;
[0088] The pixel position encryption of the grayscale image I is performed using the generated pixel position encryption key, including the following steps:
[0089] Encrypt a in the key based on the pixel position i Transform each row of pixels in the grayscale image I, specifically: for the i-th row of pixels, if a i = 0, no operation is performed. i =1, then swap positions with (i+1)modm rows of pixels;
[0090] Encrypt b in the key based on the pixel position j Transform each column of the grayscale image I, specifically: for the jth column of pixels, if b j = 0, no operation is performed. j =1, the positions of the pixels in the (j+1)modn columns are swapped.
[0091] S2. The cloud server encodes the encrypted database image features obtained in step S1 into quantum states and constructs an index, specifically:
[0092] The cloud server encodes the encrypted image features obtained in step S1 into quantum states and constructs an index; wherein the quantum state of a single m×n encrypted image is represented by the following formula:
[0093]
[0094] Among them, |Ie > is the quantum state encrypted image; x is the horizontal coordinate index of the image; y is the vertical coordinate index of the image; x * is the horizontal coordinate index of the encrypted image; * is the ordinate index of the encrypted image; is the tensor product symbol; is the quantum state encoded by the pixel value of the encrypted image at position (x,y), and And the quantum state of the encrypted image satisfies the normalization condition, which is expressed by the following formula:
[0095]
[0096] Among them, ||I e || is the binary norm of the quantum state encrypted image;
[0097] Encode the encrypted database image features and obtain 2 λ The encrypted grayscale image of size m×n is expressed using the following formula:
[0098]
[0099] in, is the i-th quantum state encrypted grayscale image; |i> is the index of the i-th quantum state encrypted grayscale image; is the horizontal coordinate index of the i-th encrypted image; is the vertical coordinate index of the i-th encrypted image; is the quantum state encoded by the pixel value of the i-th encrypted image at the (x, y) position; the quantum state of the encrypted grayscale image satisfies the normalization condition and is expressed by the following formula:
[0100]
[0101] in, For 2 λ The second norm of the quantum state encrypted image.
[0102] S3. The user extracts and encrypts the features of the image to be queried, and sends an encrypted query request to the cloud server, specifically:
[0103] The user uses step S1 to extract image features for the query image Q. For a grayscale image Q of size m×n, the pixel value at (x, y) in the image is B xy ∈[0,255], calculate the angle parameter And encrypting using the same key according to step S1 to obtain the feature vector of the encrypted image Q includes the following steps:
[0104] The generated pixel value encryption key is used to encrypt the pixel value of the grayscale image Q, which is expressed using the following formula:
[0105] B xy =B' xy +θ xy
[0106] Among them, B xy is the angle parameter of the encrypted grayscale image I;
[0107] The pixel position encryption of the grayscale image Q is performed using the generated pixel position encryption key, including the following steps:
[0108] Encrypt a in the key based on the pixel position i Transform each row of pixels in the grayscale image Q. Specifically, for the pixels in the i-th row, if a i = 0, no operation is performed. i =1, then swap positions with (i+1)modm rows of pixels;
[0109] Encrypt b in the key based on the pixel position j Transform each column of the grayscale image Q, specifically: for the jth column of pixels, if b j = 0, no operation is performed. j =1, the positions of the pixels in the (j+1)modn columns are swapped.
[0110] The feature vector of the encrypted image Q is then sent to the cloud server through a query request.
[0111] S4. The cloud server encodes the encrypted features of the query image into quantum states, and uses an exchange test to calculate the similarity between the query image and the database image, including the following steps:
[0112] Encode the encrypted image Q into a quantum state and express it using the following formula:
[0113]
[0114] Among them, |Q e > is the quantum state image to be queried; is the quantum state encoded by the angle parameter of the encrypted grayscale image Q, and
[0115] The schematic diagram of the quantum circuit for the exchange test is as follows Figure 2 As shown;
[0116] The initial quantum state of the exchange test is expressed using the following formula:
[0117]
[0118] Where |0> is the auxiliary quantum bit; |I e > is the quantum state database image; |Q e > is the quantum state image to be queried;
[0119] Perform the H gate operation on the auxiliary quantum bit to obtain the quantum state of the exchange test stage, which is expressed by the following formula:
[0120]
[0121] Perform the exchange gate operation on the auxiliary quantum bit, the quantum state database image, and the quantum state query image to obtain the exchange test two-stage quantum state, which is expressed by the following formula:
[0122]
[0123] Then perform the H gate operation on the auxiliary quantum bit to obtain the three-stage quantum state of the exchange test, which is expressed by the following formula:
[0124]
[0125] The probability of measuring the first quantum bit to be 0 is The probability of measuring 1 is Calculate the quantum state inner product of the encrypted database image and the query image, using the following formula:
[0126]
[0127] Calculate the similarity between the encrypted database image and the query image. The greater the similarity, the more similar the two images are. Use the following formula for calculation:
[0128]
[0129] Among them, d(I e ,Q e ) is the similarity between the encrypted database image and the query image.
[0130] S5. Based on the quantum phase estimation algorithm, the similarity obtained in step S4 is encoded into the quantum state, and then the K images with the highest similarity in the database image are queried based on the Grover algorithm, and the images are sent to the user of the image to be queried, specifically:
[0131] The similarity obtained in step S4 is encoded into the quantum state, and the total quantum state is expressed using the following formula:
[0132]
[0133] Where N is the total number of database images; is the similarity measure substate between the query image and the i-th database image;
[0134] Based on the Grover algorithm, the cloud server extracts database images as the search object set, queries the K images with the highest similarity, and returns them to the user. The query process includes the following steps:
[0135] Randomly select a similarity ground state in the search object set as a threshold;
[0136] Use Grover's algorithm to search for other ground states with values greater than All ground states of
[0137] If the search result is not empty, a base state is randomly selected from the search result as the threshold and the previous step is repeated; if the search result is empty, the final threshold is output and deleted from the search object set;
[0138] Repeat the above steps K times to obtain K database images with the highest similarity as output results, and send the output results to the user.
[0139] S6. The query image user decrypts the K encrypted images obtained in step S5 to obtain image search results, and completes the encrypted image search, specifically:
[0140] The user receives the encrypted image R and decrypts it. The angle parameter vector of the encrypted image R is Decrypting the pixel value and pixel position separately includes the following steps:
[0141] Decrypt the pixel value using the pixel value encryption key used in step S1 and calculate the decrypted angle parameter Calculate the pixel value at position (x, y)
[0142] Decrypting the pixel position using the pixel position encryption key used in step S1 includes the following steps:
[0143] Encrypt a in the key based on the pixel position i Transform each row of pixels in the encrypted image R. Specifically, for the pixels in the i-th row, if a i = 0, no operation is performed. i =1, then swap positions with (i+1)modm rows of pixels;
[0144] Encrypt b in the key based on the pixel position j Transform each column of pixels in the encrypted image R, specifically: for the jth column of pixels, if b j = 0, no operation is performed. j=1, then swap positions with (j+1)modn columns of pixels;
[0145] Finally, the decrypted image search results are obtained, completing the encrypted image search.
Claims
1. An encrypted image search method based on quantum homomorphic K-nearest neighbor algorithm, characterized in that: The following steps are involved: S1. Obtain a database image, extract an image feature vector, encrypt the feature, and send the encrypted database image feature vector to a cloud server; S2. The cloud server encodes the encrypted database image features obtained in step S1 into quantum states and constructs an index; S3. The user extracts and encrypts the features of the image to be queried, and sends the encrypted query request to the cloud server; S4. The cloud server encodes the encrypted features of the query image into quantum states, and uses an exchange test to calculate the similarity between the query image and the database image; S5. Based on the quantum phase estimation algorithm, the similarity obtained in step S4 is encoded into the quantum state, and then the K images with the highest similarity in the database image are queried based on the Grover algorithm, and the images are sent to the query image user; S6. The query image user decrypts the K encrypted images obtained in step S5 to obtain image search results, thus completing the encrypted image search.
2. The encrypted image search method based on the quantum homomorphic K-nearest neighbor algorithm according to claim 1 is characterized in that: In step S1, a database image is obtained, the image is cropped to a preset size, and then downsampled, and the grayscale value of the downsampled image is standardized and converted into a feature vector of a preset length; The obtained feature vector is then encrypted and sent to the cloud server.
3. The encrypted image search method based on the quantum homomorphic K-nearest neighbor algorithm according to claim 2 is characterized in that: The encryption comprises the following steps: For a grayscale image I of size m×n, a set of pixel value encryption keys is randomly generated and a set of pixel location encryption keys in, The secret key for pixel value encryption; θ xy Encryption key for the pixel value at (x, y); encrypting a key set for a pixel location; is the pixel position row encryption key, is the pixel position column encryption key, and For the grayscale image I, the pixel value at (x, y) is C xy ∈[0,255], the angle parameter is The generated pixel value encryption key is used to encrypt the pixel value of the grayscale image I, which is expressed using the following formula: a xy =a' xy +θ xy Among them, α xy is the angle parameter of the encrypted grayscale image I; The pixel position encryption of the grayscale image I is performed using the generated pixel position encryption key, including the following steps: Encrypt a in the key based on the pixel position i Transform each row of pixels in the grayscale image I, specifically: for the i-th row of pixels, if a i = 0, no operation is performed. i =1, then swap positions with (i+1)modm rows of pixels; Encrypt b in the key based on the pixel position j Transform each column of the grayscale image I, specifically: for the jth column of pixels, if b j = 0, no operation is performed. j =1, the positions of the pixels in the (j+1)modn columns are swapped.
4. The encrypted image search method based on the quantum homomorphic K-nearest neighbor algorithm according to claim 1 is characterized in that: Step S2 is specifically as follows: the cloud server encodes the encrypted image features obtained in step S1 into quantum states and constructs an index; wherein the quantum state of a single m×n encrypted image is represented by the following formula: Among them, |I e > is the quantum state encrypted image; x is the horizontal coordinate index of the image; y is the vertical coordinate index of the image; x * is the horizontal coordinate index of the encrypted image; * is the ordinate index of the encrypted image; is the tensor product symbol; is the quantum state encoded by the pixel value of the encrypted image at position (x,y), and And the quantum state of the encrypted image satisfies the normalization condition, which is expressed by the following formula: Among them, ||I e || is the binary norm of the quantum state encrypted image; Encode the encrypted database image features and obtain 2 λ The encrypted grayscale image of size m×n is expressed using the following formula: in, is the i-th quantum state encrypted grayscale image; |i> is the index of the i-th quantum state encrypted grayscale image; is the horizontal coordinate index of the i-th encrypted image; is the vertical coordinate index of the i-th encrypted image; is the quantum state encoded by the pixel value of the i-th encrypted image at the (x, y) position; the quantum state of the encrypted grayscale image satisfies the normalization condition and is expressed by the following formula: in, For 2 λ The second norm of the quantum state encrypted image.
5. The encrypted image search method based on quantum homomorphic K-nearest neighbor algorithm according to claim 1 is characterized in that: Step S3 is as follows: the user uses step S1 to extract image features from the query image Q. For a grayscale image Q of size m×n, the pixel value at (x, y) in the image is B' xy ∈[0,255], calculate the angle parameter And encrypting using the same key according to step S1 to obtain the feature vector of the encrypted image Q includes the following steps: The generated pixel value encryption key is used to encrypt the pixel value of the grayscale image Q, which is expressed using the following formula: B xy =B' xy +θ xy Among them, B xy is the angle parameter of the encrypted grayscale image I; The pixel position encryption of the grayscale image Q is performed using the generated pixel position encryption key, including the following steps: Encrypt a in the key based on the pixel position i Transform each row of pixels in the grayscale image Q. Specifically, for the pixels in the i-th row, if a i = 0, no operation is performed. i =1, then swap positions with (i+1)modm rows of pixels; Encrypt b in the key based on the pixel position j Transform each column of the grayscale image Q, specifically: for the jth column of pixels, if b j = 0, no operation is performed. If b j =1, the positions of the pixels in the (j+1)modn columns are swapped. The feature vector of the encrypted image Q is then sent to the cloud server through a query request.
6. The encrypted image search method based on quantum homomorphic K-nearest neighbor algorithm according to claim 1, characterized in that: Step S4 includes the following steps: Encode the encrypted image Q into a quantum state and express it using the following formula: Among them, |Q e > is the quantum state image to be queried; is the quantum state encoded by the angle parameter of the encrypted grayscale image Q, and The initial quantum state of the exchange test is expressed using the following formula: Where |0> is the auxiliary quantum bit; |I e > is the quantum state database image; |Q e > is the quantum state image to be queried; Perform the H gate operation on the auxiliary quantum bit to obtain the quantum state of the exchange test stage, which is expressed by the following formula: Perform the exchange gate operation on the auxiliary quantum bit, the quantum state database image, and the quantum state query image to obtain the exchange test two-stage quantum state, which is expressed by the following formula: Then perform the H gate operation on the auxiliary quantum bit to obtain the three-stage quantum state of the exchange test, which is expressed by the following formula: The probability of measuring the first quantum bit to be 0 is The probability of measuring 1 is Calculate the quantum state inner product of the encrypted database image and the query image, using the following formula: Calculate the similarity between the encrypted database image and the query image. The greater the similarity, the more similar the two images are. Use the following formula for calculation: Among them, d(I e ,Q e ) is the similarity between the encrypted database image and the query image.
7. The encrypted image search method based on quantum homomorphic K-nearest neighbor algorithm according to claim 1 is characterized in that: Step S5 is specifically as follows: The similarity obtained in step S4 is encoded into the quantum state, and the total quantum state is expressed using the following formula: Where N is the total number of database images; is the similarity measure substate between the query image and the i-th database image; Based on the Grover algorithm, the cloud server extracts database images as the search object set, queries the K images with the highest similarity, and returns them to the user. The query process includes the following steps: Randomly select a similarity ground state in the search object set as a threshold; Use Grover's algorithm to search for other ground states with values greater than All ground states of If the search result is not empty, a base state is randomly selected from the search result as the threshold and the previous step is repeated; if the search result is empty, the final threshold is output and deleted from the search object set; Repeat the above steps K times to obtain K database images with the highest similarity as output results, and send the output results to the user.
8. The encrypted image search method based on quantum homomorphic K-nearest neighbor algorithm according to claim 1, characterized in that: Step S6 is as follows: the user receives the encrypted image R and decrypts it. The angle parameter vector of the encrypted image R is Decrypting the pixel value and pixel position separately includes the following steps: Decrypt the pixel value using the pixel value encryption key used in step S1 and calculate the decrypted angle parameter Calculate the pixel value at position (x, y) Decrypting the pixel position using the pixel position encryption key used in step S1 includes the following steps: Encrypt a in the key based on the pixel position i Transform each row of pixels in the encrypted image R. Specifically, for the pixels in the i-th row, if a i = 0, no operation is performed. i =1, then swap positions with (i+1)modm rows of pixels; Encrypt b in the key based on the pixel position j Transform each column of pixels in the encrypted image R, specifically: for the jth column of pixels, if b j = 0, no operation is performed. j =1, then swap positions with (j+1)modn columns of pixels; Finally, the decrypted image search results are obtained, completing the encrypted image search.
Citation Information
Patent Citations
Image classification method based on quantum nearest-neighbor algorithm
CN106650808A
Privacy-protected encrypted image retrieval method and system
CN112528064A
Synchronous image encryption and fusion method based on quantum Baker mapping
CN114221756A
Quantum image encryption and decryption method based on quantum DNA codec
CN116150777A
Quantum classical hybrid image encryption method and system
CN118509152A