Histogram of oriented gradient feature extraction method for cloud encrypted image
Through secret sharing and homomorphic encryption technology, image data is divided into cipher text shares for gradient histogram feature extraction, which solves the risk of data leakage in traditional methods, realizes security feature extraction of cloud-encrypted images, and improves computing efficiency and privacy protection.
Patent Information
- Application Number
- CN202510381050.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-26
- Publication Date
- 2025-07-22
AI Technical Summary
The existing direction gradient histogram feature extraction method relies on plaintext image data calculation, poses a risk of data leakage and is difficult to perform efficiently in the encryption domain.
Secret sharing and homomorphic encryption technology are used to divide the image data into two ciphertext shares and stored on independent cloud servers respectively. Through gradient calculation and feature extraction under the encryption domain, the encryption direction gradient histogram features are constructed.
It realizes the extraction of direction gradient histogram feature without decrypting the original image data, improving data security and privacy protection capabilities, and is suitable for large-scale cloud image processing.
Smart Images

Figure CN120358017A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of information security technology, and in particular, to a method for extracting Histogram of Oriented Gradients (HOG) features of encrypted images in the cloud. Background Art
[0002] With the rapid development of computer vision technology, pattern recognition methods based on image feature extraction are widely used in fields such as object detection, image classification, and behavior recognition. Among them, Histogram of Oriented Gradients (HOG) is a classic image feature extraction method, which is particularly suitable for object detection tasks, such as face recognition, vehicle recognition, and behavior analysis. The HOG feature extraction method mainly constructs a stable and robust image feature descriptor by calculating the gradient information of the image and classifying the gradient directions into histograms of different angles.
[0003] However, traditional HOG feature extraction methods mainly calculate based on plaintext image data, that is, the original pixel values need to be directly accessed during the processing. This processing method has great security risks in many scenarios involving sensitive information. For example: in medical image analysis, patients' medical images (such as X-ray films, CT scans, MRI images) usually contain highly sensitive privacy information. If HOG feature extraction is directly performed without encryption, it may lead to the risk of data leakage; in face recognition and identity verification applications, image data may involve users' biometric information, and unencrypted data may be misused or stolen, resulting in serious privacy leakage; in remote monitoring and security detection scenarios, a large amount of monitoring data captured by cameras may involve sensitive information of private places. If feature extraction and analysis are directly performed, it may violate privacy protection regulations (such as GDPR, CCPA, etc.).
[0004] To address the above problems, some attempts have been made in the academic community to combine homomorphic encryption with image feature extraction technology. However, existing HOG feature extraction methods rely on Sobel operators or similar filters to calculate image gradients, and these methods usually execute in the plaintext domain. In the encrypted domain, since pixel values cannot be directly accessed, traditional gradient calculation methods are difficult to directly apply. At the same time, the calculation of HOG features requires classifying the gradient directions and performing weighted accumulation according to the gradient magnitudes. However, homomorphic encryption does not support direct conditional judgment and index access, making it difficult for existing methods to execute efficiently in the ciphertext domain. Summary of the Invention
[0005] Aiming at the problems existing in the prior art, the present invention provides a method for extracting histogram of oriented gradients (HOG) features for encrypted images in the cloud, aiming to complete the extraction of HOG features without decrypting the original image data, thereby enhancing the data security and privacy protection capabilities of computer vision tasks.
[0006] The technical solution of the present invention is realized as follows:
[0007] A method for extracting histogram of oriented gradients (HOG) features for encrypted images in the cloud, comprising the following steps:
[0008] Step 1, System initialization: The data owner generates a public modulus sk for additive secret sharing; the data owner invites two independent cloud servers, the first cloud server s1 and the second cloud server s2;
[0009] Step 2, Image conversion to grayscale: The original image is an RGB three-channel image, and the number of pixels in height and width are n and m respectively. The data owner performs grayscale conversion on each pixel of the original image, and the grayscale value is calculated according to the weighted sum of the RGB channels, that is:
[0010] I(x, y) = 0.2989×R(x, y) + 0.587×G(x, y) + 0.114×B(x, y);
[0011] where, I(x, y) is the grayscale value, and R(x,y), G(x, y), B(x,y) are the pixel values of the image on the RGB channels respectively;
[0012] Step 3, Grayscale image normalization: Calculate the minimum value I min and the maximum value I max of the grayscale values of all pixels, perform normalization processing on the grayscale value of each pixel and return a two-dimensional array;
[0013] Step 4, Image encryption: The data owner performs an encryption operation on each pixel of the normalized grayscale image using the encryption function ε to obtain an encryption pair (img 1 , img 2 ), which are the first ciphertext img 1 and the second ciphertext img 2 respectively. The data owner sends img 1 and img 2 as the encrypted images to the first cloud server s1 and the second cloud server s2 respectively;
[0014] Step 5, Encrypted image gradient calculation: The first cloud server s1 and the second cloud server s2 respectively hold the encrypted image shares img 1and img 2 For each pixel (x, y), calculate the gradient direction using the encrypted gradient value
[0015] where G x,enc (x, y) is the horizontal direction gradient value calculated in the encrypted domain, and G y,enc (x, y) is the vertical direction gradient value calculated in the encrypted domain.
[0016] Then, calculate the gradient magnitude
[0017] Step 6: Calculate the histogram of oriented gradients feature in the encrypted domain: Set the size of the unit cell to C×C pixels, and each cell contains C 2 pixel points. In the cell, perform encrypted angle binning on the gradient direction θ enc (x, y) of each pixel to obtain the encrypted histogram of oriented gradients;
[0018] Step 7: Normalize the encrypted histogram of oriented gradients feature: Perform norm normalization on the histogram obtained in Step 6 to obtain the final encrypted histogram of oriented gradients feature value;
[0019] As a further optimization of the above solution, the secret - shared public modulus sk needs to meet the following conditions: The value of sk should be greater than or equal to the maximum value den of the denominator after the fractional - form conversion of the data to be calculated max and the maximum value between the minimum value den min +sk.
[0020] As a further optimization of the above solution, the floating - point number x to be calculated is divided into an integer - fraction form to obtain where num is the numerator after x is converted to a fractional form, and den is the denominator after x is converted to a fractional form. In the segmentation process, the converted numerator and denominator are segmented in the number domain. If the current numerator num or denominator den is less than 0, add N to the original value to obtain the converted value after number - domain segmentation, otherwise keep it as the original value.
[0021] As a further optimization, converting the floating - point number to an integer - fraction form is to divide the encrypted number domain into representing the region where the original data is positive, representing the region where the original data is negative.
[0022] As a further optimization, in Step 4, the encryption function ε of the secret sharing is expressed as: when img≥0, ε(sk, img)→(img 1 , img 2);When img < 0, ε(sk, img + sk) → (img 1 , img 2 ).
[0023] Convert the number after number field division into the form of the sum of two numbers, that is:
[0024] num = ([num] 1 + num] 2 ) mod sk, den = ([den] 1 + [den] 2 ) mod sk;
[0025] Therefore, construct the number pairs <[num] 1 , [den] 1 > and <[num] 2 , [den] 2 >;
[0026] where img 1 = <[num] 1 , [den] 1 , img 2 = <[num] 2 , [den] 2 .
[0027] As a further optimization of the above solution, it also includes a decryption function D for restoring the first ciphertext and the second ciphertext to the pixel value img, that is:
[0028]
[0029] As a further optimization of the above solution, in step 5, the formulas for calculating the horizontal and vertical direction gradient values are as follows:
[0030] G x,enc (x, y) = (-1)·I x-1,y-1 + (1)·I x-1,y+1 + (-2)·I x,y-1 + (2)·I x,y+1 + (-1)·I x+1,y-1 + (1)·I x+1,y+1 .
[0031] G y,enc (x,y) = (-1)·I x-1,y-1 + (-2)·I x-1,y + (-1)·I x-1,y+1 + (1)·I x+1,y-1 + (2)·I x+1,y + (1)·I x+1,y+1
[0032] As a further optimization of the above solution, in step 6, the bucketing steps are as follows:
[0033] Step 61: Set N bucketing directions, and each bucket represents an angular interval
[0034] Step 62: Determine the bucket index i in the encrypted domain, that is, find the one that satisfies Adopt encrypted comparison operation Where Represents the gradient direction θ enc (x, y) belongs to the i-th bucket;
[0035] Step 63: Calculate the encrypted direction gradient histogram M in the i-th bucket enc Accumulate the gradient magnitude, and the calculation formula is: Where, Represents the accumulated gradient magnitude of the i-th direction bucket in the cell.
[0036] As a further optimization of the above solution, in step 7, multiple cells (for example, 2×2 cells) are combined into a Block, and the normalization factor under the Block range is calculated: Where ε is a regularization term to prevent division by zero.
[0037] Compared with the prior art, the present invention has the following beneficial effects:
[0038] (1) The present invention proposes a method for extracting the histogram of oriented gradients features of encrypted images in the cloud. By encrypting the image into two ciphertext shares, it ensures the privacy of image data during the cloud storage process and solves the risk problem of privacy leakage in cloud storage in traditional methods.
[0039] (2) By adopting the gradient calculation in the encrypted domain and the technology of extracting the histogram of oriented gradients features of encrypted images, it realizes the extraction of the histogram of oriented gradients features of encrypted images, thus avoiding the leakage of plaintext data. At the same time, it can also effectively perform the encryption process of images, enhancing the security of data.
[0040] (3) Combining the parallel computing ability and distributed storage characteristics of the cloud computing platform, the present invention can efficiently process large-scale image data, significantly improving the efficiency of feature extraction and calculation, while maintaining the requirements of privacy protection, and is applicable to large-scale cloud image processing. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] Figure 1 It is the working principle diagram of a method for extracting the histogram of oriented gradients features of encrypted images in the cloud provided by the embodiment of the present invention;
[0042] Figure 2 It is an interaction diagram of a method for extracting histogram of oriented gradients features for encrypted images in the cloud provided by an embodiment of the present invention. Detailed implementation manners
[0043] In order to make the objectives, technical solutions and advantages of the present invention clearer and more understandable, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without making creative efforts belong to the scope of protection of the present invention.
[0044] As Figure 1 、 Figure 2 shown, this embodiment provides a method for extracting histogram of oriented gradients features for encrypted images in the cloud, including the following steps:
[0045] Step 1, system initialization; the data holder generates a public modulus sk = 15648751645854321 for secret sharing; the data holder recruits two uncorrelated first cloud servers s1 and second cloud servers s2 and sends the modulus sk to all cloud servers; cloud servers have powerful computing capabilities and can store encrypted data;
[0046] Step 2, image conversion to grayscale: the original image is an RGB three-channel image, and the number of pixels in height and width are n and m respectively. The data holder performs grayscale conversion on each pixel of the original image, and the grayscale value is calculated according to the weighted sum of the RGB channels, that is:
[0047] I(x, y) = 0.2989×R(x, y)+0.587×G(x, y)+0.114×B(x, y);
[0048] where, I(x,y) is the grayscale value, and R(x,y), G(x,y), B(x,y) are the pixel values of the image on the RGB channels respectively;
[0049] Taking the RED channel of a 3*3 RGB three-channel image as an example, the corresponding pixels are:
[0050] [[229, 184, 164], [58, 75, 128], [180, 126, 129]];
[0051] Then the corresponding pixels after grayscale conversion are:
[0052] [[221.8701, 176.8746, 156.8766], [50.8872, 67.8855, 120.8802], [172.8750, 118.8804, 121.8801]];
[0053] Step 3, Grayscale image normalization: Calculate the minimum value I min and the maximum value I max of the grayscale values of all pixels, and perform normalization processing on the grayscale value of each pixel, that is:
[0054]
[0055] And return a two-dimensional array:
[0056] [[O.977273, 0.721591, 0.607955], [0.005682, 0.102273, 0.403409], [0.698864, 0.392045, 0.409091]];
[0057] Step 4, Image encryption: The data holder performs an encryption operation on each pixel of the normalized grayscale image using the encryption function ε to obtain an encryption pair (img 1 , img 2 ), which are the first ciphertext img 1 and the second ciphertext img 2 . The data owner sends img 1 and img 2 as the encrypted images to the first cloud server s1 and the second cloud server s2 respectively; the form of the encryption function is: ε(sk,img)→(img 1 , img 2 );
[0058] Then the first ciphertext img 1 and the second ciphertext img 2 obtained after splitting are respectively:
[0059] img 1 = [[0.738078, 0.525946, 0.395206], [0.002739, 0.017198, 0.129083], [0.424177, 0.193492, 0.286235]];
[0060] img 2= [[0.239195, 0.195645, 0.212749], [0.002943, 0.085075, 0.274326], [0.274687, 0.198553, 0.122855]];
[0061] Step 5, Encrypted Image Gradient Calculation: The first cloud server s1 and the second cloud server s2 respectively hold encrypted image shares img 1 and img 2 , and for each pixel (x, y), calculate the gradient direction using the encrypted gradient value
[0062] where, G x,enc (x, y) is the horizontal direction gradient value calculated in the encrypted domain, and G y,enc (x, y) is the vertical direction gradient value calculated in the encrypted domain.
[0063] Then the calculated:
[0064] G x = [-0.698864, -0.727273, -0.039773, -0.363636, 0.136364, 0.494318, -0.818182, -0.420455, 0.392045];
[0065] G y = [-3.585227, -2.443182, -1.255682, -1.193182, -1.136364, -0.926136, 2.313367, 1.245185, 0.375867];
[0066] θ = [5.130081, 3.359375, 31.571429, 3.281250, -8.333333, -1.873563, -2.827448, -2.961520, 0.958732];
[0067] Then, calculate the gradient magnitude M = [3.652707, 2.549130, 1.256312, 1.247363, 1.144516, 1.049800, 2.453790, 1.314255, 0.543116];
[0068] Step 6, Calculate the Histogram of Oriented Gradients Feature in the Encrypted Domain: Set the size of the unit cell to C×C 像 pixels, and each cell contains C 2pixel points, and perform encrypted angle binning on the gradient direction θ of each pixel in the cell to obtain the encrypted histogram of oriented gradients; enc (x, y)
[0069] Step 7, normalization of the encrypted histogram of oriented gradients: Perform norm normalization on the histogram obtained in Step 6 to obtain the final encrypted histogram of oriented gradients feature value [0.0, 0.0, 0.0, 0.9884017469932843, 0.0, 0.0, 0.0, 0.0, 0.15186086121634265];
[0070] According to the disclosure and teachings of the above specification, those skilled in the art to which the present invention pertains can also make changes and modifications to the above embodiments. Therefore, the present invention is not limited to the specific embodiments disclosed and described above, and some modifications and changes to the present invention should also fall within the protection scope of the claims of the present invention. In addition, although some specific terms are used in this specification, these terms are only for convenience of description and do not constitute any limitation to the present invention.
Claims
1. A method for extracting histogram of oriented gradients features for encrypted images in the cloud, characterized in that, Including the following steps: Step 1, System initialization: The data holder generates a public modulus sk for secret sharing; the data holder recruits two uncorrelated first cloud servers s1 and second cloud servers s2 and sends the modulus sk to all cloud servers; Step 2, Image conversion to grayscale image: The original image is an RGB three-channel image, and the number of pixels in height and width are n and m respectively. The data holder performs grayscale conversion on each pixel of the original image, and the grayscale value is calculated according to the weighted sum of the RGB channels, that is: I(x,y) = 0.2989×R(x,y)+0.587×G(x,y)+0.114×B(x,y); where, I(x,y) is the grayscale value, and R(x,y), G(x,y), B(x,y) are the pixel values of the image on the RGB channels respectively; Step 3, grayscale image normalization: Calculate the minimum value I min and the maximum value I max of the grayscale values of all pixels, and perform normalization processing on the grayscale value of each pixel, that is: and returns a two-dimensional array; Step 4, Image Encryption: The data holder encrypts each pixel of the normalized grayscale image using the encryption function ε to obtain the encryption pair (img 1 , img 2 ), which are the first ciphertext img 1 and the second ciphertext img 2 . The data owner sends img 1 and img 2 as the encrypted images to the first cloud server s1 and the second cloud server s2 respectively; the form of the encryption function is: ε(sk,img)→(img 1 , img 2 ); Step 5, Encrypted Image Gradient Calculation: The first cloud server s1 and the second cloud server s2 respectively hold encrypted image shares img 1 and img 2 , and for each pixel (x, y), calculate the gradient direction using the encrypted gradient value Among them, G x,enc (x, y) is the horizontal direction gradient value calculated in the encrypted domain, and G y,enc (x, y) is the vertical direction gradient value calculated in the encrypted domain. Then, calculate the gradient magnitude Step 6, Calculate the Histogram of Oriented Gradients (HOG) features in the encrypted domain: Set the size of each cell to C×C pixels, and each cell contains C 2 pixel points. For each pixel with gradient direction θ enc (x,y) within the cell, perform encrypted angle binning to obtain the encrypted Histogram of Oriented Gradients; Step 7, Encrypted histogram of oriented gradients feature normalization: Perform norm normalization on the histogram obtained in Step 6 to obtain the final encrypted histogram of oriented gradients feature value.
2. The method for extracting the histogram of oriented gradients features of an encrypted image in the cloud according to claim 1, wherein The publicly-shared secret modulus sk needs to satisfy the following conditions: the value of sk should be greater than or equal to the maximum value den of the denominators after the fractional form conversion of the data to be calculated max and the minimum value den min plus the maximum value of the two of sk.
3. A histogram of oriented gradients feature extraction method for cloud-encrypted images according to claim 2, characterized in that, The floating-point number x to be calculated is divided into an integer-fraction form to obtain where num is the numerator of x converted to a fractional form, and den is the denominator of x converted to a fractional form. In the division process, the converted numerator and denominator are divided in the number domain. If the current numerator num or denominator den is less than 0, the converted value after the number domain division is obtained by adding N to the original value; otherwise, it remains the original value.
4. A histogram of oriented gradients feature extraction method for cloud-encrypted images according to claim 3, characterized in that The process of converting a floating-point number to an integer fraction form is to divide the encrypted number field into regions starting from which represents the region where the original data is positive, and which represents the region where the original data is negative.
5. A method for extracting histogram of oriented gradients features of encrypted images in the cloud according to claim 1, characterized in that, In step 4, the encryption function ε of the secret sharing is expressed as: when img ≥ 0, ε(sk, img) → (img 1 , img 2 ); when img < 0, ε(sk, img + sk) → (img 1 , img 2 ). Convert the number after number field segmentation into the form of the sum of two numbers, that is: num = ([num] 1 + num] 2 ) mod sk, den = ([den] 1 + [den] 2 ) mod sk; Therefore, construct pairs <[num] 1 , [den] 1 > and <[num] 2 , [den] 2 >; where img 1 =<[num] 1 , [den] 1 >, img 2 =<[num] 2 , [den] 2 >.
6. The method for extracting histogram of oriented gradients features for cloud-encrypted images according to claim 5, wherein It also includes a decryption function D, which is used to restore the first ciphertext and the second ciphertext to the pixel value img, that is:
7. A method for extracting histogram of oriented gradients features of encrypted images in the cloud according to claim 1, characterized in that, In Step 5, the formulas for calculating the horizontal and vertical direction gradient values are as follows:
8. A histogram of oriented gradients feature extraction method for cloud-encrypted images according to claim 5, characterized in that In Step 6, the bucketing steps are as follows: Step 61, Set N bucketing directions, and each bucket represents an angular interval Step 62: Determine the bin index i in the encrypted domain, that is, find the one that satisfies using encrypted comparison operations where represents the gradient direction θ enc (x, y) belongs to the i-th bin; Step 63, calculate the encrypted oriented gradient histogram M in the i-th bin enc Accumulate the gradient magnitude, and the calculation formula is: Among them, represents the cumulative gradient magnitude of the i-th direction bin within the cell.
9. A method for extracting histogram of oriented gradients features of encrypted images in the cloud according to claim 1, characterized in that, In Step 7, combine multiple cells (such as 2×2 cells) into a Block, and calculate the normalization factor within the range of the Block: where ε is a regularization term to prevent division by zero.