Previewable face image encryption method and device

The face area is encrypted through image bit plane scrambling technology, which solves the problem that the existing technology cannot simultaneously protect face privacy and maintain encryption visibility, and achieves high security privacy protection and image visibility, and also has reversible decryption function.

CN120050371AInactive Publication Date: 2025-05-27NANJING UNIV OF INFORMATION SCI & TECH
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202510527517.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-25
Publication Date
2025-05-27
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The prior art cannot simultaneously protect face privacy and encryption visibility when facing machine learning, and traditional encryption solutions reduce the usability of encrypted images.

Method used

The image bit plane scrambling technology is used to encrypt the face area images. By extracting gradient features and texture features, a fusion feature vector is generated, combining sliding windows and multi-scale scaling, the encrypted area range is adjusted, and the bit plane is scrambling operations are performed to generate ciphertext images.

Benefits of technology

While protecting face privacy, it maintains encrypted image visibility, improves privacy protection security, increases the difficulty of machine learning recognition, and designs a reversible decryption process to ensure that the image can be restored to its original state when needed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120050371A_ABST
    Figure CN120050371A_ABST
Patent Text Reader

Abstract

The invention discloses a previewable face image encryption method and device, and belongs to the technical field of image processing and information security, and the method comprises the steps: extracting a gradient feature and a texture feature of a face region in an image, and generating a fusion feature vector; traversing the image through a sliding window in combination with multi-scale zooming, and classifying and detecting the fusion feature vector in the window by using a classification model to obtain a face frame coordinate; adjusting the range of the encryption region, and dividing the image into a plurality of sub-blocks; splitting the bit plane of each pixel in the target sub-block, and performing scrambling operation on the bit plane; reconstructing the scrambled pixel values, and adjusting the sum of the pixel values in the sub-blocks to be consistent with the sum before encryption to generate a ciphertext image; detecting an encryption area in the ciphertext image, executing an inverse permutation operation on an encryption block in the encryption area, restoring an original bit plane, and generating a decrypted plaintext image; according to the invention, identification of illegal third parties and machines can be resisted while visibility of the face after encryption is maintained.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to a method and device for encrypting a face image that can be previewed, and belongs to the technical field of image processing and information security. Background Art

[0002] As the number of personal images increases, cloud services play an increasingly critical role in image storage. However, uploading images containing faces to the cloud will face serious privacy risks, especially at a time when face recognition technology is widely used. Traditional encryption schemes encrypt images into snowflake-shaped images, completely erasing the privacy information of the image. Although it can protect privacy, users cannot recognize images without decrypting them, which reduces the usability of encrypted images. In recent years, thumbnail-preserving encryption technology has entered the public eye. After encrypting images containing privacy information, it can maintain the image thumbnail unchanged, so that images stored in the cloud will not be easily recognized by illegal third parties with the naked eye, and can meet users' needs for image visibility to a certain extent. However, the existing TPE (thumbnail preservation encryption) scheme has not fully considered the privacy threats brought by machine learning technology in the process of processing face images. Summary of the invention

[0003] The purpose of the present invention is to overcome the deficiencies in the prior art and provide a previewable facial image encryption method and device that can resist recognition by illegal third parties and machines while maintaining the visibility of the face after encryption.

[0004] To achieve the above object, the present invention is implemented by adopting the following technical solutions: In a first aspect, the present invention provides a method for encrypting a face image that can be previewed, comprising: Get the input image, extract the gradient features and texture features of the face area in the image, and generate a fusion feature vector; The image is traversed through a sliding window combined with multi-scale zooming, and the fused feature vectors in the window are classified and detected using a classification model to obtain the coordinates of the face frame; Adjust the encryption area range according to the face frame coordinates and divide the image into multiple sub-blocks; The bit plane of each pixel in the target sub-block is split, and the bit plane is scrambled by a permutation function to obtain the pixel value of each sub-block after scrambling; Reconstruct the scrambled pixel values ​​and adjust the sum of the pixel values ​​in the sub-block to be consistent with that before encryption to generate a ciphertext image; The encrypted area in the ciphertext image is detected, the inverse permutation operation is performed on the encrypted blocks in the encrypted area, the original bit plane is restored, and the decrypted plaintext image is generated.

