Image encryption method and system

By identifying the overall meaning of the image and determining the pixel contribution degree in the privacy area, and presetting different encryption rules to encrypt the image, the problem of the same image encryption rules in the prior art is solved, resulting in easy decryption, and a better encryption effect is achieved.

CN120219140AInactive Publication Date: 2025-06-27JIANGSU FUYAO CONSTRUCTION ENGINEERING CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202510270325.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-07
Publication Date
2025-06-27
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The existing image encryption method is easier to decrypt when the image is snooped and decrypted, and the encryption rules are the same.

Method used

By identifying the overall meaning of the image to be encrypted, the privacy content and the privacy area are determined, and different encryption rules are preset according to the contribution of each pixel to the privacy content, and the image is encrypted.

Benefits of technology

The pixel contributions in the image are different, and each pixel can have different encryption rules, which are not easy to decrypt and have good encryption effects.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120219140A_ABST
    Figure CN120219140A_ABST
Patent Text Reader

Abstract

The invention discloses an image encryption method and system, and belongs to the technical field of image encryption, and the method comprises the following steps: S1, presetting an encryption rule of each contribution level of image pixels; s2, identifying the overall meaning of the to-be-encrypted image; s3, judging the privacy content and the privacy area of the to-be-encrypted image; s4, judging the contribution degree of each pixel in the privacy area to the privacy content; s5, encrypting the image; according to the image encryption method, the overall meaning of the to-be-encrypted image is firstly identified, then the privacy content and the privacy area are judged based on the overall meaning, then the contribution degree of each pixel to the privacy content is judged based on the privacy area, and then the image is encrypted based on the pixel contribution degree and the preset encryption rule. The contribution degrees of the pixels in one picture are different, that is, each pixel can be different encryption rules, decryption is not easy, and the encryption effect is good.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of image encryption, and particularly relates to an image encryption method and system. Background Technique

[0002] An image refers to non-text data with visual information, and its description includes attributes such as the shape, size, color, brightness, and position of an object.

[0003] In order to protect privacy and sensitive information during the transmission of images, they are generally encrypted.

[0004] Chinese Patent Application No. 202210744234.1 discloses an image encryption method and device, including identifying privacy content in a first image, displaying M second images based on the privacy content, receiving a first input of a user for a third image of the M local images, and in response to the first input, hiding the image information of the first image into the third image based on an image encryption steganography algorithm to obtain a fourth image.

[0005] The above technology has the following problems: The above image encryption method hides the image information of the first image into a third image without hidden image information to form a fourth image to encrypt the first image. Since the user cannot determine whether the first image is encrypted, this encryption method can reduce the risk of the image being snooped and decrypted. At the same time, since the encryption rules of each image are different, it can avoid the leakage of the image encryption rules and cause the leakage of other image information, improving the image encryption effect. However, the encryption rules for one image are the same in this encryption method. If the image is snooped and decrypted, it is relatively easy to decrypt.

[0006] In view of this, an image encryption method and system are designed to solve the above problems. Summary of the Invention

[0007] To solve the problems raised in the above background technique, the present invention provides an image encryption method and system, which have the characteristics that the contribution degrees of pixels in one picture are different, that is, each pixel can have different encryption rules, making it not easy to decrypt and having a good encryption effect.

[0008] Another object of the present invention is to provide an image encryption system.

[0009] To achieve the above object, the present invention provides the following technical solution: An image encryption method includes the following steps:

[0010] S1: Preset the encryption rules for each contribution level of image pixels;

[0011] S2: Identify the overall meaning of the image to be encrypted;

[0012] S3: Determine the privacy content and privacy area of the image to be encrypted based on the overall meaning of the image to be encrypted;

[0013] S4: Determine the contribution degree of each pixel in the privacy area to the privacy content based on the determined privacy area of the image to be encrypted;

[0014] S5: Encrypt the image based on the contribution degree of each pixel in the determined privacy area to the privacy content and the encryption rules of each contribution level of the preset image pixels.

[0015] Further, the specific steps of the step S2 include:

[0016] S201: Construct an image recognition model, and the image recognition model is a bidirectional visual understanding model with an attention mechanism;

