Image encryption method, image decryption method, electronic device, and storage medium
Patent Information
- Application Number
- CN202311695661.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-11
- Publication Date
- 2026-10-23
- Estimated Expiration
- 2043-12-11
AI Technical Summary
然而,现有的混沌加密算法加密结构简单且抗外部冲击能力弱,一旦密钥泄露,将难以保证数字图像的安全
[0018]本发明实施例的技术方案,设计了一种新的图像加解密方法。对于图像加密方法,通过获取待加密图像和关联信息,并根据待加密图像的第一分量,确定至少一个目标聚类区域;再分别对每个目标聚类区域、待加密图像的第二分量和待加密图像的第三分量进行加密,得到中间图像;最后在中间图像上插入一信息区,并在信息区内写入加密信息,得到加密后的目标图像。一方面,由于加密是针对不同目标聚类区域分别进行的,降低了图像中第一分量各特征的关联性,提高了破解难度;另一方面,图像中第二分量和第三分量均作为整体进行加密,又平衡了整个图像的加密复杂度;另外,加密信息的存储位置是根据中间图像的尺寸和关联信息确定的,实现了存储位置的随机性,进一步提高了破解难度,从而实现了提升图像存储、传输的安全性的目的,避免信息泄露。
Smart Images

Figure CN117714614B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of information security technology, and in particular to image encryption methods, image decryption methods, electronic devices, and storage media. Background Technology
[0002] With the rapid development of network and multimedia technologies, digital images have become one of the most important carriers of information. For example, in the financial sector, digital images can serve as customer identification information and transaction data. Because digital images contain confidential personal information of users or businesses, it is essential to ensure the security of their storage and use.
[0003] Currently, chaotic encryption algorithms are commonly used to encrypt digital images. However, existing chaotic encryption algorithms have simple encryption structures and weak resistance to external attacks. Once the key is leaked, it is difficult to guarantee the security of digital images. Summary of the Invention
[0004] This invention provides an image encryption method, an image decryption method, an electronic device, and a storage medium, which can improve the security of image storage and transmission and prevent information leakage.
[0005] According to one aspect of the present invention, an image encryption method is provided, comprising: acquiring an image to be encrypted and associated information, wherein the image to be encrypted is an image in YUV format; determining at least one target clustering region based on a first component of the image to be encrypted, wherein the first component is any one of a Y component, a U component, and a V component; encrypting each target clustering region, a second component of the image to be encrypted, and a third component of the image to be encrypted respectively to obtain an intermediate image, wherein the second component and the third component are two other components of the Y component, U component, and V component besides the first component; inserting an information area on the intermediate image and writing encrypted information in the information area to obtain an encrypted target image, wherein the position of the information area is determined according to the size of the intermediate image and the associated information, and the encrypted information includes the number of target clustering regions, a chaotic encryption key for each target clustering region, position information of each target clustering region, a chaotic encryption key for the second component of the image to be encrypted, and a chaotic encryption key for the third component of the image to be encrypted.
[0006] Optionally, the image to be encrypted and associated information are obtained, including: receiving the original image sent by the shooting device, the shooting time of the original image, and the shooting device ID, wherein the original image is an RGB format image; converting the original image into an image to be encrypted, and using the shooting time of the original image and the shooting device ID as associated information.
[0007] Optionally, based on the first component of the image to be encrypted, at least one target clustering region is determined, including: clustering the first component of the image to be encrypted to obtain several candidate clustering regions; determining the deformation clustering region corresponding to each candidate clustering region based on the maximum horizontal length and maximum vertical length of each candidate clustering region, wherein the deformation clustering region is the minimum bounding rectangle region of its corresponding candidate clustering region; for at least two deformation clustering regions with overlapping regions, determining the proportion of the overlapping region in each deformation clustering region, and taking the deformation clustering region with the largest proportion as the target clustering region.
[0008] Optionally, for any target clustering region, the target clustering region is encrypted, including: randomly generating first chaotic system parameters and first chaotic system initial values corresponding to the target clustering region; generating a first chaotic encryption sequence corresponding to the target clustering region based on the first chaotic system parameters and first chaotic system initial values; and encrypting the target clustering region using the first chaotic encryption sequence.
[0009] Encrypting the second component and the third component of the image to be encrypted includes: randomly generating second chaotic system parameters and second chaotic system initial values; generating a second chaotic encryption sequence based on the second chaotic system parameters and second chaotic system initial values; and using the second chaotic encryption sequence to encrypt the second component and the third component of the image to be encrypted, respectively.
[0010] Optionally, inserting an information area on the intermediate image includes: determining a reference position based on the size and associated information of the intermediate image; inserting an information area on the intermediate image based on the reference position, wherein the information area is a row of pixels including the reference position and having the same length as the intermediate image, or the information area is a column of pixels including the reference position and having the same width as the intermediate image.
[0011] Optionally, a target cluster region has a serial number, which is determined based on the coordinates of the top-left corner and the bottom-right corner of the target cluster region.
[0012] Writing encrypted information into the information area includes: dividing the information area into a valid information area and an invalid information area, wherein the valid information area includes several consecutive pixels starting from the pixel at the reference position, and the invalid information area includes all other pixels in the information area except for the valid information area; writing encrypted information into the valid information area, and randomly setting the first component, the second component, and the third component of each pixel in the invalid information area.
[0013] Optionally, the effective information area includes one first pixel, 2n second pixels, and one third pixel arranged sequentially, where n is the number of target clustering regions.
[0014] Encrypted information is written into the valid information area, including: setting the first component of the first pixel to the number of target cluster regions, and randomly setting the second and third components of the first pixel; for the target cluster region with index i, setting the first component of the (2i-1)th second pixel to the first chaotic system parameter corresponding to the target cluster region, setting the second and third components of the (2i-1)th second pixel to the left-hand horizontal and vertical coordinates of the target cluster region respectively, setting the first component of the 2ith second pixel to the initial value of the first chaotic system corresponding to the target cluster region, setting the second and third components of the 2ith second pixel to the right-hand horizontal and vertical coordinates of the target cluster region respectively; setting the second and third components of the third pixel to the second chaotic system parameter and the second chaotic system initial value respectively, and randomly setting the first component of the third pixel.
[0015] According to another aspect of the present invention, an image decryption method is provided, comprising: acquiring an image to be decrypted and associated information, and determining the position of an information area based on the size of the image to be decrypted and the associated information; reading decryption information stored in the information area based on the position of the information area, and deleting the information area from the image to be decrypted to obtain an intermediate image, wherein the decryption information includes the number of target clustering regions, a chaotic decryption key for each target clustering region, position information of each target clustering region, a chaotic decryption key for a second component of the intermediate image, and a chaotic decryption key for a third component of the intermediate image, wherein the target clustering region corresponds to a first component of the intermediate image, the first component being any one of a Y component, a U component, and a V component, and the second and third components being two other components of the Y component, U component, and V component besides the first component; and decrypting each target clustering region, the second component of the intermediate image, and the third component of the intermediate image according to the decryption information to obtain a decrypted target image, wherein the decrypted target image is an image in YUV format.
[0016] According to another aspect of the present invention, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores a computer program executable by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the method described in any embodiment of the present invention.
[0017] According to another aspect of the present invention, a computer-readable storage medium is provided, which stores computer instructions for causing a processor to execute and implement the method described in any embodiment of the present invention.
[0018] The technical solution of this invention provides a novel image encryption and decryption method. For the image encryption method, the method involves acquiring the image to be encrypted and associated information, and determining at least one target clustering region based on the first component of the image to be encrypted. Then, each target clustering region, the second component of the image to be encrypted, and the third component of the image to be encrypted are encrypted separately to obtain an intermediate image. Finally, an information area is inserted into the intermediate image, and encrypted information is written into the information area to obtain the encrypted target image. On the one hand, since encryption is performed separately for different target clustering regions, the correlation between features of the first component in the image is reduced, increasing the difficulty of cracking. On the other hand, encrypting the second and third components of the image as a whole balances the overall encryption complexity of the image. Furthermore, the storage location of the encrypted information is determined based on the size of the intermediate image and the associated information, achieving randomness in the storage location and further increasing the difficulty of cracking. This achieves the goal of improving the security of image storage and transmission, and preventing information leakage.
[0019] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description
[0020] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0021] Figure 1 This is a flowchart illustrating an image encryption method provided in Embodiment 1 of the present invention;
[0022] Figure 2 This is a schematic diagram of determining the deformable clustering region corresponding to the candidate clustering region provided in Embodiment 1 of the present invention;
[0023] Figure 3 This is based on the embodiment of the present invention. Figure 2 The diagram shown illustrates how deformation-based clustering regions further define the target clustering region.
[0024] Figure 4 This is a schematic diagram of an embodiment of the present invention, which shows how to insert an information area on an intermediate image and write encrypted information in the information area.
[0025] Figure 5 This is a flowchart illustrating an image decryption method provided in Embodiment 2 of the present invention;
[0026] Figure 6 This is a schematic diagram of the structure of an image encryption device provided in Embodiment 3 of the present invention;
[0027] Figure 7 This is a schematic diagram of the structure of an image decryption device provided in Embodiment 4 of the present invention;
[0028] Figure 8 This is a schematic diagram of the structure of an electronic device provided in Embodiment 5 of the present invention. Detailed Implementation
[0029] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0030] It should be noted that the terms "first," "second," "third," "original," "target," "candidate," etc., used in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0031] It should be noted that the steps of image acquisition, storage, use, and processing in this invention all comply with the relevant provisions of national laws and regulations.
[0032] Example 1
[0033] Figure 1 This is a flowchart illustrating an image encryption method provided in Embodiment 1 of the present invention. This embodiment is applicable to the encryption of images. The method can be executed by an image encryption device, which can be implemented in hardware and / or software and can be configured in an electronic device (such as a computer or server). The electronic device provided by the present invention can simultaneously possess image encryption and image decryption functions; that is, the electronic device can implement both the image encryption method of Embodiment 1 and the image decryption method of Embodiment 2 described below. Figure 1As shown, the method includes:
[0034] S110. Obtain the image to be encrypted and associated information, wherein the image to be encrypted is an image in YUV format.
[0035] The image to be encrypted is any YUV format image that needs to be encrypted. Associated information refers to information related to the image to be encrypted, such as its attribute information.
[0036] In one embodiment, the method for "obtaining the image to be encrypted and associated information" in step S110 may include the following two steps.
[0037] Step a1: Receive the original image, the shooting time of the original image, and the identification (ID) of the shooting device sent by the shooting device, wherein the original image is an RGB format image.
[0038] The capturing device can be any device with capturing capabilities, such as a webcam, camera, or video recorder. The capturing device captures the original image and sends the original image, the capture time, and the capturing device ID to the image encryption device.
[0039] The original image capture time can be accurate to the year, month, and day, or even to the hour, minute, and second. The capturing device ID is an ID obtained by sequentially numbering multiple capturing devices. To ensure successful image decryption, all electronic devices within a system use the same ID for the same capturing device; that is, each capturing device has a unique and unified capturing device ID.
[0040] Step a2: Convert the original image into an image to be encrypted, and use the original image's capture time and capture device ID as associated information.
[0041] Since the original image is in RGB format, it needs to be converted to YUV format to obtain the image to be encrypted, and the shooting time and shooting device ID of the original image are used as the associated information.
[0042] An RGB format image refers to an image where each pixel is composed of R, G, and B components, where R, G, and B are described by different gray levels. A YUV format image, on the other hand, uses luminance and chroma to represent the color of each pixel. The Y component represents luminance (Luminance, Luma), which is the gray level value, while the U and V components represent chroma (Chrominance or Chroma), describing hue and saturation.
[0043] In one embodiment, the conversion relationship between the original image and the image to be encrypted is as follows:
[0044] Y = 0.299 * R + 0.587 * G + 0.114 * B;
[0045] U = 0564*(B - Y);
[0046] V = 0.713 * (R - Y).
[0047] For example, suppose the original image is RGB image A, which was captured on May 10, 2023 at 14:35:20, and the capturing device ID is 10305. After conversion, the resulting image to be encrypted is YUV image B, with the associated information being May 10, 2023 at 14:35:20 (i.e., the capturing time of RGB image A) and 10305 (i.e., the capturing device ID).
[0048] S120. Determine at least one target clustering region based on the first component of the image to be encrypted, wherein the first component is any one of the Y component, U component, and V component.
[0049] In this invention, the first component is any one of the Y component, U component, and V component, and the second and third components are two other components of the Y component, U component, and V component besides the first component. For example, the first component is the Y component, the second component is the U component, and the third component is the V component; or, the first component is the U component, the second component is the Y component, and the third component is the V component; or, the first component is the V component, the second component is the U component, and the third component is the Y component.
[0050] Preferably, since the human visual system is more sensitive to brightness than color, and considering the characteristics of the YUV format, the first component is usually the Y component, the second component is the U component, and the third component is the V component.
[0051] In one embodiment, the method of "determining at least one target clustering region based on the first component of the image to be encrypted" in step S120 may include the following three steps.
[0052] Step b1: Cluster the first component of the image to be encrypted to obtain several candidate clustering regions.
[0053] Clustering refers to the process of dividing a collection of physical or abstract objects into multiple classes composed of similar objects. In this invention, the k-means clustering algorithm (KMA) can be used to cluster the first component of the image to be encrypted, resulting in several candidate clustering regions.
[0054] Step b2: Determine the deformation clustering region corresponding to each candidate clustering region based on the maximum horizontal and vertical lengths of each candidate clustering region. The deformation clustering region is the minimum bounding rectangle region of its corresponding candidate clustering region.
[0055] In step b2, for each candidate clustering region, its corresponding deformation clustering region needs to be determined. Taking a candidate clustering region as an example, the specific method for determining the deformation clustering region is as follows: determine the maximum horizontal and vertical lengths of the candidate clustering region. The maximum horizontal and vertical lengths can be understood as the maximum lengths of the x-axis and y-axis of the two-dimensional coordinate system where the image to be encrypted is located; based on the maximum horizontal and vertical lengths of the candidate clustering region, expand the candidate clustering region into a deformation clustering region. The deformation clustering region is the minimum bounding rectangle of its corresponding candidate clustering region, and the length and width of the deformation clustering region are the maximum horizontal and vertical lengths of the candidate clustering region, respectively.
[0056] In this way, by expanding the candidate clustering region into a deformable clustering region, the shape of the clustering region can be standardized, making it easier to record the location of the clustering region.
[0057] Step b3: For at least two deformation clusters with overlapping regions, determine the proportion of the overlapping region in each deformation cluster, and take the deformation cluster with the largest proportion as the target cluster.
[0058] After identifying the deformation clustering regions corresponding to all candidate clustering regions, these deformation clustering regions can be divided into two categories: the first category is regions that do not overlap with other deformation clustering regions at all; the second category is regions that overlap with other deformation clustering regions.
[0059] For the first type of deformation clustering regions, these deformation clustering regions cannot be used as target clustering regions, and can be directly discarded; for the second type of deformation clustering regions, these deformation clustering regions may or may not be used as target clustering regions.
[0060] For at least two deformation clusters with overlapping regions (i.e., the second type of deformation clusters mentioned in the above embodiments), the proportion of the overlapping region in each deformation cluster can be determined, and the deformation cluster with the largest proportion is taken as the target cluster, while the remaining deformation clusters cannot be taken as the target cluster.
[0061] In this way, the deformation clustering regions can be filtered to control the number of target clustering regions and reduce the complexity of subsequent encryption.
[0062] For example, Figure 2This is a schematic diagram illustrating how to determine the deformation clustering region corresponding to a candidate clustering region, as provided in Embodiment 1 of the present invention. Figure 2 As shown, there are 6 candidate clustering regions, denoted as candidate clustering region 1 to candidate clustering region 6. Based on the maximum horizontal and vertical lengths of each candidate clustering region, the corresponding deformation clustering region is determined, resulting in deformation clustering region 1' to deformation clustering region 6'.
[0063] Figure 3 This is based on the embodiment of the present invention. Figure 2 The diagram shown illustrates how deformation-based clustering regions further define the target clustering regions. (See attached diagram.) Figure 3 As shown, since deformation cluster region 1' does not overlap with other deformation cluster regions, it cannot be used as a target cluster region. For deformation cluster regions 2' and 3', since these two regions overlap, and the proportion of the overlapping region within deformation cluster region 2' is less than the proportion within deformation cluster region 3', deformation cluster region 2' cannot be used as a target cluster region, while deformation cluster region 3' can be used as a target cluster region. For deformation cluster regions 4', 5', and 6', since there are overlapping areas between deformation cluster regions 4' and 5', and between deformation cluster regions 5' and 6', the overlapping area of deformation cluster regions 4' and 5' accounts for a larger proportion within deformation cluster region 4', and the overlapping area of deformation cluster regions 5' and 6' accounts for a larger proportion within deformation cluster region 6'. Therefore, deformation cluster region 5' cannot be used as a target cluster region, while deformation cluster regions 4' and 6' can be used as target cluster regions. Thus, the final target cluster regions are deformation cluster regions 3', 4', and 6'.
[0064] In one embodiment, a target clustering region may also have a sequence number. The sequence number of the target clustering region is determined based on the coordinates of its top-left and bottom-right corners. For example, the target clustering regions are sorted by summing the x-coordinates of their top-left corners, y-coordinates of their top-left corners, x-coordinates of their bottom-right corners, and y-coordinates of their bottom-right corners.
[0065] S130. Encrypt each target clustering region, the second component of the image to be encrypted, and the third component of the image to be encrypted to obtain an intermediate image. The second and third components are the two components other than the first component among the Y, U, and V components.
[0066] In one embodiment, the encryption process in step S130 can be mainly divided into two categories: one is to encrypt each target clustering region; the other is to encrypt the second component and the third component of the image to be encrypted. The intermediate image is obtained by summing all the encryption results.
[0067] Specifically, taking any target clustering region as an example, the method for encrypting the target clustering region can include the following three steps.
[0068] Step c1: Randomly generate the first chaotic system parameters and the first chaotic system initial values corresponding to the target clustering region.
[0069] Step c2: Generate the first chaotic encryption sequence corresponding to the target clustering region based on the parameters of the first chaotic system and the initial value of the first chaotic system.
[0070] Step c3: Encrypt the target clustering region using the first chaotic encryption sequence.
[0071] Since the parameters and initial values of the first chaotic system corresponding to each target clustering region are randomly generated, each target clustering region can be encrypted independently, thereby reducing the correlation between the features of the first component in the image and increasing the difficulty of cracking.
[0072] Specifically, the method for encrypting the second component and the third component of the image to be encrypted can include the following three steps.
[0073] Step d1: Randomly generate the parameters of the second chaotic system and the initial values of the second chaotic system.
[0074] Step d2: Generate the second chaotic encryption sequence based on the parameters of the second chaotic system and the initial value of the second chaotic system.
[0075] Step d3: Use the second chaotic encryption sequence to encrypt the second component and the third component of the image to be encrypted, respectively.
[0076] Since the second and third components of the image to be encrypted are encrypted as a whole, and the chaotic encryption sequence used during encryption is the same, the encryption complexity of the entire image is balanced on the basis of independently encrypting each target clustering region as described above.
[0077] S140. Insert an information area on the intermediate image and write encrypted information in the information area to obtain the encrypted target image. The position of the information area is determined according to the size and association information of the intermediate image. The encrypted information includes the number of target clustering regions, the chaotic encryption key of each target clustering region, the position information of each target clustering region, the chaotic encryption key of the second component of the image to be encrypted, and the chaotic encryption key of the third component of the image to be encrypted.
[0078] In one embodiment, the method of "inserting an information area on the intermediate image and writing encrypted information in the information area" in step S140 may include the following four steps.
[0079] Step e1: Determine the reference position based on the size and associated information of the intermediate image.
[0080] The dimensions of the intermediate image are the same as those of the image to be encrypted and the original image. Since different images differ, and the associated information (which is related to the image to be encrypted) also differs, the reference position is randomized, thus ensuring that the storage location of the encrypted information is also random.
[0081] Optionally, the reference position includes a horizontal coordinate position and a vertical coordinate position. The horizontal coordinate position of the reference position can be determined based on the ratio of the length of the intermediate image to the shooting time of the original image (such as the sum of year, month, day, hour, minute, and second). The vertical coordinate position of the reference position can be determined based on the ratio of the width of the intermediate image to the shooting device ID.
[0082] Step e2: Based on the reference position, insert an information area on the intermediate image, wherein the information area is a row of pixels including the reference position and having the same length as the intermediate image, or the information area is a column of pixels including the reference position and having the same width as the intermediate image.
[0083] When the information area is a row of pixels with the same length as the intermediate image, including the reference position, inserting the information area into the intermediate image can be understood as adding a row of pixels at the horizontal coordinate position of the reference position of the intermediate image, that is, the intermediate image changes from the original P rows of pixels to P+1 rows of pixels.
[0084] Similarly, when the information area is a column of pixels with the same width as the intermediate image, including the reference position, inserting the information area into the intermediate image can be understood as expanding a column of pixels at the vertical coordinate position of the reference position of the intermediate image, that is, the intermediate image changes from the original Q columns of pixels to Q+1 columns of pixels.
[0085] Step e3: Divide the information area into a valid information area and an invalid information area. The valid information area includes several consecutive pixels starting from the pixel at the reference position, and the invalid information area includes all other pixels in the information area except for the valid information area.
[0086] Since not all pixels in the information area are necessarily used to write encrypted information, the area where the pixels that need to be written with encrypted information are located can be called the valid information area, and the area where the pixels that do not need to be written with encrypted information are located can be called the invalid information area.
[0087] In one possible implementation, the effective information area includes 2*(n+1) pixels, where n is the number of target clustering regions.
[0088] Step e4: Write encrypted information into the valid information area, and randomly set the first component, second component, and third component of each pixel in the invalid information area.
[0089] For invalid information areas, the first, second, and third components of each pixel are randomly set.
[0090] Within the effective information region, in one possible implementation, the effective information region includes one first pixel, 2n second pixels, and one third pixel arranged consecutively, where n is the number of target clustering regions. The position of the first pixel is the reference position.
[0091] The method for writing encrypted information within the effective information area specifically includes: setting the first component of the first pixel to the number of target cluster regions, and randomly setting the second and third components of the first pixel; for the target cluster region with index i, setting the first component of the (2i-1)th second pixel to the first chaotic system parameter corresponding to the target cluster region, setting the second and third components of the (2i-1)th second pixel to the left-hand horizontal and vertical coordinates of the target cluster region respectively, setting the first component of the 2ith second pixel to the initial value of the first chaotic system corresponding to the target cluster region, setting the second and third components of the 2ith second pixel to the right-hand horizontal and vertical coordinates of the target cluster region respectively; setting the second and third components of the third pixel to the second chaotic system parameter and the second chaotic system initial value respectively, and randomly setting the first component of the third pixel.
[0092] For example, Figure 4 This is a schematic diagram illustrating how an information area is inserted into an intermediate image and encrypted information is written within that information area, as provided in Embodiment 1 of the present invention. Figure 4As shown, the information area is drawn as an example, consisting of a row of pixels with the same length as the intermediate image, including the reference position. The information area includes valid information and invalid information. Assuming there are 3 target clustering regions, denoted as Target Clustering Region 1, Target Clustering Region 2, and Target Clustering Region 3, the valid information area includes 2*(3+1) = 8 pixels. All pixels in the information area other than those in the valid information area are invalid information.
[0093] For the first pixel, set the first component of the first pixel to 3, and randomly set the second and third components of the first pixel.
[0094] For the first and second second pixels, the encrypted information of the target cluster region with index 1 is stored as follows: the first component of the first second pixel is set as the first chaotic system parameter corresponding to the target cluster region 1; the second and third components of the first second pixel are set as the upper left horizontal and upper left vertical coordinates of the target cluster region 1, respectively; the first component of the second second pixel is set as the initial value of the first chaotic system corresponding to the target cluster region 1; and the second and third components of the second second pixel are set as the lower right horizontal and lower right vertical coordinates of the target cluster region 1, respectively.
[0095] For the 3rd and 4th second pixels, the encrypted information of the target cluster region with index 2 is stored as follows: the first component of the 3rd second pixel is set as the first chaotic system parameter corresponding to the target cluster region 2; the second and third components of the 3rd second pixel are set as the upper left horizontal and upper left vertical coordinates of the target cluster region 2, respectively; the first component of the 4th second pixel is set as the initial value of the first chaotic system corresponding to the target cluster region 2; and the second and third components of the 4th second pixel are set as the lower right horizontal and lower right vertical coordinates of the target cluster region 2, respectively.
[0096] For the 5th and 6th second pixels, the encrypted information of the target cluster region with index 3 is stored as follows: the first component of the 5th second pixel is set as the first chaotic system parameter corresponding to the target cluster region 3; the second and third components of the 5th second pixel are set as the upper left horizontal and upper left vertical coordinates of the target cluster region 3, respectively; the first component of the 6th second pixel is set as the initial value of the first chaotic system corresponding to the target cluster region 3; and the second and third components of the 6th second pixel are set as the lower right horizontal and lower right vertical coordinates of the target cluster region 3, respectively.
[0097] For the third pixel, the second and third components of the third pixel are set as the parameters of the second chaotic system and the initial values of the second chaotic system, respectively, and the first component of the third pixel is randomly set.
[0098] Since the storage location of encrypted information is determined based on the size of the intermediate image and associated information, the randomness of the storage location is achieved, further increasing the difficulty of cracking. This achieves the goal of improving the security of image storage and transmission and preventing information leakage.
[0099] The technical solution of this invention provides a novel image encryption and decryption method. For the image encryption method, the method involves acquiring the image to be encrypted and associated information, and determining at least one target clustering region based on the first component of the image to be encrypted. Then, each target clustering region, the second component of the image to be encrypted, and the third component of the image to be encrypted are encrypted separately to obtain an intermediate image. Finally, an information area is inserted into the intermediate image, and encrypted information is written into the information area to obtain the encrypted target image. On the one hand, since encryption is performed separately for different target clustering regions, the correlation between features of the first component in the image is reduced, increasing the difficulty of cracking. On the other hand, encrypting the second and third components of the image as a whole balances the overall encryption complexity of the image. Furthermore, the storage location of the encrypted information is determined based on the size of the intermediate image and the associated information, achieving randomness in the storage location and further increasing the difficulty of cracking. This achieves the goal of improving the security of image storage and transmission, and preventing information leakage.
[0100] Example 2
[0101] Figure 5 This is a flowchart illustrating an image decryption method according to Embodiment 2 of the present invention. This embodiment is applicable to situations involving image decryption. The method can be executed by an image decryption device, which can be implemented in hardware and / or software and can be configured in an electronic device (such as a computer or server). The electronic device provided by the present invention can simultaneously possess image encryption and image decryption functions; that is, the electronic device can implement both the image encryption method of Embodiment 1 and the image decryption method of Embodiment 2. Figure 5 As shown, the method includes:
[0102] S210. Obtain the image to be decrypted and associated information, and determine the location of the information area based on the size of the image to be decrypted and the associated information.
[0103] The image to be decrypted is any image that needs to be decrypted, such as the encrypted target image mentioned in Example 1 above.
[0104] Since the image to be decrypted is obtained by inserting an information area into the intermediate image, it is necessary to first separate the intermediate image and the information area.
[0105] Specifically, when the information area is a row of pixels with the same length as the intermediate image, the size of the intermediate image P*Q can be determined first based on the size of the image to be decrypted (P+1)*Q; then, the reference position can be determined based on the size of the intermediate image P*Q and the associated information; finally, the row of pixels corresponding to the horizontal coordinate of the reference position is the position of the information area.
[0106] Similarly, when the information area is a column of pixels with the same width as the intermediate image, the size of the intermediate image P*Q can be determined first based on the size of the image to be decrypted P*(Q+1); then, the reference position can be determined based on the size of the intermediate image P*Q and the associated information; finally, the column of pixels corresponding to the vertical coordinate of the reference position is the position of the information area.
[0107] Optionally, the associated information may include the capture time of the original image and the capture device ID. The capture time of the original image can be accurate to the year, month, and day, or to the hour, minute, and second. The capture device ID is an ID obtained by sequentially numbering multiple capture devices. The reference position includes a horizontal coordinate and a vertical coordinate. The horizontal coordinate of the reference position can be determined based on the ratio of the length of the intermediate image to the capture time of the original image (e.g., the sum of the year, month, day, hour, minute, and second); the vertical coordinate of the reference position can be determined based on the ratio of the width of the intermediate image to the capture device ID.
[0108] S220. Based on the location of the information area, read the decryption information stored in the information area, and delete the information area from the image to be decrypted to obtain an intermediate image. The decryption information includes the number of target clustering regions, the chaotic decryption key of each target clustering region, the location information of each target clustering region, the chaotic decryption key of the second component of the intermediate image, and the chaotic decryption key of the third component of the intermediate image. The target clustering region corresponds to the first component of the intermediate image. The first component is any one of the Y component, U component, and V component. The second and third components are the other two components of the Y component, U component, and V component, excluding the first component.
[0109] After determining the location of the information area, the decryption information stored in the information area can be read based on its location, and the information area can be deleted from the image to be decrypted to obtain the intermediate image.
[0110] Specifically, since not all pixels within the information area necessarily store decryption information, we can first read the first component of the reference position (i.e., the first pixel) to obtain the number of target clustering regions, n. Then, we know that the 2n pixels following the first pixel are the second pixels, and the one pixel following the second pixel is the third pixel. Only the first, second, and third pixels store decryption information.
[0111] In one embodiment, the first pixel stores the number of target clustering regions; the second pixel stores the chaotic decryption key of each target clustering region and the position information of each target clustering region; and the third pixel stores the chaotic decryption key of the second component of the intermediate image and the chaotic decryption key of the third component of the intermediate image.
[0112] For 2n second pixels, the method for reading the chaotic decryption key and location information of each target cluster region stored within each second pixel includes: every two pixels in these 2n pixels are used to store the chaotic decryption key and location information of one target cluster region. That is, the first and second second pixels after the first pixel are used to store the chaotic decryption key and location information of the target cluster region with index 1, the third and fourth second pixels after the first pixel are used to store the chaotic decryption key and location information of the target cluster region with index 2, and so on, with the (2n-1)th to 2nth second pixels after the first pixel being used to store the chaotic decryption key and location information of the target cluster region with index n.
[0113] Taking the (2i-1)th to 2ith second pixels after the first pixel as an example, the first component of the (2i-1)th second pixel is the first chaotic system parameter corresponding to the target cluster region with index i. The second and third components of the (2i-1)th second pixel are the upper left horizontal and upper left vertical coordinates of the target cluster region with index i, respectively. The first component of the 2ith second pixel is the initial value of the first chaotic system corresponding to the target cluster region with index i. The second and third components of the 2ith second pixel are the lower right horizontal and lower right vertical coordinates of the target cluster region with index i, respectively.
[0114] For the third pixel, the second component and the third component of the third pixel are the second chaotic system parameters and the second chaotic system initial values, where the second chaotic system parameters and the second chaotic system initial values are the chaotic decryption keys of the second component and the third component of the intermediate image.
[0115] S230. Based on the decryption information, decrypt each target cluster region, the second component of the intermediate image, and the third component of the intermediate image to obtain the decrypted target image, wherein the decrypted target image is an image in YUV format.
[0116] In one embodiment, the decryption process in step S230 can be mainly divided into two categories: one is to decrypt each target cluster region; the other is to decrypt the second component and the third component of the intermediate image. The decrypted target image is obtained by summing all the decryption results.
[0117] Specifically, taking any target clustering region as an example, the method for decrypting the target clustering region may include: generating a first chaotic encryption sequence corresponding to the target clustering region based on the first chaotic system parameters and the initial value of the first chaotic system corresponding to the target clustering region; determining the position of the target clustering region based on the horizontal coordinate of the upper left corner, the vertical coordinate of the upper left corner, the horizontal coordinate of the lower right corner, and the vertical coordinate of the lower right corner; and decrypting the first component of the intermediate image corresponding to the position of the target clustering region using the first chaotic encryption sequence.
[0118] Specifically, the method for decrypting the second component and the third component of the intermediate image may include: generating a second chaotic encryption sequence based on the parameters of the second chaotic system and the initial value of the second chaotic system; and using the second chaotic encryption sequence to decrypt the second component and the third component of the intermediate image respectively.
[0119] Based on the above embodiments, since the decrypted target image is a YUV format image, it is also necessary to convert the format of the decrypted target image to obtain the original RGB format image.
[0120] In one embodiment, the conversion relationship between the decrypted target image and the original image is as follows:
[0121] R = Y + 1.402 * V;
[0122] G = Y - 0.344 * U - 0.714 * V;
[0123] B = Y + 1.772 * U.
[0124] The technical solution of this invention provides a novel image encryption and decryption method. For the image decryption method, the image to be decrypted and associated information are acquired, and the location of the information area is determined based on the size of the image to be decrypted and the associated information. Then, based on the location of the information area, the decryption information stored within the information area is read, and the information area is deleted from the image to be decrypted to obtain an intermediate image. The decryption information includes the number of target clustering regions, a chaotic decryption key for each target clustering region, the location information of each target clustering region, a chaotic decryption key for the second component of the intermediate image, and a chaotic decryption key for the third component of the intermediate image. The target clustering regions correspond to the first component of the intermediate image. Finally, based on the decryption information, each target clustering region, the second component of the intermediate image, and the third component of the intermediate image are decrypted to obtain the decrypted target image. On the one hand, since decryption is performed separately for different target clustering regions, the correlation between features of the first component in the image is reduced, increasing the difficulty of cracking. On the other hand, the second and third components in the image are decrypted as a whole, which balances the overall decryption complexity of the image. In addition, the storage location of the decrypted information is determined according to the size of the image to be decrypted and the associated information, realizing the randomness of the storage location, further increasing the difficulty of cracking, thereby achieving the goal of improving the security of image storage and transmission and avoiding information leakage.
[0125] Example 3
[0126] Figure 6 This is a schematic diagram of the structure of an image encryption device provided in Embodiment 3 of the present invention. Figure 6 As shown, the device includes: an acquisition module 601, a clustering module 602, a chaotic encryption module 603, and an information insertion module 604.
[0127] The acquisition module 601 is used to acquire the image to be encrypted and associated information, wherein the image to be encrypted is an image in YUV format;
[0128] Clustering module 602 is used to determine at least one target clustering region based on a first component of the image to be encrypted, wherein the first component is any one of the Y component, U component, and V component;
[0129] The chaotic encryption module 603 is used to encrypt each target clustering region, the second component of the image to be encrypted, and the third component of the image to be encrypted to obtain an intermediate image. The second and third components are the two components other than the first component among the Y component, U component, and V component.
[0130] The information insertion module 604 is used to insert an information area on the intermediate image and write encrypted information in the information area to obtain an encrypted target image. The position of the information area is determined according to the size and associated information of the intermediate image. The encrypted information includes the number of target clustering regions, the chaotic encryption key of each target clustering region, the position information of each target clustering region, the chaotic encryption key of the second component of the image to be encrypted, and the chaotic encryption key of the third component of the image to be encrypted.
[0131] Optionally, the acquisition module 601 is specifically used to receive the original image sent by the shooting device, the shooting time of the original image, and the shooting device ID, wherein the original image is an RGB format image; convert the original image into an image to be encrypted, and use the shooting time of the original image and the shooting device ID as associated information.
[0132] Optionally, the clustering module 602 is specifically used to cluster the first component of the image to be encrypted to obtain several candidate clustering regions; based on the maximum horizontal length and maximum vertical length of each candidate clustering region, the deformation clustering region corresponding to each candidate clustering region is determined, wherein the deformation clustering region is the minimum bounding rectangle region of its corresponding candidate clustering region; for at least two deformation clustering regions with overlapping regions, the proportion of the overlapping region in each deformation clustering region is determined, and the deformation clustering region with the largest proportion is taken as the target clustering region.
[0133] Optionally, the chaotic encryption module 603 is specifically used to randomly generate first chaotic system parameters and first chaotic system initial values corresponding to the target clustering region; generate a first chaotic encryption sequence corresponding to the target clustering region based on the first chaotic system parameters and first chaotic system initial values; encrypt the target clustering region using the first chaotic encryption sequence; and randomly generate second chaotic system parameters and second chaotic system initial values; generate a second chaotic encryption sequence based on the second chaotic system parameters and second chaotic system initial values; and encrypt the second component and the third component of the image to be encrypted using the second chaotic encryption sequence respectively.
[0134] Optionally, the information insertion module 604 is specifically used to determine a reference position based on the size and associated information of the intermediate image; and to insert an information area on the intermediate image based on the reference position, wherein the information area is a row of pixels including the reference position and having the same length as the intermediate image, or the information area is a column of pixels including the reference position and having the same width as the intermediate image.
[0135] Optionally, a target cluster region has a serial number, which is determined based on the coordinates of the top-left corner and the bottom-right corner of the target cluster region.
[0136] The information insertion module 604 is specifically used to divide the information area into a valid information area and an invalid information area. The valid information area includes several consecutive pixels starting from the pixel at the reference position, and the invalid information area includes all other pixels in the information area except for the valid information area. Encrypted information is written into the valid information area, and the first component, second component, and third component of each pixel in the invalid information area are randomly set.
[0137] Optionally, the effective information area includes one first pixel, 2n second pixels, and one third pixel arranged sequentially, where n is the number of target clustering regions.
[0138] The information insertion module 604 is specifically used to set the first component of the first pixel to the number of target cluster regions, and randomly set the second and third components of the first pixel; for the target cluster region with index i, the first component of the (2i-1)th second pixel is set to the first chaotic system parameter corresponding to the target cluster region, the second and third components of the (2i-1)th second pixel are set to the upper left horizontal coordinate and upper left vertical coordinate of the target cluster region respectively, the first component of the 2ith second pixel is set to the initial value of the first chaotic system corresponding to the target cluster region, the second and third components of the 2ith second pixel are set to the lower right horizontal coordinate and lower right vertical coordinate of the target cluster region respectively; the second and third components of the third pixel are set to the second chaotic system parameter and the second chaotic system initial value respectively, and the first component of the third pixel is randomly set.
[0139] The image encryption device provided in the embodiments of the present invention can execute the image encryption method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of executing the method.
[0140] Example 4
[0141] Figure 7 This is a schematic diagram of the structure of an image decryption device provided in Embodiment 4 of the present invention. Figure 7 As shown, the device includes: a determination module 701, an information acquisition module 702, and a chaos decryption module 703.
[0142] The determination module 701 is used to acquire the image to be decrypted and associated information, and determine the location of the information area based on the size of the image to be decrypted and the associated information;
[0143] The information acquisition module 702 is used to read the decryption information stored in the information area according to the position of the information area, and delete the information area from the image to be decrypted to obtain an intermediate image. The decryption information includes the number of target clustering regions, the chaotic decryption key of each target clustering region, the position information of each target clustering region, the chaotic decryption key of the second component of the intermediate image, and the chaotic decryption key of the third component of the intermediate image. The target clustering region corresponds to the first component of the intermediate image. The first component is any one of the Y component, U component, and V component. The second and third components are the other two components of the Y component, U component, and V component except for the first component.
[0144] The chaotic decryption module 703 is used to decrypt each target clustering region, the second component of the intermediate image, and the third component of the intermediate image according to the decryption information, so as to obtain the decrypted target image, wherein the decrypted target image is an image in YUV format.
[0145] The image decryption device provided in the embodiments of the present invention can execute the image decryption method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of executing the method.
[0146] Example 5
[0147] Figure 8 A schematic diagram of an electronic device 10 that can be used to implement embodiments of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.
[0148] like Figure 8As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 may also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0149] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0150] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as image encryption methods or image decryption methods.
[0151] In some embodiments, the image encryption method or image decryption method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the image encryption method or image decryption method described above may be performed. Alternatively, in other embodiments, processor 11 may be configured to perform the image encryption method or image decryption method by any other suitable means (e.g., by means of firmware).
[0152] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0153] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0154] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0155] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0156] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or computing systems that include middleware components (e.g., application servers), or computing systems that include frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.
[0157] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.
[0158] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.
[0159] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. An image encryption method, characterized in that, include: Obtain the image to be encrypted and associated information, wherein the image to be encrypted is an image in YUV format; Based on the first component of the image to be encrypted, at least one target clustering region is determined, wherein the first component is any one of the Y component, U component, and V component; Each of the target clustering regions, the second component of the image to be encrypted, and the third component of the image to be encrypted are encrypted to obtain an intermediate image, wherein the second component and the third component are two other components besides the first component among the Y component, U component, and V component. An information area is inserted into the intermediate image, and encrypted information is written into the information area to obtain an encrypted target image. The position of the information area is determined according to the size of the intermediate image and the associated information. The encrypted information includes the number of target clustering regions, the chaotic encryption key of each target clustering region, the position information of each target clustering region, the chaotic encryption key of the second component of the image to be encrypted, and the chaotic encryption key of the third component of the image to be encrypted.
2. The image encryption method according to claim 1, characterized in that, Obtain the image to be encrypted and associated information, including: Receive the original image sent by the shooting device, the shooting time of the original image, and the shooting device identification ID, wherein the original image is an image in RGB format; The original image is converted into the image to be encrypted, and the shooting time of the original image and the shooting device ID are used as the associated information.
3. The image encryption method according to claim 1, characterized in that, Based on the first component of the image to be encrypted, at least one target clustering region is determined, including: Clustering is performed on the first component of the image to be encrypted to obtain several candidate clustering regions; Based on the maximum horizontal and vertical lengths of each candidate cluster region, a deformation cluster region is determined for each candidate cluster region, wherein the deformation cluster region is the minimum bounding rectangle region of the corresponding candidate cluster region. For at least two deformation clusters with overlapping regions, the proportion of the overlapping region in each deformation cluster is determined, and the deformation cluster with the largest proportion is taken as the target cluster.
4. The image encryption method according to claim 1, characterized in that, For any one of the target clustering regions, the target clustering region is encrypted, including: Randomly generate the first chaotic system parameters and the first chaotic system initial value corresponding to the target clustering region; Based on the first chaotic system parameters and the first chaotic system initial value, a first chaotic encryption sequence corresponding to the target clustering region is generated; The target clustering region is encrypted using the first chaotic encryption sequence; Encrypting the second component and the third component of the image to be encrypted includes: Randomly generate the parameters of the second chaotic system and the initial values of the second chaotic system; A second chaotic encryption sequence is generated based on the parameters of the second chaotic system and the initial value of the second chaotic system. The second chaotic encryption sequence is used to encrypt the second component and the third component of the image to be encrypted, respectively.
5. The image encryption method according to claim 4, characterized in that, An information area is inserted on the intermediate image, including: The reference position is determined based on the size of the intermediate image and the associated information; Based on the reference position, the information area is inserted on the intermediate image, wherein the information area is a row of pixels including the reference position and having the same length as the intermediate image, or the information area is a column of pixels including the reference position and having the same width as the intermediate image.
6. The image encryption method according to claim 5, characterized in that, Each target cluster region has a serial number, which is determined based on the coordinates of the top-left corner and the bottom-right corner of the target cluster region. Encrypted information is written into the information area, including: The information area is divided into a valid information area and an invalid information area. The valid information area includes a number of consecutive pixels starting from the pixel at the reference position, and the invalid information area includes all other pixels in the information area except for the valid information area. The encrypted information is written into the valid information area, and the first component, second component, and third component of each pixel in the invalid information area are randomly set.
7. The image encryption method according to claim 6, characterized in that, The effective information area includes one first pixel, 2n second pixels, and one third pixel arranged in sequence, where n is the number of the target clustering regions; Writing the encrypted information into the valid information area includes: The first component of the first pixel is set as the number of target clustering regions, and the second and third components of the first pixel are randomly set. For the target clustering region with index i, the first component of the (2i-1)th second pixel is set as the first chaotic system parameter corresponding to the target clustering region; the second and third components of the (2i-1)th second pixel are set as the upper left horizontal coordinate and upper left vertical coordinate of the target clustering region, respectively; the first component of the 2ith second pixel is set as the initial value of the first chaotic system corresponding to the target clustering region; and the second and third components of the 2ith second pixel are set as the lower right horizontal coordinate and lower right vertical coordinate of the target clustering region, respectively. The second and third components of the third pixel are set as the parameters of the second chaotic system and the initial value of the second chaotic system, respectively, and the first component of the third pixel is randomly set.
8. An image decryption method, characterized in that, include: Obtain the image to be decrypted and associated information, and determine the location of the information area based on the size of the image to be decrypted and the associated information; Based on the location of the information area, the decryption information stored in the information area is read, and the information area is deleted from the image to be decrypted to obtain an intermediate image. The decryption information includes the number of target clustering regions, the chaotic decryption key of each target clustering region, the location information of each target clustering region, the chaotic decryption key of the second component of the intermediate image, and the chaotic decryption key of the third component of the intermediate image. The target clustering region corresponds to the first component of the intermediate image. The first component is any one of the Y component, U component, and V component. The second and third components are the other two components of the Y component, U component, and V component, excluding the first component. Based on the decryption information, each target cluster region, the second component of the intermediate image, and the third component of the intermediate image are decrypted to obtain the decrypted target image, wherein the decrypted target image is an image in YUV format.
9. An electronic device, characterized in that, The electronic device includes: At least one processor; and a memory communicatively connected to said at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-8.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that cause a processor to execute the method of any one of claims 1-8.
Citation Information
Patent Citations
An image encryption method based on FCM clustering
CN109712204A
Picture encryption method and device, electronic equipment and storage medium
CN115174758A