[0005] Furthermore, the step of extracting gradient features of a face region in an image includes: Divide the image into 8×8 cells and calculate the gradient direction histogram of each cell; Based on the histogram, adjacent 2×2 cells are grouped into blocks and L2 norm normalization is performed; The normalized features of all blocks are connected to form the HOG feature vector of the entire image as the gradient feature of the face area.

[0006] Furthermore, the texture features of the face area in the image are extracted, including: Calculate the difference between the central pixel of the image and the neighboring pixels to generate the LBP value; The frequency distribution of LBP values ​​in each area of ​​the image is statistically analyzed to form an LBP feature vector as the texture feature of the face area.

[0007] Furthermore, the method of using the classification model to classify and detect the fused feature vector in the window to obtain the face frame coordinates includes: Use the trained SVM classifier to classify the fused feature vector in the window and detect the face area; The overlapping detection windows are removed by non-maximum suppression to determine the final face frame coordinates.

[0008] Furthermore, removing overlapping detection windows by non-maximum suppression to determine the final face frame coordinates includes: Calculate the intersection over union (IoU) of the detection windows. If the IoU exceeds the preset threshold, remove the overlapping windows and retain the window coordinates whose IoU is lower than the threshold.

[0009] Furthermore, adjusting the encrypted area range according to the face frame coordinates includes: According to the coordinates of the upper left corner of the detected face frame and the lower right corner coordinates , determine the encryption sub-block range according to the following formula: ; ; ; ; in, is the side length of the partition block, is the upper left corner horizontal coordinate of the encrypted sub-block, is the upper left corner ordinate of the encrypted sub-block, is the lower right corner horizontal coordinate of the encrypted sub-block, is the lower right corner ordinate of the encrypted sub-block.

[0010] Furthermore, the method for adjusting the sum of pixel values ​​in the sub-block is specifically as follows: If the sum of the pixel values ​​in the sub-block after encryption is inconsistent with that before encryption, the pixel with the largest or smallest grayscale value is selected for adjustment to ensure that the sum of the pixel values ​​in the sub-block after adjustment is consistent with that before encryption.

[0011] Furthermore, the detecting of the encrypted area in the ciphertext image includes: The ciphertext image is divided into a 4×4 matrix, and the L1 norm of the adjacent pixel difference matrix is ​​calculated. If the norm exceeds the preset threshold, it is determined to be an encrypted area.

[0012] Furthermore, the permutation function is a reversible permutation, and its inverse permutation is used to restore the original bit plane during the decryption process.

[0013] In a second aspect, the present invention provides a face image encryption device capable of previewing, comprising: Memory, for storing computer programs / instructions; A processor is used to execute the computer program / instructions to implement the steps of any of the aforementioned methods.

[0014] Compared with the prior art, the present invention has the following beneficial effects: 1. Improve privacy protection security: The existing technology cannot simultaneously protect face privacy and encrypt visibility when facing machine learning. The present invention encrypts the face area image based on the image bit plane scrambling technology. During the encryption process, the bit plane scrambling operation disrupts the pixel information of the image, making it difficult for illegal third parties to identify the image content with the naked eye, while increasing the difficulty of machine learning recognition, greatly improving the privacy security of face images in scenarios such as cloud storage.

[0015] 2. Ensure image visibility: Traditional encryption schemes encrypt images into snowflakes, completely erasing image privacy information, resulting in users being unable to recognize images without decryption, which reduces usability. During the encryption process, the present invention ensures that the thumbnail of the ciphertext image is consistent with the plaintext image through operations such as regional correction. While protecting privacy, it meets the user's demand for image visibility. Users can have a general understanding of the image content through thumbnails, improving the practicality of encrypted images.

[0016] 3. Reversibility: The present invention designs a complete decryption process. During decryption, the original image can be accurately restored by detecting the encrypted area, performing bit plane division, inverse scrambling and reconstruction on the encrypted block. This reversibility ensures that the image can be restored to its original state when needed, without affecting the normal use of the image, and provides reliable protection for the storage and transmission of the image. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] Figure 1 is a flowchart of a method for encrypting a face image that can be previewed provided by an embodiment of the present invention; Figure 2 is a flow chart of a face detection algorithm provided by an embodiment of the present invention; Figure 3 It is a flow chart of the image bit plane scrambling splitting encryption method provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0018] The present invention will be further described below in conjunction with the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solution of the present invention, and cannot be used to limit the protection scope of the present invention.

