Encrypted image search method based on quantum homomorphism k-nearest neighbor algorithm
By combining the quantum homomorphic K-nearest neighbor algorithm and the Grover algorithm, a highly secure and efficient image search is achieved in a cloud environment, solving the problems of low accuracy and low efficiency in image retrieval in existing technologies, and ensuring image privacy and data security.
Patent Information
- Application Number
- CN202411423031.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-12
- Publication Date
- 2025-11-07
- Estimated Expiration
- 2044-10-12
AI Technical Summary
Existing content-based image retrieval solutions suffer from problems such as low retrieval accuracy, low retrieval efficiency, and key leakage, and cannot effectively protect image privacy and data security.
An encrypted image search method based on the quantum homomorphic K-nearest neighbor algorithm is adopted. The image feature vector is encrypted and encoded into a quantum state. Secure image search is performed using a cloud server. The Grover algorithm is used to find the image with the highest similarity, and the result is decrypted on the user's end.
While ensuring image security, it improves retrieval accuracy and efficiency, and protects user privacy and data security.
Smart Images

Figure CN119293820B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the field of quantum, and particularly relates to an encrypted image search method based on a quantum homomorphism K nearest neighbor algorithm. BACKGROUND
[0002] With the popularity 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 perform searches, and the system will return results related to the images. However, with the increase in the amount of image data and the development of image processing algorithms, the security of image search has become increasingly important. User-uploaded images may contain personal privacy information, such as faces, ID 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 business secrets. Cloud computing service providers need to ensure the security of the data to prevent it from being maliciously obtained or tampered with. Image search algorithms may be attacked, such as adversarial attacks, model reverse engineering, etc., resulting in inaccurate search results. Cloud computing service providers need to take measures to ensure the security of the algorithm to prevent it from being attacked or tampered with. Therefore, the security of cloud computing image search is crucial to ensuring user privacy and data security. Cloud computing service providers need to take appropriate 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 result in lower performance than expected. Therefore, how to design encryption technology with high security, how to extract effective features from ciphertext images, are still obstacles to privacy-protecting content-based image search. SUMMARY
[0004] The purpose of the present application is to provide an encrypted image search method based on a quantum homomorphism K nearest neighbor algorithm, which can ensure the security and availability of images in a cloud environment while maintaining retrieval accuracy.
[0005] The present application provides an encrypted image search method based on a quantum homomorphism K nearest neighbor algorithm, comprising the following steps:
[0006] S1. Obtain database images, extract image feature vectors, and encrypt the features, and send the obtained encrypted database image feature vectors 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 the features of the image to be queried and encrypts them, and sends an encrypted query request to the cloud server;
[0009] S4. The cloud server encodes the encrypted features of the image to be queried into quantum states, and calculates the similarity between the image to be queried and the database images using the swap test;
[0010] S5. Based on the quantum phase estimation algorithm, the similarity obtained in step S4 is encoded onto the quantum state, and then the K images with the highest similarity in the database images are queried based on the Grover algorithm, and are sent to the user of the image to be queried;
[0011] S6. The user of the image to be queried decrypts the K encrypted images obtained in step S5 to obtain the image search result, and completes the encrypted image search.
[0012] Step S1 includes the following steps:
[0013] Obtain the database images, crop the images to a predetermined size, and then downsample them. The gray values of the downsampled images are standardized and converted into feature vectors of a predetermined length;
[0014] The obtained feature vectors are then encrypted, and the encrypted feature vectors are sent to the cloud server.
[0015] The encryption includes the following steps:
[0016] For a gray-scale image I of size m x n, a set of pixel value encryption keys and a set of pixel position encryption keys wherein is the pixel value encryption key; θ xy is the pixel value encryption key at (x, y); is the pixel position encryption key set; is the pixel position row encryption key, is the pixel position column encryption key, and
[0017] For a gray-scale image I, the pixel value at (x, y) is C xy ∈ [0, 255], and the angle parameter is
[0018] The generated pixel value encryption key is used to encrypt the pixel values of the gray-scale image I, which can be represented by the following formula:
[0019] α xy = α' xy + θ xy
[0020] wherein α xyAn angle parameter of the encrypted gray image I;
[0021] Pixel position encryption is performed on the gray image I by using the generated pixel position encryption key, including the following steps:
[0022] According to a in the pixel position encryption key i The transformation is performed on each row of pixels of the gray image I, specifically: for the i-th row of pixels, if a i = 0, no operation is performed, and if a i = 1, the position is exchanged with the (i+1) mod m row of pixels.
[0023] According to b in the pixel position encryption key j The transformation is performed on each column of pixels of the gray image I, specifically: for the j-th column of pixels, if b j = 0, no operation is performed, and if b j = 1, the position is exchanged with the (j+1) mod n column of pixels.
[0024] Step S2 is specifically: the cloud server encodes the encrypted image feature obtained in step S1 into a quantum state, and constructs an index; wherein the quantum state of a single m x n size encrypted image is represented by the following formula:
[0025]
[0026] Wherein, |I e > is a 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; y * is the vertical coordinate index of the encrypted image; is a tensor product symbol; is a quantum state formed by encoding the pixel value of the encrypted image at the (x, y) position, and The quantum state of the encrypted image satisfies the normalization condition, which is represented by the following formula:
[0027]
[0028] Wherein, ||I e || is the two-norm of the quantum state encrypted image;
[0029] The encrypted database image features are encoded to obtain a 2 λ m x n size encrypted gray image, which is represented by the following formula:
[0030]
[0031] Wherein, is the i-th quantum state encrypted gray-scale image; |i> is the index of the i-th quantum state encrypted gray-scale 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 of the pixel value encoding of the i-th encrypted image at the (x, y) position; the quantum state of the encrypted gray-scale image satisfies the normalization condition, which is expressed using the following formula:
[0032]
[0033] wherein, is 2 λ norm of the quantum state encrypted image.
[0034] Step S3 is specifically: the user extracts image features from the image to be queried Q using the steps in step S1, and for a gray-scale image Q with a size of m x n, the pixel value at (x, y) in the image is B xy ∈ [0, 255], the angle parameter θ is calculated and encrypted using the same key as in step S1 to obtain the feature vector of the encrypted image Q, including the following steps:
[0035] The generated pixel value encryption key is used to encrypt the pixel value of the gray-scale image Q, which is expressed using the following formula:
[0036] B xy = B' xy + θ xy
[0037] wherein, B xy is the angle parameter of the encrypted gray-scale image I;
[0038] The generated pixel position encryption key is used to encrypt the pixel position of the gray-scale image Q, including the following steps:
[0039] According to a i in the pixel position encryption key, each row of pixels of the gray-scale image Q is transformed, specifically: for the i-th row of pixels, if a i = 0, no operation is performed, and if a i = 1, the position of the (i+1) mod m row of pixels is exchanged;
[0040] According to b j in the pixel position encryption key, each column of pixels of the gray-scale image Q is transformed, specifically: for the j-th column of pixels, if b j = 0, no operation is performed, and if b j = 1, the position of the (j+1) mod n column of pixels is exchanged.
[0041] The feature vector of the encrypted image Q is then sent to the cloud server through a query request.
[0042] Step S4 comprises the following steps:
[0043] The encrypted image Q is encoded into a quantum state using the encoding method in step S2, which is represented using the following formula:
[0044]
[0045] where |Q e > is the quantum state of the image to be queried; is the quantum state of the angle parameter encoding of the encrypted gray image Q, and
[0046] The initial quantum state of the exchange test is represented using the following formula:
[0047]
[0048] where |0> is the auxiliary quantum bit; |I e > is the quantum state of the database image; |Q e > is the quantum state of the image to be queried;
[0049] An H gate operation is performed on the auxiliary quantum bit to obtain the first-stage quantum state of the exchange test, which is represented using the following formula:
[0050]
[0051] An exchange gate operation is performed on the auxiliary quantum bit, the quantum state of the database image, and the quantum state of the image to be queried to obtain the second-stage quantum state of the exchange test, which is represented using the following formula:
[0052]
[0053] An H gate operation is further performed on the auxiliary quantum bit to obtain the third-stage quantum state of the exchange test, which is represented using the following formula:
[0054]
[0055] The probability of measuring 0 for the first bit quantum bit is The probability of measuring 1 is The quantum state inner product of the encrypted database image and the image to be queried is calculated, which is represented using the following formula:
[0056]
[0057] The similarity of the encrypted database image and the image to be queried is calculated, and the greater the similarity, the more similar the two images are, which is calculated using the following formula:
[0058]
[0059] wherein, d(I e , Q e ) is the similarity of the encrypted database image and the image to be queried.
[0060] Step S5 is specifically:
[0061] The similarity obtained in step S4 is encoded into a quantum state, and the total quantum state is represented by the following formula:
[0062]
[0063] wherein, N is the total number of database images; is the similarity quantum state of the image to be queried and the i-th database image;
[0064] The cloud server extracts the database images as the search object set based on the Grover algorithm, queries the K images with the highest similarity, and returns them to the user, wherein the query process includes the following steps:
[0065] Randomly select a similarity ground state in the search object set as a threshold;
[0066] Use the Grover algorithm to search for all ground states with a value greater than in other ground states;
[0067] If the search result is not empty, randomly select a ground state in the search result as a threshold, repeat the previous step; output the final threshold and delete it from the search object set;
[0068] Repeat the above steps K times to obtain the K database images with the highest similarity as the output result, and send the output result to the user.
[0069] Step S6 is specifically: the user receives the encrypted image R for decryption, and the angle parameter vector of the encrypted image R is Decrypt the pixel value and the pixel position respectively, including the following steps:
[0070] Decrypt the pixel value using the pixel value encryption key used in step S1, calculate the decrypted angle parameter Calculate the pixel value at position (x, y) as
[0071] Decrypt the pixel position using the pixel position encryption key used in step S1, including the following steps:
[0072] According to a iTransform each row of pixels of the encrypted image R, specifically: for the i-th row of pixels, if a i =0, no operation is performed, and if a i =1, the position is exchanged with the (i+1)modm-th row of pixels.
[0073] According to the pixel position encryption key b j Transform each column of pixels of the encrypted image R, specifically: for the j-th column of pixels, if b j =0, no operation is performed, and if b j =1, the position is exchanged with the (j+1)modn-th column of pixels.
[0074] Finally, the decrypted image search result is obtained, and the encrypted image search is completed.
[0075] The application discloses an encrypted image search method based on a quantum homomorphism K-nearest neighbor algorithm, which realizes encrypted image search by using quantum computing services of a cloud platform, and guarantees the security of private image data. BRIEF DESCRIPTION OF DRAWINGS
[0076] Figure 1 is a flowchart of the method of the application
[0077] Figure 2 is a quantum circuit diagram of the exchange test in the method of the application. DETAILED DESCRIPTION
[0078] The application provides an encrypted image search method based on a quantum homomorphism K-nearest neighbor algorithm, and a flowchart thereof is shown in Figure 1 The method comprises the following steps:
[0079] S1. Obtain database images, extract image feature vectors, encrypt the features, and send the obtained encrypted database image feature vectors to a cloud server, which comprises the following steps:
[0080] Obtain database images, crop the images to a preset size, and then perform down-sampling; the gray values of the down-sampled images are normalized to convert the feature vectors into feature vectors of a preset length;
[0081] The obtained feature vectors are encrypted, and the encrypted feature vectors are sent to the cloud server.
[0082] The encryption comprises the following steps:
[0083] For a gray-scale image I of size m*n, a set of pixel value encryption keys and a set of pixel position encryption keys wherein, is a pixel value encryption key; θ xy is a pixel value encryption key at (x, y); is a pixel position encryption key group; is a pixel position row encryption key, is a pixel position column encryption key, and
[0084] For a grayscale image I, the pixel value at (x, y) is C xy ∈ [0, 255], and the angle parameter is
[0085] The pixel value encryption of the grayscale image I is performed using the generated pixel value encryption key, which is represented by the following formula:
[0086] α xy = α' xy + θ xy
[0087] wherein, α xy is an 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] According to a i in the pixel position encryption key, each row of pixels of the grayscale image I is transformed, specifically: for the i-th row of pixels, if a i = 0, no operation is performed, and if a i = 1, the position is exchanged with the (i+1) mod m row of pixels.
[0090] According to b j in the pixel position encryption key, each column of pixels of the grayscale image I is transformed, specifically: for the j-th column of pixels, if b j = 0, no operation is performed, and if b j = 1, the position is exchanged with the (j+1) mod n column of pixels.
[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 x n size encrypted image is represented by the following formula:
[0093]
[0094] wherein, |Ie is the quantum state of the 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; y * is the vertical coordinate index of the encrypted image; is the tensor product symbol; is the quantum state of the pixel value encoding of the encrypted image at the (x, y) position, and and the quantum state of the encrypted image satisfies the normalization condition, which is expressed using the following formula:
[0095]
[0096] where ||I e || is the two-norm of the quantum state of the encrypted image;
[0097] The encrypted database image features are encoded to obtain 2 λ m x n size of the encrypted grayscale image, which is expressed using the following formula:
[0098]
[0099] where, 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 of the pixel value encoding of the i-th encrypted image at the (x, y) position; the quantum state of the encrypted grayscale image satisfies the normalization condition, which is expressed using the following formula:
[0100]
[0101] where, is the two-norm of the 2 λ quantum state encrypted image.
[0102] S3. The user extracts the features of the image to be queried and encrypts, and sends an encrypted query request to the cloud server, specifically:
[0103] The user extracts the image features of the image to be queried Q using step S1, and for a grayscale image Q of size m x n, the pixel value at (x, y) in the image is B xy ∈ [0, 255], and the angle parameter is calculated, and the same key is used for encryption according to step S1 to obtain the feature vector of the encrypted image Q, including the following steps:
[0104] The generated pixel value encryption key is used to encrypt the pixel value of the gray image Q, which is represented by the following formula:
[0105] B xy = B' xy + θ xy
[0106] wherein B xy is the angle parameter of the encrypted gray image I;
[0107] The generated pixel position encryption key is used to encrypt the pixel position of the gray image Q, including the following steps:
[0108] According to a i in the pixel position encryption key, the pixels in each row of the gray image Q are transformed, specifically: for the i-th row of pixels, if a i = 0, no operation is performed, and if a i = 1, the position of the (i+1) mod m row of pixels is exchanged;
[0109] According to b j in the pixel position encryption key, the pixels in each column of the gray image Q are transformed, specifically: for the j-th column of pixels, if b j = 0, no operation is performed, and if b j = 1, the position of the (j+1) mod n column of pixels is exchanged.
[0110] Then the feature vector of the encrypted image Q is sent to the cloud server through a query request.
[0111] S4. The cloud server encodes the encrypted query image feature into a quantum state, and calculates the similarity between the query image and the database image using the swap test, including the following steps:
[0112] The encrypted image Q is encoded into a quantum state, represented by the following formula:
[0113]
[0114] wherein |Q e > is the quantum state of the query image; is the quantum state encoded by the angle parameter of the encrypted gray image Q, and
[0115] The quantum circuit diagram of the swap test is shown in Figure 2 ;
[0116] The initial quantum state of the swap test is represented by the following formula:
[0117]
[0118] wherein |0> is an ancillary qubit; |I e > is a quantum state database image; |Q e > is a quantum state to be queried image;
[0119] An H gate operation is performed on the ancillary qubit to obtain an exchange test first-stage quantum state, which is expressed by the following formula:
[0120]
[0121] An exchange gate operation is performed on the ancillary qubit, the quantum state database image, and the quantum state to be queried image to obtain an exchange test second-stage quantum state, which is expressed by the following formula:
[0122]
[0123] An H gate operation is further performed on the ancillary qubit to obtain an exchange test third-stage quantum state, which is expressed by the following formula:
[0124]
[0125] The first bit qubit is measured, and the probability of measuring 0 is The probability of measuring 1 is The quantum state inner product of the encrypted database image and the to-be-queried image is calculated, which is expressed by the following formula:
[0126]
[0127] The similarity of the encrypted database image and the to-be-queried image is calculated, and the greater the similarity, the more similar the two images are, which is calculated by the following formula:
[0128]
[0129] wherein, d(I e ,Q e ) is the similarity of the encrypted database image and the to-be-queried image.
[0130] S5. Based on the quantum phase estimation algorithm, the similarity obtained in step S4 is encoded into a quantum state, and then based on the Grover algorithm, the K images with the highest similarity in the database image are queried and sent to the to-be-queried image user, which is specifically:
[0131] The similarity obtained in step S4 is encoded into a quantum state, and the total quantum state is expressed by the following formula:
[0132]
[0133] wherein, N is the total number of database images; a quantum state of similarity between the image to be queried and the i-th database image;
[0134] The cloud server extracts the database images as the search object set based on the Grover algorithm, queries K images with the highest similarity, and returns them to the user, wherein the query process includes the following steps:
[0135] Randomly select a similarity ground state in the search object set as a threshold value;
[0136] Use the Grover algorithm to search for all ground states with values greater than in other ground states;
[0137] If the search result is not empty, randomly select a ground state as a threshold value in the search result, repeat the previous step; if the search result is empty, output the final threshold value and delete it from the search object set;
[0138] Repeat the above steps K times to obtain K database images with the highest similarity as the output result, and send the output result to the user.
[0139] S6. The user decrypts the K encrypted images obtained in step S5 to obtain the image search result, 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 Decrypt the pixel value and pixel position, including the following steps:
[0141] Decrypt the pixel value using the pixel value encryption key used in step S1 to calculate the decrypted angle parameter The pixel value at position (x, y) is calculated as
[0142] Decrypt the pixel position using the pixel position encryption key used in step S1, including the following steps:
[0143] According to a i Transform each row of pixels in the encrypted image R, specifically: for the i-th row of pixels, if a i = 0, do nothing, if a i = 1, exchange the position with the (i+1) mod m row of pixels;
[0144] According to b j Transform each column of pixels in the encrypted image R, specifically: for the j-th column of pixels, if b j = 0, do nothing, if b j= 1, then the position of the (j+1) mod n column pixel is exchanged with the position of the j mod n column pixel.
[0145] Finally, the decrypted image search result is obtained, and the encrypted image search is completed.
Claims
1. A method for encrypted image search based on quantum homomorphic K- nearest neighbor algorithm, characterized in that, The method comprises the following steps: S1. Obtain a database image, extract an image feature vector, encrypt the feature, and send the obtained encrypted database image feature vector to a cloud server; S2. The cloud server encodes the encrypted database image feature obtained in step S1 into a quantum state and constructs an index; S3. A user extracts the feature of an image to be queried and encrypts it, and sends an encrypted query request to the cloud server; S4. The cloud server encodes the encrypted image feature to be queried into a quantum state, and calculates the similarity between the image to be queried and the database image using an exchange test; S5. Based on a quantum phase estimation algorithm, the similarity obtained in step S4 is encoded onto a quantum state, and K images with the highest similarity in the database image are queried based on a Grover algorithm and sent to the user of the image to be queried; S6. The user of the image to be queried decrypts the K encrypted images obtained in step S5 to obtain an image search result, and completes the encrypted image search; In step S1, the encryption comprises the following steps: For a gray-scale image of size , a set of pixel value encryption keys and a set of pixel position encryption keys are randomly generated, where is a pixel value encryption secret key; is a pixel value encryption key at ; is a pixel position encryption key set; is a pixel position row encryption key, is a pixel position column encryption key, and , , ; for a grayscale image , a pixel value at , an angle parameter ; Encrypting a key using generated pixel values for a grayscale image Pixel value encryption is performed using the following equation: wherein, is the encrypted grayscale image angle parameter; Encrypting pixel positions using generated pixel position encryption keys for grayscale images Performing pixel position encryption, comprising the steps of: According to the pixel position, the encryption key is encrypted For a gray image Transform each row of pixels, specifically: for the first row of pixels, if , do not perform any operation, if , exchange positions with the row of pixels; According to the pixel position, the encryption key is encrypted For a gray image Transform each column of pixels, specifically: for the first Column of pixels, if No operation is performed, if The position of the column of pixels is exchanged with The column of pixels Step S4 comprises the following steps: The encrypted image Encoding into quantum states, using the following formula: wherein, is a quantum state to be queried for an image; is a quantum state to be queried for an image; is a quantum state to be queried for an image; is a quantum state to be queried for an image; The initial quantum state of the exchange test is represented by the following formula: wherein is an ancilla qubit; is a quantum state database image; is a quantum state image to be queried; An H gate operation is performed on the auxiliary quantum bit to obtain an exchange test one-stage quantum state, which is represented by the following formula: An exchange gate operation is performed on the auxiliary quantum bit, the quantum state database image, and the quantum state image to be queried to obtain an exchange test two-stage quantum state, which is represented by the following formula: An H gate operation is performed on the auxiliary quantum bit to obtain an exchange test three-stage quantum state, which is represented by the following formula: The first qubit is measured, and the probability of measuring 0 is , and the probability of measuring 1 is The quantum state inner product of the encrypted database image and the image to be queried is calculated, and is expressed using the following formula: The similarity of the encrypted database image and the image to be queried is calculated, and the greater the similarity, the more similar the two images are, which is calculated by the following formula: wherein, is the similarity of the encrypted database image and the image to be queried.
2. The method of claim 1, wherein the quantum homomorphic K- nearest neighbor algorithm-based encrypted image search method is characterized by, In step S1, the database image is obtained, the image is cropped to a predetermined size, and then down-sampling is performed. The gray value of the down-sampled image is normalized to convert it into a feature vector of a predetermined length; The obtained feature vector is encrypted, and the encrypted feature vector is sent to the cloud server. 3.The quantum homomorphic K-nearest neighbor algorithm based encrypted image search method of claim 1, wherein, Step S2 specifically involves: the cloud server encoding the encrypted image features obtained in step S1 into quantum states and constructing an index; wherein, a single image... The quantum state of a size-encrypted image is represented using the following formula: wherein, is a quantum state of an encrypted image; is an index of a horizontal coordinate of the image; is an index of a vertical coordinate of the image; is an index of a horizontal coordinate of the encrypted image; is an index of a vertical coordinate of the encrypted image; is a tensor product symbol; is a quantum state of an encrypted image at a pixel value encoding of a pixel at a position of the encrypted image, and is a quantum state of an encrypted image at a pixel value encoding of a pixel at a position of the encrypted image, and ; and the quantum state of the encrypted image satisfies a normalization condition, expressed using the following formula: wherein, is the two-norm of the quantum state encrypted image; The encrypted database image features are encoded to obtain amplitude encrypted gray-scale image of a certain size, which is represented by the following formula: in, For the first Quantum state encrypted grayscale image; For the first Index of a quantum state encrypted grayscale image; For the first The horizontal coordinate index of the encrypted image; For the first The ordinate index of the encrypted image; For the first Encrypted images in The quantum state is encoded from the pixel value of the location; the quantum state of the encrypted grayscale image satisfies the normalization condition and is represented by the following formula: wherein is The two-norm of the amplitude quantum state encrypted image.
4. The method of claim 1, wherein the quantum homomorphic K- nearest neighbor algorithm-based encrypted image search method is characterized by, Step S3 is specifically: the user uses the step S1 step to the image to be queried Carries out image feature extraction, for the gray image of size , the pixel value in the image is , calculates the angle parameter ; and uses the same key according to step S1 to encrypt, obtains the feature vector of encrypted image , including the following steps: Encrypting a key using generated pixel values for a grayscale image Pixel value encryption is performed using the following equation: wherein, is an encrypted grayscale image angle parameter of the grayscale image; Encrypting pixel positions using generated pixel position encryption keys for grayscale images Performing pixel position encryption, comprising the steps of: According to the pixel position, the encryption key is encrypted For a gray image Transform each row of pixels, specifically: for the first Row of pixels, if No operation is performed, if The position of the pixel is exchanged with The pixel of the row According to the pixel position, the encryption key is encrypted For a gray image Transform each column of pixels, specifically: for the first Column of pixels, if No operation is performed, if The position of the column of pixels is exchanged with The column of pixels The encrypted image is then sent to the cloud server by the query request with the feature vector.
5. The method of claim 1, wherein the quantum homomorphic K- nearest neighbor algorithm-based encrypted image search method is characterized by, Step S5 is specifically: The similarity obtained in step S4 is encoded into a quantum state, and the total quantum state is represented by the following formula: wherein, is the total number of database images; is the similarity between the image to be queried and the i-th database image; is the similarity between the image to be queried and the i-th database image; The cloud server extracts the database image as a search object set based on the Grover algorithm, queries K images with the highest similarity, and returns them to the user, wherein the query process comprises the following steps: randomly selecting one similarity ground state from the search object set as a threshold value; All the states with values greater than are searched using Grover's algorithm. If the search result is not empty, a ground state is randomly selected as a threshold in the search result, and the above step is repeated; if the search result is empty, the final threshold is output and deleted in the search object set; The above steps are repeated K times to obtain K database images with the highest similarity as output results, and the output results are sent to the user.
6. The method of claim 1, wherein the quantum homomorphic K- nearest neighbor algorithm-based encrypted image search method is characterized by, Step S6 is specifically: the user receives the encrypted image decrypts the encrypted image The angle parameter vector of the encrypted image is Decrypt the pixel value and the pixel position respectively, including the following steps: The pixel value is decrypted using the pixel value encryption key used in step S1, and the decrypted angle parameter is calculated The pixel value at the position is calculated as ; The pixel position is decrypted using the pixel position encryption key used in step S1, comprising the following steps: Based on the pixel location encryption key Encrypted images The pixels in each row are transformed, specifically: for the first row... row pixels, if If no action is taken, then no action will be taken. Then and The positions of the row pixels are swapped; According to the pixel position, the encryption key is encrypted The encrypted image is decrypted Transforming each column of pixels, specifically: for the first column of pixels, if , no operation is performed, if , the position of the pixel is exchanged with the pixel in the second column; Finally, the decrypted image search result is obtained, and the encrypted image search is completed.
Citation Information
Patent Citations
Image classification method based on quantum nearest-neighbor algorithm
CN106650808A
Privacy-protected encrypted image retrieval method and system
CN112528064A