[0017] S202: Collect historical image data, which is divided into a training set and a validation set;

[0018] S203: Train the constructed image recognition model based on the training set and the validation set, and optimize the model parameters based on the loss function until the parameters are optimal and stop;

[0019] S204: Recognize the overall meaning of the image to be encrypted based on the trained image recognition model. During the recognition process of the image recognition model, the attention mechanism focuses on the image areas of each part of the meaning that constitutes the overall meaning of the image to be encrypted.

[0020] Further, the specific steps of the step S3 include:

[0021] S301: The trained image recognition model recognizes the overall meaning of the image to be encrypted, and understands the key content of the image to be encrypted based on the overall meaning of the image to be encrypted, that is, the privacy content;

[0022] S302: Determine the privacy area of the image to be encrypted based on the understood privacy content of the image to be encrypted and the image area of the privacy content of the image to be encrypted that the attention mechanism of the image recognition model focuses on.

[0023] Further, in the step S3, the determination of the privacy content and privacy area of the image to be encrypted can also be combined with the user's input for determination.

[0024] Further, the specific steps of the step S4 include:

[0025] S401: Preset the correlation between the similarity level and the contribution degree level;

[0026] S402: Cluster each pixel in the determined privacy area to form superpixels for segmentation;

[0027] S403: Identify the meaning of the image after privacy area segmentation based on the image recognition model;

[0028] S404: Compare the similarity between the meaning of the segmented image and the overall meaning of the image;

[0029] S405: Based on the correlation between the similarity and the preset similarity level and contribution level, determine the contribution degree of each pixel to the privacy content.

[0030] The described image encryption system includes:

[0031] An encryption rule preset module that presets the encryption rules for each contribution level of image pixels;

[0032] An image meaning recognition module that recognizes the overall meaning of the image to be encrypted;

[0033] An image privacy content and area determination module that determines the privacy content and privacy area of the image to be encrypted based on the overall meaning of the image to be encrypted;

[0034] A pixel contribution degree determination module that determines the contribution degree of each pixel in the privacy area to the privacy content based on the determined privacy area of the image to be encrypted;

[0035] An image encryption module that encrypts the image based on the contribution degree of each pixel in the determined privacy area to the privacy content and the preset encryption rules for each contribution level of image pixels.

[0036] Compared with the prior art, the beneficial effects of the present invention are:

[0037] The present invention first recognizes the overall meaning of the image to be encrypted, then determines the privacy content and privacy area based on the overall meaning, then determines the contribution degree of each pixel to the privacy content based on the privacy area, and finally encrypts the image based on the pixel contribution degree and the preset encryption rules. Compared with the prior art, the contribution degrees of pixels in a picture are different, that is, each pixel can have different encryption rules, which is not easy to decrypt and has a good encryption effect. Brief Description of the Drawings

[0038] Figure 1 is the flowchart of the method of the present invention;

[0039] Figure 2 is the system framework diagram of the present invention;

[0040] In the figure: 1. Encryption rule preset module; 2. Image meaning recognition module; 3. Image privacy content and area determination module; 4. Pixel contribution degree determination module; 5. Image encryption module. Detailed Embodiment

[0041] The following will clearly and completely describe the technical solutions in the embodiments of the present invention 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. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.

[0042] Referring to the attached Figure 1 , the present invention provides the following technical solutions: An image encryption method, comprising the following steps:

[0043] S1: Preset the encryption rules for each contribution level of image pixels;

[0044] The encryption rules between different contribution levels of image pixels are different, which can make the encryption between different levels of the image different, that is, even if there are different encryption methods on an image, increasing the difficulty of decrypting the image when being snooped, so as to improve the encryption effect of the image;

[0045] S2: Identify the overall meaning of the image to be encrypted;

[0046] An image can express a meaning, which can be understood as the meaning that the image wants to express. For example, an image shows fruits placed on a table. Among them, the meaning that the image wants to express may be the fruits, or it may be the delicate texture of the table. The meaning expressed by the image can be determined by the central perspective of the image;

[0047] S3: Determine the privacy content and privacy area of the image to be encrypted based on the overall meaning of the image to be encrypted;