[0019] Embodiment 1: This embodiment introduces a method for encrypting a face image that can be previewed, including: Get the input image, extract the gradient features and texture features of the face area in the image, and generate a fusion feature vector; The image is traversed through a sliding window combined with multi-scale zooming, and the fused feature vectors in the window are classified and detected using a classification model to obtain the coordinates of the face frame; Adjust the encryption area range according to the face frame coordinates and divide the image into multiple sub-blocks; The bit plane of each pixel in the target sub-block is split, and the bit plane is scrambled by a permutation function to obtain the pixel value of each sub-block after scrambling; Reconstruct the scrambled pixel values ​​and adjust the sum of the pixel values ​​in the sub-block to be consistent with that before encryption to generate a ciphertext image.

[0020] The application process of the previewable face image encryption method provided in this embodiment specifically involves the following steps: 1. The first is face detection, including: (1) The first step is to preprocess the image; Convert a color image to a grayscale image. ,in represents pixel coordinates, Represents the number of channels of RGB three channels, grayscale image The calculation formula is: ; (2) The second step is to calculate the gradient; Use Sobel operator to calculate the image in and Gradient in direction and : ; ; in Represents a convolution operation.

[0021] The size of the gradient and direction The calculation formula is: ; .

[0022] (3) The third step is to construct HOG (Histogram of Oriented Gradients) features; Cell division and histogram calculation: Divide the image into cells of size For each pixel in the cell , i represents the row index of the pixel in the image, and j represents the column index of the pixel in the image.

[0023] According to its gradient direction Quantized to 9 binary formats of gradient directions, bin format is a binary format, usually used to store trained model weights and their structural information. For the value of the kth bin The calculation formula is: ; in Indicates that the angle Mapped to the corresponding bin format number, is the Kronecker function, which is 1 if the condition is met and 0 otherwise.

[0024] Block division and normalization: adjacent Cells form a block. The cell features in each block are normalized by L2 norm: ; in is a very small positive number. , which is used to prevent the denominator from being 0. express The normalized value, Indicates the total number of bins.

[0025] Generate HOG feature vector: Connect the normalized features of all blocks to form the HOG feature vector of the entire image .

[0026] (4) The fourth step is to calculate the local binary pattern LBP feature; Let the center pixel value be , Represents the center, and its neighborhood pixel value is , Represents the number of neighborhood pixels around the central pixel. The LBP value is calculated as follows: ; in ; Represents a sign function that is used to determine the encoding of the grayscale difference between the area pixel and the center pixel.

[0027] The image is divided into regions of the same size as when the HOG feature was extracted, and the frequency of occurrence of different LBP values ​​in each region is counted to form the LBP feature vector of the region. The LBP feature vectors of all regions are connected to obtain the LBP feature vector of the entire image. .

[0028] (5) Feature fusion; The HOG feature vector and LBP feature vector Connect them to get the fused feature vector .

[0029] (6) Sliding window and multi-scale detection; Sliding window: Use a window size of The sliding window traverses the image. Indicates the length of the window, Represents the height of the window, and the step size of each slide is For each window position , extract the fusion feature vector of the image in the window .

[0030] Multi-scale detection: In order to detect faces of different sizes, the image needs to be scaled to different scales. Let the scaling factor be , scale the image multiple times, and repeat the above sliding window operation after each scaling.

[0031] (7) Classification using SVM (support vector machine) model; For each window, the fused feature vector , use the trained SVM model for classification. The decision function of the SVM model is: ; in is the weight vector of the SVM model, Represents the weight vector The transpose of is the bias term, is a sign function; when hour, , indicating that a face is detected; when hour, , indicating that no face was detected.

[0032] (8) Determine the coordinates of the face frame; When a window is determined by the SVM model to contain a face, the coordinates of the upper left corner of the window are recorded. and the lower right corner coordinates Since there may be multiple overlapping detection windows marked as faces, a non-maximum suppression (NMS) operation is required to remove windows with high overlap.

