An Encryption Storage Method and System for Images
By building a tree-like repository and using upsampling technology to convert images into image chains, the problem of cumbersome operation of large-area encryption areas in the prior art is solved, and a simplified image encryption process is realized.
Patent Information
- Application Number
- CN202410205913.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-02-24
- Publication Date
- 2025-05-27
- Estimated Expiration
- 2044-02-24
AI Technical Summary
The existing image encryption scheme is cumbersome to operate in large-area encrypted areas, making it difficult to simplify the alternative encryption process.
By building a tree-like repository, the image is converted into an image chain using upsampling technology, and the encryption operation is performed in the image chain, simplifying the encryption process.
The upsampling process reduces the amount of data, so that the large-area encrypted area may be only one pixel point in the upsampled image, greatly simplifying the alternative encryption process.
Smart Images

Figure CN118094587B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image encryption, and specifically to an image encryption storage method and system. Background Art
[0002] Image encryption is a commonly used processing means in image processing technology. It can ensure the security of images. In today's highly developed network technology, the demand for image encryption is very common.
[0003] The simplest way of image encryption is to directly "censor" the original image. This encryption method results in very low coordination of the encrypted image. To ensure the coordination of the image, existing image encryption schemes adopt a replacement encryption scheme, that is, select a part of the image to replace the area to be encrypted. For example, the clone stamp tool in the PS software greatly improves the coordination of the encrypted image. However, when the area to be encrypted is too large, the operation process of the replacement encryption process will be very cumbersome. How to simplify the replacement image encryption process is the technical problem that the technical solution of the present invention wants to solve. Summary of the Invention
[0004] The purpose of the present invention is to provide an image encryption storage method and system to solve the problems raised in the above background art.
[0005] To achieve the above purpose, the present invention provides the following technical solutions:
[0006] An image encryption storage method, the method includes:
[0007] Receive an image set and construct a storage library tree based on the image set; a connection line between any parent node and child node in the storage library tree contains a digital label for indicating the upsampling size;
[0008] Starting from the root storage library, perform upsampling in a loop and insert the upsampled image into the child storage library until data is inserted into one of the leaf storage libraries; wherein, the image contains a unique identifier, and the unique identifier is retained during the upsampling process;
[0009] Receive the image identifier, encryption area, and encryption level input by the user, determine the number of layers according to the encryption level, query the upsampled image in the child storage library of this layer according to the image identifier, and encrypt the encryption area in the upsampled image; wherein, after any image performs the encryption operation, all images with the same image identifier are updated in real time;
[0010] Record the update process of the image in real time and insert it into the key library with the image identifier as the index; the data in the key library is used for decryption.
[0011] As a further solution of the present invention: The steps of constructing a repository tree based on the received image set include:
[0012] Receive the image set, randomly select an image in the image set, and obtain the image size;
[0013] Perform grayscale conversion on the selected image, traverse the grayscale-converted image, and determine the image histogram;
[0014] Calculate the information amount of the image according to the image histogram and the image size;
[0015] Calculate the average information amount according to the calculated information amount, and determine the maximum upsampling size according to the average information amount;
[0016] Take the image set as the root repository, and create a repository tree with the maximum upsampling size as the number of nodes; wherein, the image size in the leaf repository in the repository tree is smaller than a preset threshold, and a digital label corresponding to the upsampling size is provided in the connection line between two adjacent nodes in the repository tree;
[0017] The calculation process of the information amount is:
[0018] In the formula, Y is the information amount, p(i) is the ratio of the number of pixels with pixel value i to the total number of image pixels, N and M are the sizes of the image, f(x) is a preset proportional function, the input is the size of the image, and the input is the correction coefficient.
[0019] As a further solution of the present invention: The steps of taking the root repository as the starting point, performing upsampling in a loop, and inserting the upsampled image into the sub-repository until data is inserted into one of the leaf repositories include:
[0020] Read the images in the root repository in sequence and calculate the information amount of the images;
[0021] Select the upsampling size according to the ratio of the information amount of the image to the average information amount;
[0022] Match the upsampling size with the digital label in the connection line to determine the target sub-repository;
[0023] Perform upsampling on the read image and insert it into the target sub-repository;
[0024] Take the target sub-repository as the root repository and loop to execute the above content until data is inserted into one of the leaf repositories;
[0025] The upsampling process is: In the formula, x(i,j) is the value of the upsampled point (i,j), and d is the upsampling size, Both the number of rows and columns is d; A(i,j) is the area corresponding to the point (i,j) before upsampling, and the area is d*d pixels.
[0026] As a further solution of the present invention: The steps of receiving the image identifier, the encrypted area, and the encryption level input by the user, determining the number of layers according to the encryption level, querying the upsampled image in the sub-repository of that number of layers according to the image identifier, and encrypting the encrypted area in the upsampled image include:
[0027] Receiving the image identifier, the encrypted area, and the encryption level input by the user;
[0028] Determining the number of layers according to the encryption level, and querying the image in the repository of that layer according to the image identifier as the target image;
[0029] Synchronously querying the corresponding image of the target image in the repositories of other layers and the pixel correspondence of the adjacent layer images;
[0030] Determining the mapped area of the encrypted area in the target image according to the pixel correspondence;
[0031] Copying the adjacent area of the mapped area and filling it into the mapped area; wherein, the copied content includes the pixel correspondence.
[0032] As a further solution of the present invention: The steps of copying the adjacent area of the mapped area and filling it into the mapped area include:
[0033] Taking the mapped area as the center and a preset value as the radius to determine the neighborhood range;
[0034] Querying the sub-area with the lowest similarity to the mapped area in the neighborhood range as the adjacent area;
[0035] Copying the adjacent area and filling it into the mapped area, and synchronously updating the images with the same image identifier in the repositories of other layers based on the pixel correspondence.
[0036] As a further solution of the present invention: The steps of real-time recording the update process of the image and inserting it into the key library with the image identifier as the index include:
[0037] Recording the position of the mapped area and the position of the adjacent area;
[0038] Recording the pixel correspondence of the mapped area;
[0039] Statistically inserting the position of the mapped area, the position of the adjacent area, and the pixel correspondence of the mapped area into the key library with the image identifier as the index.
[0040] The technical solution of the present invention also provides an encrypted storage system for images, and the system includes:
[0041] A repository tree construction module, which is used to receive an image set and construct a repository tree based on the image set; a connection line between any parent node and child node in the repository tree contains a digital tag, which is used to represent the upsampling size;
[0042] A data insertion module, which is used to start from the root repository, perform upsampling in a loop, and insert the upsampled image into a child repository until data is inserted into one of the leaf repositories; wherein, the image contains a unique identifier, and the unique identifier is retained during the upsampling process;
[0043] A data encryption module, which is used to receive the image identifier, encryption area, and encryption level input by the user, determine the number of layers according to the encryption level, search for the upsampled image in the child repository of this number of layers according to the image identifier, and encrypt the encryption area in the upsampled image; wherein, after any image performs the encryption operation, all images with the same image identifier are updated in real time;
[0044] An encryption process recording module, which is used to record the update process of the image in real time and insert it into the cipher library with the image identifier as the index; the data in the cipher library is used for decryption.
[0045] As a further solution of the present invention: the repository tree construction module includes:
[0046] An image selection unit, which is used to receive an image set, randomly select an image in the image set, and obtain the image size;
[0047] A conversion traversal unit, which is used to perform grayscale conversion on the selected image, traverse the grayscale-converted image, and determine the image histogram;
[0048] An information amount calculation unit, which is used to calculate the information amount of the image according to the image histogram and the image size;
[0049] A size determination unit, which is used to calculate the average information amount according to the calculated information amount, and determine the maximum upsampling size according to the average information amount;
[0050] A creation execution unit, which is used to use the image set as the root repository and create a repository tree with the maximum upsampling size as the number of nodes; wherein, the image size in the leaf repository in the repository tree is smaller than a preset threshold, and a digital tag corresponding to the upsampling size is set in the connection line between two adjacent nodes in the repository tree;
[0051] The calculation process of the information amount is:
[0052] In the formula, Y is the information amount, p(i) is the ratio of the number of pixels with pixel value i to the total number of image pixels, N and M are the sizes of the image, f(x) is a preset proportional function, the input is the size of the image, and the input is a correction coefficient.
[0053] As a further solution of the present invention: The data insertion module includes:
[0054] A calculation unit, configured to sequentially read images in the root repository and calculate the information amount of the images;
[0055] A comparison and selection unit, configured to select an upsampling size according to the ratio of the information amount of the image to the average information amount;
[0056] A matching unit, configured to match the upsampling size with the digital label in the connection line to determine the target sub-repository;
[0057] An upsampling unit, configured to perform upsampling on the read image and insert it into the target sub-repository;
[0058] A loop execution unit, configured to use the target sub-repository as the root repository and loop execute the above content until data is inserted into one of the leaf repositories;
[0059] The upsampling process is as follows: Wherein, x(i,j) is the value of the point (i,j) after upsampling, d is the upsampling size, Both the row and column of are d; A(i,j) is the area corresponding to the point (i,j) before upsampling, and the area is d*d pixel points.
[0060] As a further solution of the present invention: The data encryption module includes:
[0061] A data receiving unit, configured to receive the image identifier, encryption area, and encryption level input by the user;
[0062] A first query unit, configured to determine the number of layers according to the encryption level, and query the image in the repository of this layer according to the image identifier as the target image;
[0063] A second query unit, configured to synchronously query the corresponding image of the target image in the repositories of other layers and the pixel correspondence relationship of the adjacent layer images;
[0064] An area determination unit, configured to determine the mapped area of the encryption area in the target image according to the pixel correspondence relationship;
[0065] A copy and fill unit, configured to copy the adjacent area of the mapped area and fill it into the mapped area; wherein, the copied content includes the pixel correspondence relationship.
[0066] Compared with the prior art, the beneficial effects of the present invention are as follows: The present invention constructs a repository in the form of a tree structure according to the sizes in the image set, continuously upsamples the images, inputs them into different repositories, converts each image into an image chain. When encryption is required, directly select the upsampled image in the image chain and perform the encryption operation on the upsampled image, and the other images are updated synchronously. The upsampling process itself reduces the data volume, making it possible that the original large encrypted area is only a single pixel point in the upsampled image. The replacement encryption process is very easy, greatly simplifying the encryption process. BRIEF DESCRIPTION OF THE DRAWINGS
[0067] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments or the prior art descriptions. Obviously, the drawings in the following descriptions are only some embodiments of the present invention.
[0068] Figure 1 It is a flowchart of the method for encrypting and storing images.
[0069] Figure 2 It is the first sub-flowchart of the method for encrypting and storing images.
[0070] Figure 3 It is the second sub-flowchart of the method for encrypting and storing images.
[0071] Figure 4 It is the third sub-flowchart of the method for encrypting and storing images.
[0072] Figure 5 It is the fourth sub-flowchart of the method for encrypting and storing images.
[0073] Figure 6 It is a block diagram of the composition structure of the image encryption storage system. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0074] In order to make the technical problems, technical solutions and beneficial effects to be solved by the present invention clearer, the following further details the present invention in conjunction with the drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0075] Figure 1 It is a flowchart of the method for encrypting and storing images. In an embodiment of the present invention, a method for encrypting and storing images, the method includes:
[0076] Step S100: Receive an image set and construct a repository tree based on the image set; a connection line between any parent node and child node in the repository tree contains a digital tag for indicating the upsampling size;
[0077] An image set is a collection of images to be processed, and its quantity is limited. It often serves as a work task. In practical applications, a set of images extracted from a video can be used as an image set. In an example of the technical solution of the present invention, multiple repositories are constructed based on the image set, and a tree structure is formed among the multiple repositories for storing the processed images.
[0078] Step S200: Starting from the root repository, perform upsampling in a loop and insert the upsampled image into the sub-repository until data is inserted into one of the leaf repositories. Among them, the image contains a unique identifier, and the unique identifier is retained during the upsampling process.
[0079] The repository at the root node of the tree structure is called the root repository, the repositories at the child nodes of the tree structure are called sub-repositories, and the repositories at the leaf nodes of the tree structure are called leaf repositories. Insert all the images in the image set into the root repository, and then continuously perform upsampling on the images. Insert the upsampled images into the sub-repositories, and perform upsampling on the images in the sub-repositories again, and so on, until images are inserted into the last leaf repository. It should be noted that during the upsampling process, the identification information of the image is retained in real time, so that the multiple upsampling results of an image can correspond to each other, which can be understood as obtaining an image chain.
[0080] Step S300: Receive the image identifier, encryption area, and encryption level input by the user. Determine the number of layers according to the encryption level, search for the upsampled image in the sub-repository of this layer according to the image identifier, and encrypt the encryption area in the upsampled image. Among them, after any image performs the encryption operation, all images with the same image identifier are updated in real time.
[0081] The user inputs the image identifier to determine which image needs to be encrypted. The user inputs the encryption area, indicating which part of the image needs to be encrypted. The user inputs the encryption level, indicating how much content needs to be encrypted. In the technical solution of the present invention, the farther the repository is from the root repository, the smaller the size of the image in it, and the more content needs to be encrypted when encrypting it. Therefore, the encryption level can be set to be proportional to the number of layers of the repository. The higher the encryption level, the image is read and the encryption operation is performed in a repository farther from the root repository.
[0082] It should be noted that after an image is encrypted, the image changes. Synchronously, all other images in the image chain need to be updated accordingly.
[0083] Step S400: Record the update process of the image in real time and insert it into the key library with the image identifier as the index. The data in the key library is used for decryption.
[0084] The update process of the real-time recorded image is stored in a database called the cipher key library. When decryption is required, data is read from this database and the inverse operation of the encryption process is performed.
[0085] It is worth mentioning that regarding the decryption permission issue, it can be set independently by the staff. The simplest way is to borrow existing permission determination schemes, including password recognition, voice recognition, and face recognition, etc.
[0086] Figure 2 It is the first sub-process block diagram of the encryption storage method for images. The steps of receiving an image set and constructing a storage library tree based on the image set include:
[0087] Step S101: Receive the image set, randomly select an image in the image set, and obtain the image size;
[0088] Step S102: Perform grayscale conversion on the selected image, traverse the grayscale-converted image, and determine the image histogram;
[0089] Step S103: Calculate the information amount of the image according to the image histogram and the image size;
[0090] Step S104: Calculate the average information amount according to the calculated information amount, and determine the maximum upsampling size according to the average information amount;
[0091] Step S105: Use the image set as the root storage library, and create a storage library tree with the maximum upsampling size as the number of nodes; among them, the image size in the leaf storage library in the storage library tree is smaller than a preset threshold, and a digital label corresponding to the upsampling size is set in the connection line between two adjacent-layer nodes in the storage library tree;
[0092] The calculation process of the information amount is as follows:
[0093] In the formula, Y is the information amount, p(i) is the ratio of the number of pixels with pixel value i to the total number of image pixels, N and M are the sizes of the image, f(x) is a preset proportional function, the input is the size of the image, and the input is the correction coefficient.
[0094] The above content defines the construction process of the repository tree. First, an image set is received, and random sampling is performed on the image set to obtain approximately the size range of all images. Generally, the sizes of the images in the image set are nearly similar. Then, the color values of the sampled images are simplified, converted into grayscale images, and the grayscale histogram is determined to reflect the number of pixel points with different grayscale values. The information amount of each image is calculated by combining the grayscale histogram and the image size. Finally, the information amounts of the selected images are statistically analyzed and the average value is calculated. A corresponding relationship is preset by the staff to determine the maximum upsampling size, which is a positive integer greater than 1 and is proportional to the average information amount, and can be set as a linear function relationship.
[0095] Among them, the maximum upsampling size is used to represent how many child nodes are connected to each parent node. A digital label is set on the connection line between each child node and the parent node, corresponding to different upsampling sizes. For example, assume the maximum upsampling size is 4, which means that in one upsampling process, a 4*4 area is converted into a pixel point. The number of child nodes corresponding to each parent node is 3, and the digital labels in the connection lines are 2, 3, and 4 respectively, representing different upsampling sizes. When the upsampling size is 2, it means that in one upsampling process, a 2*2 area is converted into a pixel point.
[0096] It is worth mentioning that there is a preset threshold for the image size in the leaf repository, which is used to adjust the number of layers of the repository tree. The reason is that the upsampling process continuously shrinks the image, and when the image shrinks to a certain size, the upsampling process stops.
[0097] In addition, regarding the calculation process of the information amount, it uses the information entropy of the image. Due to the introduction of a correction coefficient determined according to the image size, its physical meaning is the information entropy of the image per unit area.
[0098] Figure 3 For the second sub - process block diagram of the image encryption storage method, the steps of taking the root repository as the starting point, repeatedly performing upsampling, and inserting the upsampled image into the sub - repository until data is inserted into one of the leaf repositories include:
[0099] Step S201: Read the images in the root repository in sequence and calculate the information amount of the images;
[0100] Step S202: Select the upsampling size according to the ratio of the information amount of the image to the average information amount;
[0101] Step S203: Match the upsampling size with the digital label in the connection line to determine the target sub - repository;
[0102] Step S204: Upsample the read image and insert it into the target sub - repository;
[0103] Step S205: Using the target sub-repository as the root repository, loop through the above process until data is inserted into one of the leaf repositories.
[0104] The upsampling process is as follows: In the formula, x(i,j) is the value of the point (i,j) after upsampling, d is the upsampling size, both the number of rows and columns of are d; A(i,j) is the area corresponding to the point (i,j) before upsampling, and the area of the region is d*d pixels.
[0105] The above provides a specific application process of the repository. The root repository stores all images in the image set. The images are read sequentially, and the information content of the images is calculated using the same calculation method. The upsampling size can be selected according to the ratio of the information content to the average information content, and then the sub-repository (the child node of the root node) can be located. Then, the upsampled image is upsampled again to locate the sub-repository of the next layer, and so on. Finally, data is inserted into the leaf repository. At this time, the image and its continuously upsampled results are stored in different layers of the repository in the form of an image chain.
[0106] Figure 4 It is the third sub-flow block diagram of the image encryption storage method. The steps of receiving the image identifier, encryption area, and encryption level input by the user, determining the number of layers according to the encryption level, and querying the upsampled image in the sub-repository of that number of layers according to the image identifier, and encrypting the encryption area in the upsampled image include steps S301 to S305:
[0107] Step S301: Receive the image identifier, encryption area, and encryption level input by the user;
[0108] Step S302: Determine the number of layers according to the encryption level, and query the image in the repository of that layer according to the image identifier as the target image;
[0109] Step S303: Synchronously query the corresponding image of the target image in other layer repositories and the pixel correspondence of adjacent layer images;
[0110] Step S304: Determine the mapped area of the encryption area in the target image according to the pixel correspondence;
[0111] Step S305: Copy the adjacent area of the mapped area and fill it into the mapped area; among them, the copied content includes the pixel correspondence.
[0112] Steps S301 to S305 define the encryption application stage. The user inputs the encryption level to determine at which layer to read and encrypt the image. The user with encryption requirements inputs the image identifier to query the encryption object. The user inputs the encryption area to determine which part of the encrypted image to encrypt.
[0113] Specifically, the sizes of the images at each layer are different and may undergo one or more upsampling processes. Therefore, after determining the layer number and querying the encryption object, it is necessary to determine the mapping area corresponding to the encryption area according to the pixel correspondence relationship, that is, the area corresponding to the encryption area during the continuous upsampling process. The pixel correspondence relationship is the corresponding relationship between the sets of pixel points pointing to the same content in different images.
[0114] As a preferred embodiment of the technical solution of the present invention, the step of copying the adjacent area of the mapping area and filling it into the mapping area includes:
[0115] Taking the mapping area as the center, a preset value is used as the radius to determine the neighborhood range;
[0116] Query the sub-area with the lowest similarity to the mapping area in the neighborhood range as the adjacent area;
[0117] Copy the adjacent area and fill it into the mapping area, and synchronously update the images with the same image identifier in other layer repositories based on the pixel correspondence relationship.
[0118] The above content defines the copying process, and there are two key points. One is the selection process of the adjacent area. A retrieval range is determined from the mapping area, and the sub-area with the lowest similarity and the same size as the mapping area is queried in the retrieval range as the adjacent area. The lowest similarity means the greater the difference, the better the encryption effect. The other is that when copying, it is necessary to copy the pixel correspondence relationship and synchronously update the corresponding positions in the corresponding images in other repositories.
[0119] It is worth mentioning that regarding the selection process of the adjacent area, a parameter can be introduced to represent readability, such as a readable value. The similarity can be directly used. The higher the similarity, the stronger the readability of the encrypted image. This can bring better effects in some occasions that require simple encryption. For example, when image blurring is performed, a high readability means a low degree of blurring and certain details can still be retained.
[0120] Figure 5 For the fourth sub-flow block diagram of the image encryption storage method, the step of real-time recording the update process of the image and inserting it into the key library with the image identifier as the index includes:
[0121] Step S401: Record the positions of the mapping area and the adjacent area;
[0122] Step S402: Record the pixel correspondence of the mapping area;
[0123] Step S403: Using the image identifier as an index, count the positions of the mapping area, the positions of adjacent areas, and the pixel correspondence of the mapping area, and insert them into the key library.
[0124] After the encryption process is completed, the decryption process needs to be explained. The decryption process in this application is relatively simple and is just the reverse process of the encryption process. It is only necessary to restore the mapping area and the pixel correspondence. This means that the encryption process needs to be recorded in real time. Generally, the recorded encryption process will be encrypted again to further ensure security.
[0125] Figure 6 FIG. is a block diagram of the composition structure of an image encryption storage system. In an embodiment of the present invention, an image encryption storage system, the system 10 includes:
[0126] A repository tree construction module 11, configured to receive an image set and construct a repository tree based on the image set; a connection line between any parent node and child node in the repository tree contains a digital label for indicating an upsampling size;
[0127] A data insertion module 12, configured to start from the root repository, perform upsampling in a loop, and insert the upsampled image into a child repository until data is inserted into one of the leaf repositories; wherein, the image contains a unique identifier, and the unique identifier is retained during the upsampling process;
[0128] A data encryption module 13, configured to receive an image identifier, an encryption area, and an encryption level input by a user, determine the number of layers according to the encryption level, query the upsampled image in the child repository of the corresponding layer according to the image identifier, and encrypt the encryption area in the upsampled image; wherein, after any image performs an encryption operation, all images with the same image identifier are updated in real time;
[0129] An encryption process recording module 14, configured to record the update process of the image in real time and insert it into the key library using the image identifier as an index; the data in the key library is used for decryption.
[0130] Further, the repository tree construction module 11 includes:
[0131] An image selection unit, configured to receive an image set, randomly select an image in the image set, and obtain the image size;
[0132] A conversion traversal unit, configured to perform grayscale conversion on the selected image, traverse the grayscale-converted image, and determine the image histogram;
[0133] An information amount calculation unit, configured to calculate the information amount of the image according to the image histogram and the image size;
[0134] A size determination unit for calculating an average information amount based on the calculated information amount and determining a maximum upsampling size according to the average information amount;
[0135] A creation execution unit for using the image set as a root repository and creating a repository tree with the maximum upsampling size as the number of nodes; wherein, the image size in the leaf repository in the repository tree is smaller than a preset threshold, and a digital label corresponding to the upsampling size is provided in the connection line between two adjacent nodes in the repository tree;
[0136] The calculation process of the information amount is as follows:
[0137] In the formula, Y is the information amount, p(i) is the ratio of the number of pixels with pixel value i to the total number of image pixels, N and M are the sizes of the image, f(x) is a preset proportional function, the input is the size of the image, and the input is a correction coefficient.
[0138] Specifically, the data insertion module 12 includes:
[0139] A calculation unit for sequentially reading images in the root repository and calculating the information amount of the images;
[0140] A comparison and selection unit for selecting an upsampling size according to the ratio of the information amount of the image to the average information amount;
[0141] A matching unit for matching the upsampling size with the digital label in the connection line to determine the target sub-repository;
[0142] An upsampling unit for upsampling the read image and inserting it into the target sub-repository;
[0143] A loop execution unit for using the target sub-repository as the root repository and loop-executing the above content until data is inserted into one of the leaf repositories;
[0144] The upsampling process is as follows: In the formula, x(i,j) is the value of the point (i,j) after upsampling, d is the upsampling size, Both the row and column of are d; A(i,j) is the area corresponding to the point (i,j) before upsampling, and the area of the region is d*d pixels.
[0145] In addition, the data encryption module 13 includes:
[0146] A data receiving unit for receiving the image identifier, encryption area, and encryption level input by the user;
[0147] A first query unit for determining the number of layers according to the encryption level and querying the image in the repository of this layer according to the image identifier as the target image;
[0148] A second query unit, configured to synchronously query the corresponding image of the target image in other layer repositories and the pixel correspondence relationship of adjacent layer images;
[0149] An area determination unit, configured to determine the mapped area of the encrypted area in the target image according to the pixel correspondence relationship;
[0150] A copy filling unit, configured to copy the adjacent area of the mapped area and fill it into the mapped area; wherein, the copied content includes the pixel correspondence relationship.
[0151] The above are only the preferred embodiments of the present invention, and are not intended to limit the present invention. Any modifications, equivalent replacements, and improvements made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for encrypting and storing an image, characterized in that: The method comprises: An image set is received, and a repository tree is constructed based on the image set; a connection line between any parent node and child node in the repository tree contains a digital label for indicating an upsampling size; Starting from the root repository, upsampling is performed cyclically, and the upsampled image is inserted into the sub-repository until data is inserted into one of the leaf repositories; wherein the image contains a unique identifier, and the unique identifier is retained during the upsampling process; Receive the image identifier, encryption area and encryption level input by the user, determine the number of layers according to the encryption level, search for the upsampled image in the sub-repository of the number of layers according to the image identifier, and encrypt the encryption area in the upsampled image; wherein, after the encryption operation is performed on any image, all images with the same image identifier are updated in real time; The update process of the image is recorded in real time, and the image identifier is used as the index to insert it into the Miyue library; the data in the Miyue library is used for decryption; The steps of receiving the image identifier, the encryption area and the encryption level input by the user, determining the number of layers according to the encryption level, searching the upsampled image in the sub-repository of the number of layers according to the image identifier, and encrypting the encryption area in the upsampled image include: Receive the image identification, encryption area and encryption level input by the user; Determine the number of layers according to the encryption level, and query the image in the layer repository according to the image identifier as the target image; Synchronously query the corresponding images of the target image in other layer repositories and the pixel correspondence of the adjacent layer images; Determine the mapping area of the encrypted area in the target image according to the pixel correspondence relationship; Copying an adjacent area of the mapping area and filling it into the mapping area; wherein the copied content includes pixel correspondence; The step of copying the adjacent area of the mapping area and filling it into the mapping area comprises: The neighborhood range is determined by taking the mapping area as the center and the preset value as the radius; In the neighborhood range, search for the sub-region with the lowest similarity to the mapped region as the adjacent region; The adjacent area is copied and filled into the mapping area, and the images with the same image identifier in other layer repositories are synchronously updated based on the pixel correspondence.
2. The method for encrypting and storing an image according to claim 1, characterized in that: The step of receiving an image set and constructing a repository tree based on the image set comprises: Receive an image set, randomly select an image from the image set, and obtain the image size; Perform grayscale conversion on the selected image, traverse the grayscale converted image, and determine the image histogram; Calculate the information content of the image based on the image histogram and image size; Calculate the average information amount according to the calculated information amount, and determine the maximum upsampling size according to the average information amount; The image set is used as the root repository, and a repository tree is created with the maximum upsampling size as the number of nodes; wherein the image size in the leaf repository in the repository tree is smaller than a preset threshold, and a digital label corresponding to the upsampling size is provided in the connection line between two nodes of adjacent layers in the repository tree; The calculation process of information volume is: Where Y is the amount of information, p(i) is the ratio of the number of pixels with pixel value i to the total number of pixels in the image, N and M are the sizes of the image, f(x) is a preset direct proportional function, input is the size of the image, and input is the correction coefficient.
3. The method for encrypting and storing an image according to claim 2, characterized in that: The step of taking the root repository as the starting point, looping through upsampling, and inserting the upsampled image into the sub-repository until data is inserted into one of the leaf repositories comprises: Read the images in the root repository one by one and calculate the information content of the images; Select the upsampling size based on the ratio of the image information content to the average information content; Match the upsampling size with the numerical labels in the connection lines to determine the target sub-repository; Upsample the read image and insert it into the target sub-repository; Take the target sub-repository as the root repository and execute the above content in a loop until data is inserted into one of the leaf repositories; The upsampling process is: Where x(i,j) is the value of the upsampled point (i,j), d is the upsampled size, The number of rows and columns is d; a(i,j) is the area corresponding to point (i,j) before upsampling, and the area is d*d pixels.
4. The method for encrypting and storing an image according to claim 1, characterized in that: The step of recording the update process of the image in real time and inserting the image into the secret library with the image identifier as the index includes: Record the location of the mapped area and the locations of adjacent areas; Record the pixel correspondence of the mapping area; The position of the mapping area, the position of the adjacent area and the pixel correspondence of the mapping area are counted using the image identifier as the index and inserted into the secret library.
5. An encrypted storage system for an image, characterized in that: The system comprises: A repository tree construction module is used to receive an image set and construct a repository tree based on the image set; a connection line between any parent node and child node in the repository tree contains a digital label, which is used to indicate an upsampling size; A data insertion module is used to perform upsampling cyclically starting from the root repository, and insert the upsampled image into the sub-repository until data is inserted into one of the leaf repositories; wherein the image contains a unique identifier, and the unique identifier is retained during the upsampling process; The data encryption module is used to receive the image identifier, encryption area and encryption level input by the user, determine the number of layers according to the encryption level, search for the upsampled image in the sub-repository of the number of layers according to the image identifier, and encrypt the encryption area in the upsampled image; wherein, after the encryption operation is performed on any image, all images with the same image identifier are updated in real time; The encryption process recording module is used to record the image update process in real time and insert the image into the Secret Library with the image identifier as the index; the data in the Secret Library is used for decryption; The data encryption module comprises: A data receiving unit, used for receiving an image identifier, an encryption area, and an encryption level input by a user; A first query unit is used to determine the number of layers according to the encryption level, and query the image in the layer repository according to the image identifier as the target image; A second query unit, used for synchronously querying the corresponding images of the target image in other layer storage repositories and the pixel correspondence relationship of the adjacent layer images; A region determination unit, used to determine a mapping region of the encryption region in the target image according to the pixel correspondence relationship; A copy filling unit, used for copying an adjacent area of the mapping area and filling the adjacent area into the mapping area; wherein the copy content includes a pixel correspondence relationship; The step of copying the adjacent area of the mapping area and filling it into the mapping area comprises: The neighborhood range is determined by taking the mapping area as the center and the preset value as the radius; In the neighborhood range, search for the sub-region with the lowest similarity to the mapped region as the adjacent region; The adjacent area is copied and filled into the mapping area, and the images with the same image identifier in other layer repositories are synchronously updated based on the pixel correspondence.
6. The image encryption storage system according to claim 5, characterized in that: The repository tree building module includes: An image selection unit, used for receiving an image set, randomly selecting an image from the image set, and obtaining an image size; A conversion traversal unit, used for performing grayscale conversion on the selected image, traversing the image after grayscale conversion, and determining an image histogram; An information volume calculation unit, used for calculating the information volume of the image according to the image histogram and the image size; a size determination unit, configured to calculate an average amount of information based on the calculated amount of information, and determine a maximum upsampling size based on the average amount of information; An execution unit is created, which is used to use the image set as a root repository and create a repository tree with the maximum upsampling size as the number of nodes; wherein the image size in the leaf repository in the repository tree is less than a preset threshold, and a digital label corresponding to the upsampling size is provided in a connection line between two nodes of adjacent layers in the repository tree; The calculation process of information volume is: Where Y is the amount of information, p(i) is the ratio of the number of pixels with pixel value i to the total number of pixels in the image, N and M are the sizes of the image, f(x) is a preset direct proportional function, input is the size of the image, and input is the correction coefficient.
7. The image encryption storage system according to claim 6, characterized in that: The data insertion module comprises: A computing unit, used for sequentially reading images in the root repository and computing information amounts of the images; A comparison and selection unit, used for selecting an upsampling size according to a ratio between the amount of information of the image and the average amount of information; A matching unit, used to match the up-sampling size with the digital label in the connection line to determine the target sub-repository; An upsampling unit, used for upsampling the read image and inserting it into a target sub-repository; A loop execution unit, used for taking the target sub-storage repository as the root repository and looping execution until data is inserted into one of the leaf repositories; The upsampling process is: Where x(i,j) is the value of the upsampled point (i,j), d is the upsampled size, The number of rows and columns is d; A(i,j) is the area corresponding to point (i,j) before upsampling, and the area is d*d pixels.
Citation Information
Patent Citations
Map data desensitization method and system
CN116341002A
Enabling and validating data encryption
US20190236284A1