[0048] Taking the above as an example of privacy content, if the overall meaning of the identified image is fruits, then it is determined that the fruits are the privacy content, and the privacy area is automatically defined as the fruit area of the image;

[0049] S4: Determine the contribution degree of each pixel in the privacy area to the privacy content based on the determined privacy area of the image to be encrypted;

[0050] Taking the above as an example of the contribution degree of pixels to the privacy content, if the privacy area is defined as the fruit area of the image, and if the image pixel is defined as the fruit edge area, then the contribution degree to the privacy content is the first level. If the image pixel is located in the fruit center area, then the contribution degree to the privacy content is the second level, and so on;

[0051] S5: Encrypt the image based on the contribution degree of each pixel in the determined privacy area to the privacy content and the preset encryption rules for each contribution level of image pixels.

[0052] Specifically, the specific steps of step S2 include:

[0053] S201: Construct an image recognition model, which is a bidirectional visual understanding model with an attention mechanism;

[0054] A bidirectional visual understanding model refers to an artificial intelligence system that can identify and understand objects, scenes, and events in an image based on text descriptions, and can also generate or select corresponding text descriptions according to the image content;

[0055] The attention mechanism refers to a resource allocation scheme that allows the bidirectional visual understanding model to focus on the most relevant parts when processing information. Here, when generating a text description based on the image content, it pays attention to the corresponding regions for generating the text description;

[0056] S202: Collect historical image data and divide it into a training set and a validation set;

[0057] S203: Train the constructed image recognition model based on the training set and the validation set, and optimize the model parameters based on the loss function until the parameters are optimal and then stop;

[0058] S204: Based on the trained image recognition model, recognize the overall meaning of the image to be encrypted. During the recognition process of the image recognition model, the attention mechanism focuses on the image regions of the respective parts of the overall meaning that make up the image to be encrypted.

[0059] Specifically, the specific steps of step S3 include:

[0060] S301: The trained image recognition model recognizes the overall meaning of the image to be encrypted, and understands the key content of the image to be encrypted based on the overall meaning, that is, the privacy content;

[0061] S302: Based on the understood privacy content of the image to be encrypted and the image regions of the privacy content of the image to be encrypted that the image recognition model's attention mechanism focuses on, determine the privacy region of the image to be encrypted.

[0062] Specifically, in step S3, the determination of the privacy content and privacy region of the image to be encrypted can also be combined with the user's input for determination.

[0063] Specifically, the specific steps of step S4 include:

[0064] S401: Preset the correlation between the similarity level and the contribution level;

[0065] S402: Perform clustering on each pixel of the determined privacy region to form superpixels for segmentation;

[0066] The specific steps of superpixel clustering segmentation:

[0067] Determine the number of superpixels;

[0068] Uniformly initialize the clustering in the image;

[0069] Search for the cluster center within the domain of each cluster;

[0070] Calculate the distance metric between each pixel in the image and each cluster center, with the expression:

[0071]

[0072] In the formula: x i represents the coordinates of pixel i, and x j represents the coordinates of the cluster center;

[0073] Assign the pixels in the image to the cluster of the cluster center with the minimum distance metric;

[0074] Recalculate the average color value and position of all pixels in each cluster as the new cluster center, repeat the above distance metric and assignment until the change in the cluster center is minimized and stop, and form superpixels for segmentation;

[0075] S403: Identify the meaning of the image after privacy region segmentation based on the image recognition model;

[0076] S404: Compare the similarity between the meaning of the segmented image and the overall meaning of the image;

[0077] The similarity is calculated based on the Euclidean distance. Convert the meaning attributes of the two images into vectors and calculate the distance between the two vectors. The expression is:

[0078]

[0079] In the formula: x i and x j represent the vectors of the meaning attributes of the two images;

[0080] Judge the similarity between the meanings of the two images based on the distance between the two vectors. If the distance is smaller, the similarity is higher; otherwise, it is lower;

[0081] S405: Determine the contribution degree of each pixel to the privacy content based on the relevance between the similarity and the preset similarity level and contribution degree level.

[0082] Refer to Appendix Figure 2 , An image encryption system, including:

[0083] An encryption rule preset module 1 that presets the encryption rules for each contribution level of image pixels;

[0084] An image meaning recognition module 2 that recognizes the overall meaning of the image to be encrypted;

[0085] The image privacy content and area determination module 3 determines the privacy content and privacy area of the image to be encrypted based on the overall meaning of the image to be encrypted;

[0086] The pixel contribution degree determination module 4 determines the contribution degree of each pixel in the privacy area to the privacy content based on the determined privacy area of the image to be encrypted;

[0087] The image encryption module 5 encrypts the image based on the contribution degree of each pixel in the determined privacy area to the privacy content and the encryption rules for each contribution level of the image pixels preset.

[0088] This patent is funded by the provincial college students' innovation and entrepreneurship project training plan, and the project number is 202410290258Y.

[0089] Although the embodiments of the present invention have been shown and described, for those of ordinary skill in the art, it can be understood that various changes, modifications, substitutions, and variations can be made to these embodiments without departing from the principles and spirit of the present invention. The scope of the present invention is defined by the appended claims and their equivalents.

Claims

1. An image encryption method, characterized in that: The following steps are involved: S1: Encryption rules for each contribution level of preset image pixels; S2: Identify the overall meaning of the image to be encrypted; S3: determining the privacy content and privacy area of ​​the image to be encrypted based on the overall meaning of the image to be encrypted; S4: Determine the contribution of each pixel in the privacy area to the privacy content based on the determined privacy area of ​​the image to be encrypted; S5: Encrypting the image based on the determined contribution of each pixel in the privacy area to the privacy content and the preset encryption rules for each contribution level of the image pixels.

2. The image encryption method according to claim 1, characterized in that: The specific steps of step S2 include: S201: Build an image recognition model, which is a bidirectional visual understanding model with an attention mechanism; S202: Collect historical image data and divide it into a training set and a validation set; S203: training the constructed image recognition model based on the training set and the validation set, and optimizing the model parameters based on the loss function until the parameters are optimal; S204: Identify the overall meaning of the image to be encrypted based on the trained image recognition model. During the recognition process of the image recognition model, the attention mechanism focuses on the image areas of the various parts of the meaning that constitute the overall meaning of the image to be encrypted.

3. The image encryption method according to claim 2, characterized in that: The specific steps of step S3 include: S301: The trained image recognition model identifies the overall meaning of the image to be encrypted, and understands the key content of the image to be encrypted, that is, the privacy content, based on the overall meaning of the image to be encrypted; S302: Determine a privacy area of ​​the image to be encrypted based on the understood privacy content of the image to be encrypted and the image area of ​​the image to be encrypted that the attention mechanism of the image recognition model focuses on.

4. The image encryption method according to claim 1, characterized in that: In step S3, the determination of the privacy content and privacy area of ​​the image to be encrypted may also be determined in combination with the user's input.

5. The image encryption method according to claim 3, characterized in that: The specific steps of step S4 include: S401: Preset the correlation between the similarity level and the contribution level; S402: Clustering pixels of the determined privacy area to form superpixels for segmentation; S403: Identify the meaning of the image after the privacy area segmentation based on the image recognition model; S404: comparing the similarity between the meaning of the segmented image and the meaning of the entire image; S405: Determine the contribution of each pixel to the private content based on the similarity and the correlation between the preset similarity level and contribution level.

6. An image encryption system according to any one of claims 1 to 5, characterized in that: include: An encryption rule presetting module (1) is used to preset encryption rules for each contribution level of image pixels; An image meaning recognition module (2) for recognizing the overall meaning of the image to be encrypted; An image privacy content and area determination module (3) determines the privacy content and privacy area of ​​the image to be encrypted based on the overall meaning of the image to be encrypted; A pixel contribution determination module (4) determines the contribution of each pixel in the privacy area to the privacy content based on the determined privacy area of ​​the image to be encrypted; The image encryption module (5) encrypts the image based on the determined contribution of each pixel in the privacy area to the privacy content and the preset encryption rules for each contribution level of the image pixels.

Citation Information

Patent Citations

  • Image encryption method and device

    CN115134473A