[0033] Assume there are two detection windows and ,in It is a window The horizontal and vertical coordinates of the upper left corner, It is a window The horizontal and vertical coordinates of the lower right corner, It is a window The horizontal and vertical coordinates of the upper left corner, It is a window The horizontal and vertical coordinates in the lower right corner, their overlap (intersection over union, IoU) calculation formula is: ; in: ; ; ; ; By setting the IoU threshold to 0.5, windows with overlap higher than the threshold are removed, and the window coordinates that are finally retained are The detected face frame coordinates.

[0034] 2. Perform bit plane scrambling encryption on the processed plaintext image of the demarcated face area, including: (1) The first step is to divide the blocks; The plaintext image is resized to Divide, Represents the side length of the partition block, and the plaintext image ,That The block is represented as ,in is the number of channels.

[0035] (2) The second step is regional correction; Directly encrypting the detection area will cause the thumbnail of the ciphertext image to be different from the plaintext image, so the detection area needs to be fine-tuned.

[0036] Detected facial area coordinates (upper left corner) and (lower right corner); Adjust to region block coordinates: ; ; ; ; in, is the upper left corner horizontal coordinate of the encrypted sub-block, is the upper left corner ordinate of the encrypted sub-block, is the lower right corner horizontal coordinate of the encrypted sub-block, is the lower right corner ordinate of the encrypted sub-block.

[0037] (3) The third step is to encrypt the region block; Image segmentation: For the original image , the width and height of the image are and . Divide the image into equal-sized sub-blocks , the width of the sub-block is , Gao Wei . sub-block The pixel set in is , , .

[0038] Determine the area block range: The input coordinates are known to be , determine the set of sub-blocks containing these coordinates. Let sub-block ,like and ,as well as and , then the sub-blocks where these coordinates are located are .

[0039] Bit plane partition scrambling: For the target sub-block Each pixel in , whose gray value is expressed in binary as ,in It is The bit value on each bit plane.

[0040] Sub-block Split by bit plane, we get No. bit plane ,in .

[0041] Let r be the first bit plane The permutation function for the scrambling operation is , the scrambled bit plane is .

[0042] Reconstruct the block pixels: After the bit plane is scrambled, the sub-block is reconstructed according to the new bit plane For the sub-block Each pixel in , its new gray value ,in yes The corresponding bit value in .

[0043] Ensure that the sum of pixel values ​​remains unchanged: Sub-block The pixel values ​​in the vector ( Represents a sub-block The number of pixels within It is the first The original grayscale value of pixels; the corresponding pixel values ​​after encryption form a vector ,in is the first The gray value of a pixel.

[0044] Calculate the encrypted sub-block The sum of the pixel values , encrypted sub-block The sum of the pixel values .like , set the difference .from Select one or more pixels to adjust (in order to minimize the damage to the bit plane scrambling effect, pixels with larger or smaller gray values ​​can be selected first). Suppose you select to adjust the pixels , the adjusted pixel value is (like )or (like ), while updating The value of the corresponding pixel in the sub-block is adjusted so that the sum of the pixel values ​​in the sub-block is , among which hour, ,when hour, .

[0045] Get the encrypted image: After performing the above bit plane splitting, scrambling, reconstruction and ensuring the sum of pixel values ​​remains unchanged on all sub-blocks containing the input coordinates, the encrypted image is obtained. .when When it belongs to a processed sub-block, take ( represents the image after pixel value and adjustment); when When it does not belong to the processed sub-block, .

[0046] 3. Decrypt the ciphertext image, including: (1) The first step is to detect the encrypted area; Suppose area z is represented by a matrix representing pixel values, whose size is : ; in It is the identifier of the pixel value in the ciphertext image partition matrix, indicating the pixel value size of the pixel position.

[0047] calculate : ; Compare and the size of the threshold, It means the sum of the absolute values ​​of each element of the adjacent pixel difference matrix after dividing the ciphertext image into a 4×4 matrix. express The matrix Line Column elements, express The size of the element value, if If the value is greater than the preset threshold, the block is determined to be an encrypted block; otherwise, it is an unencrypted block. The encrypted block coordinates are determined as .in It is the horizontal and vertical coordinates of the upper left corner of the encrypted block window. It is the horizontal and vertical coordinates in the lower right corner of the encryption block window.

[0048] (2) Decrypt the encrypted block; Image segmentation: For the encrypted image , the width and height of the image are and . Divide the image into equal-sized sub-blocks , the width of the sub-block is , Gao Wei . sub-block The pixel set in is , , .

[0049] Determine the area block range:

[0050] The input coordinates are known to be , determine the set of sub-blocks containing these coordinates. Let sub-block ,like and ,as well as and , then the sub-block It is the target sub-block that needs to be decrypted.

[0051] Bit plane partition inverse scrambling: For the target sub-block Each pixel in , whose gray value is expressed in binary as ,in It is The bit value on the bit plane. Split by bit plane, we get No. bit plane ,in .

[0052] Let r be the first bit plane The permutation function for the scrambling operation is , and its inverse permutation function is , for the encrypted bit plane Perform the inverse scrambling operation to obtain the original bit plane ,Right now .

[0053] Reconstruct the block pixels: According to the inverse scrambled bit plane Reconstruct sub-blocks For the sub-block Each pixel in , its original gray value ,in yes The corresponding bit value in .

[0054] Get the decrypted image: After performing the above-mentioned bit plane inverse scrambling and reconstruction operations on all target sub-blocks containing the decrypted area, the decrypted image is obtained. . Represents the encrypted image, and the coordinates in the encrypted image are represented as , and the coordinates of the decrypted image are expressed as ,when When it belongs to a processed sub-block, take is the original grayscale value obtained in the above steps; When it does not belong to the processed sub-block, .

[0055] This embodiment effectively solves the shortcomings of the existing technology in face image encryption through a series of technical means, and achieves results that are superior to the existing technology in many aspects:

[0056] 1. Improve privacy protection security: The existing technology cannot simultaneously protect face privacy and encrypt visibility when facing machine learning. The present invention encrypts the face area image based on the image bit plane scrambling technology. During the encryption process, the bit plane scrambling operation disrupts the pixel information of the image, making it difficult for illegal third parties to identify the image content with the naked eye, while increasing the difficulty of machine learning recognition, greatly improving the privacy security of face images in scenarios such as cloud storage.

[0057] 2. Ensure image visibility: Traditional encryption schemes encrypt images into snowflakes, completely erasing image privacy information, resulting in users being unable to recognize images without decryption, which reduces usability. During the encryption process, the present invention ensures that the thumbnail of the ciphertext image is consistent with the plaintext image through operations such as regional correction. While protecting privacy, it meets the user's demand for image visibility. Users can have a general understanding of the image content through thumbnails, improving the practicality of encrypted images.

[0058] 3. Reversibility: The present invention designs a complete decryption process. During decryption, the original image can be accurately restored by detecting the encrypted area, performing bit plane division, inverse scrambling and reconstruction on the encrypted block. This reversibility ensures that the image can be restored to its original state when needed, without affecting the normal use of the image, and provides reliable protection for the storage and transmission of the image.

[0059] The contents involved in the above embodiment are described below in conjunction with a preferred embodiment.

[0060] 1. Preparation stage; Equipment and tools: Choose a computer with a certain computing power, and configure it with a suitable processor (such as Intel Core i5 and above), memory (8GB and above), and storage (500GB and above). Install image processing related software libraries, such as the cross-platform computer vision library OpenCV (for image preprocessing, feature extraction, etc.) and the machine learning library Scikit-learn (for training and using support vector machine SVM classifiers).

[0061] 2. Collect sample data: Collect a large amount of image data containing human faces as training samples and test samples. The training samples are used to train the support vector machine (SVM) classifier so that it can accurately identify human faces in images; the test samples are used to verify the effectiveness of the encryption and decryption methods, including human face images with different resolutions, lighting conditions, expressions, and postures.

[0062] The specific process of the present invention is as follows Figure 1 , here are the implementation details: 3. Face detection; The face detection algorithm flow chart is as follows Figure 2 , the following is a specific implementation method: (1) Image preprocessing: After obtaining the color face image, according to the formula , convert it to a grayscale image.

[0063] (2) Calculate the gradient: Use the Sobel operator to calculate the grayscale image in and Gradient in direction and , which is implemented through convolution operation. Then according to the formula and Calculate the gradient magnitude and direction .

[0064] (3) Construct HOG features: Divide the image into For each pixel in each cell, according to its gradient direction Quantized into 9 bins, according to the formula Calculate the value of each bin. Next, put the adjacent Cells form a block, and the cell features in the block are normalized by L2 norm. Finally, the normalized features of all blocks are connected to form the HOG feature vector of the entire image .

[0065] (4) Calculate LBP features: Set the central pixel value and compare its neighboring pixel values ​​with it. According to the formula ;(in ) Calculate the LBP value. Divide the image into regions of the same size as when extracting HOG features, count the frequency of occurrence of different LBP values ​​in each region, connect the LBP feature vectors of all regions, and obtain the LBP feature vector of the entire image. .

[0066] (5) Feature fusion: HOG feature vector and LBP feature vector Connect the head and tail to get the fused feature vector .

[0067] Sliding window and multi-scale detection: using A sliding window of size is used to traverse the image row by row and column by column with a certain step size. Each time it slides to a new position, the fusion feature vector of the image in the window is extracted. To detect faces of different sizes, the scaling factor is set to 1.2, the image is scaled multiple times, and the sliding window operation is repeated after each scaling.

[0068] (6) Use SVM classification: Use the trained SVM model to classify the fusion feature vector of each window Input, according to the decision function If , determine that the window contains a face; if , it is determined that no face is detected.

[0069] (7) Determine the face frame coordinates: When the window is determined to contain a face, record the coordinates of its upper left corner and the lower right corner coordinates Since there are multiple overlapping detection windows marked as faces, the intersection over union (IoU) between the windows is calculated: ; in: ; ; ; ; The IoU threshold is set to 0.5. The windows with IoU higher than the threshold are filtered out and the window coordinates are finally retained. That is the detected face frame coordinates.

[0070] 4. Bit plane scrambling encryption; The bit plane scrambling encryption flow chart is as follows Figure 3 , the following is a specific implementation method: (1) Divide into blocks: The plaintext image is resized to Divide, Represents the side length of the partition block. Assume that the plaintext image is ,That The block is represented as ,in is the number of channels. Area correction: based on the coordinates of the upper left corner of the detected facial area and the lower right corner coordinates , according to the formula , , , , adjusted to the region block coordinates.

[0071] (2) Encrypt the region block: Divide the original image into multiple sub-blocks of equal size according to width and height, and determine the sub-block set containing the coordinates of the region block. For each pixel in the target sub-block, its grayscale value is represented in binary and split into 8 bit planes according to the bit plane. . Using the permutation function Perform a scrambling operation on each bit plane to obtain the scrambled bit plane Reconstruct the sub-block pixels based on the scrambled bit planes, and calculate the sum of the sub-block pixel values ​​before and after encryption. If the two are not equal, select the pixel with a larger or smaller grayscale value for adjustment to ensure that the sum of the pixel values ​​in the sub-block after adjustment is consistent with that before encryption. After processing all relevant sub-blocks, the ciphertext image is obtained.

[0072] 5. Decryption of ciphertext images; (1) Detect encrypted area: Use Matrix represents pixel values, calculate specific values And compare it with the preset threshold. If it is greater than the threshold, the block is determined to be an encrypted block and the coordinates of the encrypted block are determined. .

[0073] (2) Decrypt the encrypted block: Divide the encrypted image into multiple sub-blocks of equal size and determine the sub-block set containing the coordinates of the encrypted area. For each pixel in the target sub-block, represent its grayscale value in binary and split it by bit plane to obtain the encrypted bit plane. . Using the inverse permutation function Perform an inverse scrambling operation on the encrypted bit plane to obtain the original bit plane The sub-block pixels are reconstructed according to the inverse scrambled bit planes, and the decrypted image is obtained after processing all relevant sub-blocks.

[0074] Embodiment 2: This embodiment provides a face image encryption device capable of previewing, comprising: Memory, for storing computer programs / instructions; A processor, configured to execute the computer program / instructions to implement the steps of any one of the methods described in Example 1.

[0075] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the technical principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.

[0076] It should be understood by those skilled in the art that the embodiments of the present disclosure may be provided as methods, systems or computer program products. Therefore, the present disclosure may take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware aspects. Moreover, the present disclosure may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

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

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

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

[0080] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present disclosure rather than to limit its protection scope. Although the present disclosure has been described in detail with reference to the above embodiments, ordinary technicians in the relevant field should understand that after reading the present disclosure, those skilled in the art can still make various changes, modifications or equivalent substitutions to the specific implementation methods of the invention, but these changes, modifications or equivalent substitutions are all within the protection scope of the disclosed claims to be approved.

Claims

1. A method for encrypting a face image that can be previewed, characterized in that: include: Get the input image, extract the gradient features and texture features of the face area in the image, and generate a fusion feature vector; The image is traversed through a sliding window combined with multi-scale zooming, and the fused feature vectors in the window are classified and detected using a classification model to obtain the coordinates of the face frame; Adjust the encryption area range according to the face frame coordinates and divide the image into multiple sub-blocks; The bit plane of each pixel in the target sub-block is split, and the bit plane is scrambled by a permutation function to obtain the pixel value of each sub-block after scrambling; Reconstruct the scrambled pixel values ​​and adjust the sum of the pixel values ​​in the sub-block to be consistent with that before encryption to generate a ciphertext image.

2. The method for encrypting a face image that can be previewed according to claim 1, characterized in that: The step of extracting gradient features of a face region in an image comprises: Divide the image into 8×8 cells and calculate the gradient direction histogram of each cell; Based on the histogram, adjacent 2×2 cells are grouped into blocks and L2 norm normalization is performed; The normalized features of all blocks are connected to form the HOG feature vector of the entire image as the gradient feature of the face area.

3. The method for encrypting a face image that can be previewed according to claim 1, characterized in that: Extract the texture features of the face area in the image, including: Calculate the difference between the center pixel of the image and the neighboring pixels to generate the LBP value; The frequency distribution of LBP values ​​in each area of ​​the image is statistically analyzed to form an LBP feature vector as the texture feature of the face area.

4. The method for encrypting a face image that can be previewed according to claim 1, characterized in that: The method of using the classification model to classify and detect the fused feature vector in the window to obtain the coordinates of the face frame includes: Use the trained SVM classifier to classify the fused feature vector in the window and detect the face area; The overlapping detection windows are removed by non-maximum suppression to determine the final face frame coordinates.

5. The method for encrypting a face image that can be previewed according to claim 4, characterized in that: The removing overlapping detection windows by non-maximum suppression to determine the final face frame coordinates includes: Calculate the intersection over union (IoU) of the detection windows. If the IoU exceeds the preset threshold, remove the overlapping windows and retain the window coordinates whose IoU is lower than the threshold.

6. The method for encrypting a face image that can be previewed according to claim 1, characterized in that: The step of adjusting the encrypted area range according to the face frame coordinates includes: According to the coordinates of the upper left corner of the detected face frame and the lower right corner coordinates , determine the encryption sub-block range according to the following formula: ; ; ; ; in, is the side length of the partition block, is the upper left corner horizontal coordinate of the encrypted sub-block, is the upper left corner ordinate of the encrypted sub-block, is the lower right corner horizontal coordinate of the encrypted sub-block, is the lower right corner ordinate of the encrypted sub-block.

7. The method for encrypting a face image that can be previewed according to claim 1, characterized in that: The method for adjusting the sum of pixel values ​​in a sub-block is specifically as follows: If the sum of the pixel values ​​in the sub-block after encryption is inconsistent with that before encryption, the pixel with the largest or smallest grayscale value is selected for adjustment to ensure that the sum of the pixel values ​​in the sub-block after adjustment is consistent with that before encryption.

8. The method for encrypting a face image that can be previewed according to claim 1, characterized in that: The detecting the encrypted area in the ciphertext image comprises: The ciphertext image is divided into a 4×4 matrix, and the L1 norm of the adjacent pixel difference matrix is ​​calculated. If the norm exceeds the preset threshold, it is determined to be an encrypted area.

9. The method for encrypting a face image that can be previewed according to claim 1, characterized in that: The permutation function is a reversible permutation, and its inverse permutation is used to restore the original bit plane during the decryption process; The decryption process includes: detecting the encrypted area in the ciphertext image, performing an inverse permutation operation on the encrypted blocks in the encrypted area, restoring the original bit plane through a permutation function, and generating a decrypted plaintext image.

10. A face image encryption device capable of previewing, characterized in that: include: Memory, for storing computer programs / instructions; A processor, configured to execute the computer program / instructions to implement the steps of the method according to any one of claims 1 to 9.

Citation Information

Patent Citations

  • Image encryption method

    CN112330521A