Image processing method and device, storage medium and electronic device

CN116226887BActive Publication Date: 2026-09-29INDUSTRIAL AND COMMERCIAL BANK OF CHINA
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310297439.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-23
Publication Date
2026-09-29
Estimated Expiration
2043-03-23

AI Technical Summary

Technical Problem

[0004]本申请提供一种图像的处理方法、装置、存储介质以及电子设备,以解决相关技术中对图像使用复杂的加密算法进行加密,导致解密效率低并且解密后图像失真的问题

Benefits of technology

[0016]根据本发明实施例的另一方面,还提供了一种电子设备,包含一个或多个处理器和存储器;存储器中存储有计算机可读指令,处理器用于运行计算机可读指令,其中,计算机可读指令运行时执行一种图像的处理方法。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116226887B_ABST
    Figure CN116226887B_ABST
Patent Text Reader

Abstract

The application discloses a kind of processing method, device, storage medium and electronic equipment of image.It relates to information security field.The method comprises: obtaining target image to be encrypted, and the target image is carried out image degradation processing, and the low resolution target image is obtained;Obtain the first matrix representing the low resolution target image;The first matrix is reconstructed to obtain the second matrix, and the random matrix is generated according to the second matrix;Second matrix and random matrix are operated according to bit XOR, and the encryption matrix is obtained, and the random matrix is encrypted by preset encryption algorithm, and the encryption information is obtained;According to encryption matrix and encryption information, the encryption result of target image is obtained.Through the present application, the problem that the image is encrypted using complex encryption algorithm in the related art, resulting in low decryption efficiency and image distortion after decryption is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of information security, and more specifically, to an image processing method, apparatus, storage medium, and electronic device. Background Technology

[0002] Image encryption and decryption not only require effective hiding and encryption of the image, but also restoration with almost no loss of detail or distortion. Existing image encryption technologies typically employ complex encryption algorithms to ensure undistorted images, which not only increases computational complexity and significantly reduces decryption efficiency, but also introduces distortion.

[0003] There is currently no effective solution to the problem that using complex encryption algorithms to encrypt images in related technologies leads to low decryption efficiency and image distortion after decryption. Summary of the Invention

[0004] This application provides an image processing method, apparatus, storage medium, and electronic device to solve the problem in related technologies where the use of complex encryption algorithms to encrypt images results in low decryption efficiency and image distortion after decryption.

[0005] According to one aspect of this application, an image processing method is provided. The method includes: acquiring a target image to be encrypted, and performing image degradation processing on the target image to obtain a low-resolution target image; acquiring a first matrix representing the low-resolution target image; reconstructing the first matrix to obtain a second matrix, and generating a random matrix based on the second matrix, wherein the second matrix and the random matrix are one-dimensional matrices, and the second matrix and the random matrix have the same number of elements; performing a bitwise XOR operation on the second matrix and the random matrix to obtain an encryption matrix; encrypting the random matrix using a preset encryption algorithm to obtain encrypted information; and obtaining an encryption result for the target image based on the encryption matrix and the encrypted information.

[0006] Optionally, performing image degradation processing on the target image to obtain a low-resolution target image includes: blurring the target image to obtain a first blurred image; performing an image downsampling operation on the first blurred image to obtain a second blurred image; and adding noise to the second blurred image to obtain a low-resolution target image.

[0007] Optionally, reconstructing the first matrix to obtain the second matrix includes: dividing the first matrix into M columns to obtain an M-column matrix; and concatenating the M-column matrix by their indices to obtain the second matrix.

[0008] Optionally, generating a random matrix based on the second matrix includes: determining random initial values ​​and random parameters, and inputting the random initial values ​​and random parameters into a chaotic mapping algorithm to obtain updated random initial values; using the updated random initial values ​​as the first element in the initial matrix, and repeating the steps of inputting random initial values ​​and random parameters into the chaotic mapping algorithm to obtain updated random initial values, and using the updated random initial values ​​as the first element in the initial matrix, until the number of elements in the initial matrix is ​​the same as the number of elements in the second matrix; when the number of elements in the initial matrix is ​​the same as the number of elements in the second matrix, the initial matrix is ​​determined as a candidate matrix, and each element in the candidate matrix is ​​normalized to obtain a random matrix.

[0009] Optionally, encrypting the random matrix using a preset encryption algorithm to obtain encrypted information includes: encrypting the random initial value and random parameters using a preset encryption algorithm to obtain first information; and combining the first information with a chaotic mapping algorithm to obtain encrypted information.

[0010] Optionally, obtaining the first matrix representing the low-resolution target image includes: identifying the gray value of each pixel in the low-resolution target image to obtain multiple gray values; combining the multiple gray values ​​into a first matrix according to the position information of the pixel corresponding to each gray value, wherein the position information of each gray value in the first matrix is ​​the same as the position information of the pixel corresponding to the gray value in the low-resolution target image.

[0011] Optionally, after obtaining the encryption result of the target image based on the encryption matrix and the encryption information, the method further includes: decrypting the encryption information using a preset decryption algorithm to obtain a random matrix, wherein the preset decryption algorithm is associated with a preset encryption algorithm; decrypting the encryption matrix using the random matrix to obtain a first matrix; and restoring the first matrix using a preset mapping relationship matrix to obtain the decrypted target image.

[0012] Optionally, before recovering the first matrix through a preset mapping matrix to obtain the decrypted target image, the method further includes: acquiring M high-resolution sample images and performing image degradation processing on each high-resolution sample image to obtain M low-resolution sample images; grouping the high-resolution sample images and low-resolution sample images that have a corresponding relationship into a group to obtain M groups of sample images, and training the deep learning model using the M groups of sample images to obtain a preset mapping matrix, wherein the preset mapping matrix represents the mapping relationship between a group of high-resolution sample images and low-resolution sample images.

[0013] Optionally, after recovering the first matrix through a preset mapping matrix to obtain the decrypted target image, the method further includes: generating a third matrix representing the decrypted target image, and recovering the third matrix through the preset mapping matrix to obtain a high-resolution target image.

[0014] According to another aspect of this application, an image processing apparatus is provided. The apparatus includes: a first acquisition unit, configured to acquire a target image to be encrypted and perform image degradation processing on the target image to obtain a low-resolution target image; a second acquisition unit, configured to acquire a first matrix representing the low-resolution target image; a first generation unit, configured to reconstruct the first matrix to obtain a second matrix and generate a random matrix based on the second matrix, wherein the second matrix and the random matrix are one-dimensional matrices and have the same number of elements; a first encryption unit, configured to perform a bitwise XOR operation on the second matrix and the random matrix to obtain an encryption matrix, and encrypt the random matrix using a preset encryption algorithm to obtain encrypted information; and a second generation unit, configured to obtain an encryption result for the target image based on the encryption matrix and the encrypted information.

[0015] According to another aspect of the present invention, a computer storage medium is also provided for storing a program, wherein the program, when running, controls the device where the computer storage medium is located to execute an image processing method.

[0016] According to another aspect of the present invention, an electronic device is also provided, comprising one or more processors and a memory; the memory stores computer-readable instructions, and the processor is configured to execute the computer-readable instructions, wherein the computer-readable instructions, when executed, perform an image processing method.

[0017] This application employs the following steps: acquiring the target image to be encrypted and performing image degradation processing on the target image to obtain a low-resolution target image; acquiring a first matrix representing the low-resolution target image; reconstructing the first matrix to obtain a second matrix, and generating a random matrix based on the second matrix, wherein the second matrix and the random matrix are one-dimensional matrices with the same number of elements; performing a bitwise XOR operation on the second matrix and the random matrix to obtain an encryption matrix; encrypting the random matrix using a preset encryption algorithm to obtain encrypted information; and obtaining the encryption result of the target image based on the encryption matrix and the encrypted information. This solves the problem in related technologies where complex encryption algorithms are used to encrypt images, resulting in low decryption efficiency and image distortion after decryption. By encrypting the matrix corresponding to the image using a random matrix, and then encrypting the random matrix using a preset encryption method, the complexity of image encryption is reduced while maintaining the image encryption effect. Furthermore, the encryption complexity is added to the encryption of the random matrix, achieving the effect of reducing the complexity of image encryption and improving encryption efficiency while maintaining the original confidentiality effect, without causing image distortion. Attached Figure Description

[0018] The accompanying drawings, which form part of this application, are used to provide a further understanding of this application. The illustrative embodiments and descriptions of this application are used to explain this application and do not constitute an undue limitation of this application. In the drawings:

[0019] Figure 1 This is a flowchart of an image processing method provided according to an embodiment of this application;

[0020] Figure 2 This is a schematic diagram of an optional target image provided according to an embodiment of this application;

[0021] Figure 3 This is a flowchart of the degradation process provided according to the embodiments of this application;

[0022] Figure 4 This is a schematic diagram of an optional model training process provided according to an embodiment of this application;

[0023] Figure 5 This is a schematic diagram of an image processing apparatus provided according to an embodiment of this application;

[0024] Figure 6 This is a schematic diagram of an electronic device provided according to an embodiment of this application. Detailed Implementation

[0025] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.

[0026] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.

[0027] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application 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 for the embodiments of this application described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover 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 steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0028] It should be noted that all information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for display, data used for analysis, etc.) involved in this disclosure are information and data authorized by the user or fully authorized by all parties. For example, this system has an interface with relevant users or organizations. Before obtaining relevant information, it is necessary to send an acquisition request to the aforementioned user or organization through the interface, and obtain the relevant information after receiving consent information from the aforementioned user or organization.

[0029] It should be noted that the image processing methods, apparatus, storage media, and electronic devices defined in this disclosure can be used in the field of information security, or in any field other than information security. The application fields of the image processing methods, apparatus, storage media, and electronic devices defined in this disclosure are not limited.

[0030] According to embodiments of this application, an image processing method is provided.

[0031] Figure 1 This is a flowchart of an image processing method provided according to an embodiment of this application. For example... Figure 1 As shown, the method includes the following steps:

[0032] Step S101: Obtain the target image to be encrypted and perform image degradation processing on the target image to obtain a low-resolution target image.

[0033] Specifically, after obtaining the target image that needs to be encrypted, the target image can first be degraded to a lower resolution.

[0034] For example, the grayscale value of each pixel in the target image can be adjusted to reduce the resolution of the target image.

[0035] Step S102: Obtain the first matrix representing the low-resolution target image.

[0036] Specifically, since the target image can be viewed as an image composed of multiple pixels, the gray value of each pixel in the target image can be determined. Since the gray value range is [0, 256], the matrix of the target image can be generated from multiple gray values ​​and the position of each gray value.

[0037] Figure 2 This is a schematic diagram of an optional target image provided according to an embodiment of this application, such as... Figure 2 As shown, when the target image consists of 9 pixels, the grayscale value of each pixel can be determined, and thus matrix 1, representing the target image, can be obtained based on the grayscale values:

[0038]

[0039] Step S103: Reconstruct the first matrix to obtain the second matrix, and generate a random matrix based on the second matrix. The second matrix and the random matrix are one-dimensional matrices, and the number of elements in the second matrix and the random matrix are the same.

[0040] Specifically, after obtaining the first matrix, it can be reconstructed. For example, the matrix can be expanded row by row and then joined together to obtain the reconstructed matrix, which is the second matrix [25, 60, 25, 60, 100, 60, 25, 100, 25].

[0041] Furthermore, after obtaining the second matrix, the length of the second matrix, that is, the number of elements in the second matrix, can be determined. After obtaining the number of elements, a random matrix can be generated. The structure of the random matrix is ​​the same as that of the second matrix, the number of elements is also the same as that of the second matrix, and the element values ​​are all random values.

[0042] Step S104: Perform a bitwise XOR operation on the second matrix and the random matrix to obtain the encryption matrix. Then, encrypt the random matrix using a preset encryption algorithm to obtain the encrypted information.

[0043] Specifically, after obtaining the second matrix and the random matrix, the two matrices can be XORed bitwise to obtain the encrypted matrix after encrypting the second matrix.

[0044] The formula for bitwise XOR operation is shown in Formula 1:

[0045] D(i)=bitxor(x'(i),C(i)) (1)

[0046] Here, x'(i) is the i-th element in the random matrix, and C(i) is the i-th element in the second matrix. The function bitxor performs an XOR operation on x'(i) and C(i), returning D(i). Thus, an encryption matrix can be composed of multiple D(i). Furthermore, due to the properties of XOR, applying the same XOR operation twice to a given value will restore it to its original value. Therefore, the second matrix can be restored by using the random matrix and the encryption matrix for calculation.

[0047] Furthermore, after obtaining the encryption matrix, the random matrix can be encrypted to obtain encrypted information. The RSA encryption algorithm can be used to encrypt the random matrix with a public key to obtain encrypted information. Thus, during information transmission, the image can be protected while the random matrix used for decryption can also be protected.

[0048] Step S105: Based on the encryption matrix and encryption information, the encryption result of the target image is obtained.

[0049] Specifically, after obtaining the encryption matrix and encryption information, the encryption matrix and encryption information can be transmitted as the encryption result, thereby completing the encrypted transmission operation of the image.

[0050] The image processing method provided in this application involves acquiring a target image to be encrypted and performing image degradation processing on the target image to obtain a low-resolution target image; acquiring a first matrix representing the low-resolution target image; reconstructing the first matrix to obtain a second matrix, and generating a random matrix based on the second matrix, wherein the second matrix and the random matrix are one-dimensional matrices with the same number of elements; performing a bitwise XOR operation on the second matrix and the random matrix to obtain an encryption matrix; encrypting the random matrix using a preset encryption algorithm to obtain encrypted information; and obtaining the encryption result of the target image based on the encryption matrix and the encrypted information. This solves the problem in related technologies where complex encryption algorithms are used to encrypt images, resulting in low decryption efficiency and image distortion after decryption. By encrypting the matrix corresponding to the image using a random matrix, and then encrypting the random matrix using a preset encryption method, the complexity of image encryption is reduced while ensuring the image encryption effect. Furthermore, the encryption complexity is added to the encryption of the random matrix, achieving the effect of reducing the complexity of image encryption and improving encryption efficiency while maintaining the original confidentiality effect, and without causing image distortion.

[0051] Optionally, in the image processing method provided in the embodiments of this application, the process of degrading the target image to obtain a low-resolution target image includes: blurring the target image to obtain a first blurred image; performing an image downsampling operation on the first blurred image to obtain a second blurred image; and adding noise to the second blurred image to obtain a low-resolution target image.

[0052] It should be noted that image degradation refers to blurring a real high-resolution image in advance to obtain a low-resolution version of the high-resolution image.

[0053] Specifically, Figure 3 This is a flowchart of the degradation process provided according to the embodiments of this application, such as... Figure 3 As shown, when performing image degradation processing, operations such as blurring, downsampling, and noise reduction can be used. Blur processing is simulated by two convolutions (isotropic and anisotropic Gaussian blur), downsampling is randomly selected from nearest neighbor, bilinear, and bicubic interpolation, and noise is generated by Gaussian noise of different noise levels and image compression of different compression qualities.

[0054] The degradation process formula is shown in Formula 2:

[0055]

[0056] in I represents a low-resolution image, k represents a high-resolution image, n represents Gaussian noise, and ↓ s Indicates a downsampling factor of s. This represents the convolution operation.

[0057] Optionally, in the image processing method provided in the embodiments of this application, reconstructing the first matrix to obtain the second matrix includes: dividing the first matrix according to columns to obtain an M-column matrix; and concatenating the M-column matrix end to end according to the matrix index to obtain the second matrix.

[0058] Specifically, when reconstructing a matrix, it can be divided by column. For example, after dividing the matrix 1 above by column, we get three matrices [25, 60, 25], [60, 100, 100], and [25, 60, 25]. By connecting the three matrices end to end, we get the reconstructed matrix [25, 60, 25, 60, 100, 100, 25, 60, 25], thus obtaining the second matrix.

[0059] Optionally, in the image processing method provided in this application embodiment, generating a random matrix based on the second matrix includes: determining a random initial value and random parameters, and inputting the random initial value and random parameters into a chaotic mapping algorithm to obtain an updated random initial value; using the updated random initial value as the first element in the initial matrix, and using the updated random initial value as the updated random initial value, repeatedly executing the steps of inputting the random initial value and random parameters into the chaotic mapping algorithm to obtain an updated random initial value, and using the updated random initial value as the first element in the initial matrix, until the number of elements in the initial matrix is ​​the same as the number of elements in the second matrix; when the number of elements in the initial matrix is ​​the same as the number of elements in the second matrix, determining the initial matrix as a candidate matrix, and normalizing each element in the candidate matrix to obtain a random matrix.

[0060] Specifically, chaotic mapping operations can be used to generate random matrices. First, a random initial value X(0) and a random parameter μ need to be set, where 0 < X(0) < 1 and 3.5699456 < μ < 4. After obtaining the random initial value X(0) and the random parameter μ, M×N iterations can be performed through the chaotic mapping of the random initial value X(0) and the random parameter μ to generate a one-dimensional chaotic sequence of size 1×MN, where M is the number of columns of the matrix and N is the number of rows of the matrix.

[0061] It should be noted that the Logistic mapping is a one-dimensional chaotic mapping algorithm, and its formula is as follows:

[0062] X(t+1)=μX(t)[1-X(t)],t=0,1,2,...,n (3)

[0063] Where X(t) is the mapping variable, and the first calculation is performed at t=0, which is the initial random value X(0). μ is a random parameter. When 0<X(0)<1 and 3.5699456<μ<4 are satisfied, the Logistic function is in a chaotic state, that is, it generates an unpredictable and disordered sequence of numbers. For a given initial random value X(0) and random parameter μ, X(1) can be calculated using the initial random value X(0) and random parameter μ during the first calculation. In the next iteration, X(2) can be calculated using X(1) and μ. After iterating M×N times in the above manner, a set of disordered sequences X(1), X(2),...,X(M×N) is generated, and a candidate matrix is ​​generated from this disordered sequence.

[0064] Furthermore, after obtaining the candidate matrix, each element in the candidate matrix can be normalized to obtain a random matrix.

[0065] The specific formula for the normalization operation is shown in Formula 4:

[0066] x'(i)=mod(256*x(i), 256), (i=1,2,...,M×N) (4)

[0067] Where x(i) is the i-th element in the candidate matrix, and x'(i) is the i-th element in the random matrix.

[0068] Optionally, in the image processing method provided in this application embodiment, encrypting the random matrix using a preset encryption algorithm to obtain encrypted information includes: encrypting the random initial value and random parameters using a preset encryption algorithm to obtain first information; and combining the first information with a chaotic mapping algorithm to obtain encrypted information.

[0069] Specifically, in order to improve the encryption effect of the random matrix, the set random initial value and random parameters can be encrypted when encrypting the random matrix. The encrypted first information is then sent together with the chaotic mapping algorithm. This means that the receiver needs to know the calculation method before it can obtain the random matrix from the random initial value and random parameters, thereby improving confidentiality.

[0070] Optionally, in the image processing method provided in the embodiments of this application, obtaining a first matrix representing a low-resolution target image includes: identifying the gray value of each pixel in the low-resolution target image to obtain multiple gray values; combining the multiple gray values ​​into a first matrix according to the position information of the pixel corresponding to each gray value, wherein the position information of each gray value in the first matrix is ​​the same as the position information of the pixel corresponding to the gray value in the low-resolution target image.

[0071] Specifically, since the target image can be viewed as an image composed of multiple pixels, the gray value of each pixel in the target image can be determined. Since the gray value range is [0, 256], the matrix of the target image can be generated from multiple gray values ​​and the position of each gray value.

[0072] Figure 2 This is a schematic diagram of an optional target image provided according to an embodiment of this application, such as... Figure 2 As shown, when the target image consists of 9 pixels, the grayscale value of each pixel can be determined, and thus matrix 1, representing the target image, can be obtained based on the grayscale values:

[0073]

[0074] Optionally, in the image processing method provided in this application embodiment, after obtaining the encryption result of the target image based on the encryption matrix and encryption information, the method further includes: decrypting the encryption information using a preset decryption algorithm to obtain a random matrix, wherein the preset decryption algorithm is associated with a preset encryption algorithm; decrypting the encryption matrix using the random matrix to obtain a first matrix; and restoring the first matrix using a preset mapping relationship matrix to obtain the decrypted target image.

[0075] Specifically, when decrypting the encrypted result, the encrypted information is first decrypted using the RSA private key to obtain the chaotic scrambling parameters, namely the random initial value and random parameters. The random matrix is ​​then reconstructed using the random initial value, random parameters, and chaotic mapping algorithm. After obtaining the random matrix, the random matrix and the encrypted matrix are XORed again to obtain the second matrix. The second matrix is ​​then reconstructed in reverse to obtain the first matrix.

[0076] Furthermore, after obtaining the first matrix, it can be recovered by using a preset mapping relationship matrix to obtain the decrypted target image. That is, the matrix can be recovered by using a preset mapping relationship matrix to obtain the high-resolution target image to be encrypted at the initial moment.

[0077] Optionally, in the image processing method provided in this application embodiment, before recovering the first matrix through a preset mapping relationship matrix to obtain the decrypted target image, the method further includes: acquiring M high-resolution sample images, and performing image degradation processing on each high-resolution sample image to obtain M low-resolution sample images; grouping the high-resolution sample images and low-resolution sample images that have a corresponding relationship into a group to obtain M groups of sample images, and training a deep learning model using the M groups of sample images to obtain a preset mapping relationship matrix, wherein the preset mapping relationship matrix represents the mapping relationship between a group of high-resolution sample images and low-resolution sample images.

[0078] It should be noted that a preset mapping matrix needs to be generated before using it. This preset mapping matrix can be generated using a deep learning algorithm model.

[0079] Specifically, Figure 4 This is a schematic diagram of an optional model training process provided according to an embodiment of this application, such as... Figure 4As shown, when training a deep learning algorithm model, it is first necessary to obtain M high-resolution sample images. Then, each high-resolution sample image is degraded using the degradation method described above to obtain M low-resolution sample images. The high-resolution sample images and their corresponding low-resolution sample images are used as a set of samples to train the model. At this time, a mapping matrix can be generated in the model. This matrix can be used to restore the low-resolution sample images to high-resolution sample images. This mapping matrix is ​​continuously iteratively optimized under the constraint of the mean squared error loss function, so that the low-resolution sample images can be restored to high-resolution sample images through this mapping matrix.

[0080] For example, first, obtain the image to be encrypted, perform a degradation operation on it to obtain a low-resolution image, and use the undegraded image to be encrypted as a high-resolution image; then, combine the low-resolution image with the high-resolution image. Figure 1 Before being fed into the convolutional neural network for learning, a one-to-one correspondence between high-resolution and low-resolution image patches is first extracted. Then, the one-to-one correspondence between the image patches is fed into the convolutional neural network to learn the mapping matrix from low-resolution to high-resolution images, and this mapping matrix is ​​continuously iteratively optimized under the constraint of the mean squared error loss function.

[0081] Furthermore, after degrading the target image, a mapping matrix can be generated through the above steps. Then, the same encryption process is applied to the first matrix, i.e., a bitwise XOR operation is performed after reconstruction to obtain an encrypted mapping matrix. The encrypted mapping matrix and the encrypted matrix are used together as the encryption result. During decryption, the encrypted mapping matrix is ​​decrypted to obtain the mapping matrix. The first matrix is ​​then restored using the mapping matrix to obtain the target image.

[0082] Optionally, in the image processing method provided in the embodiments of this application, after recovering the first matrix through a preset mapping relationship matrix to obtain the decrypted target image, the method further includes: generating a third matrix representing the decrypted target image, and recovering the third matrix through the preset mapping relationship matrix to obtain a high-resolution target image.

[0083] Specifically, after obtaining the mapping matrix, not only can the first matrix be restored using the mapping matrix to obtain the matrix of the target image, but the initial target image matrix can also be restored again using the mapping matrix to obtain a new matrix. The resolution of the image generated by this matrix will be higher than that of the initial target image, thereby achieving the effect of improving the image resolution based on the original target image.

[0084] It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases the steps shown or described may be executed in a different order than that shown here.

[0085] This application also provides an image processing apparatus. It should be noted that the image processing apparatus of this application can be used to execute the image processing method provided in this application. The image processing apparatus provided in this application will be described below.

[0086] Figure 5 This is a schematic diagram of an image processing apparatus provided according to an embodiment of this application. For example... Figure 5 As shown, the device includes: a first acquisition unit 51, a second acquisition unit 52, a first generation unit 53, a first encryption unit 54, and a second generation unit 55.

[0087] The first acquisition unit 51 is used to acquire the target image to be encrypted and perform image degradation processing on the target image to obtain a low-resolution target image.

[0088] The second acquisition unit 52 is used to acquire a first matrix representing the low-resolution target image.

[0089] The first generation unit 53 is used to reconstruct the first matrix to obtain the second matrix, and generate a random matrix based on the second matrix. The second matrix and the random matrix are one-dimensional matrices, and the number of elements in the second matrix and the random matrix are the same.

[0090] The first encryption unit 54 is used to perform a bitwise XOR operation on the second matrix and the random matrix to obtain an encryption matrix, and to encrypt the random matrix using a preset encryption algorithm to obtain encrypted information.

[0091] The second generation unit 55 is used to obtain the encryption result of the target image based on the encryption matrix and encryption information.

[0092] The image processing apparatus provided in this application embodiment acquires a target image to be encrypted by a first acquisition unit 51 and performs image degradation processing on the target image to obtain a low-resolution target image; a second acquisition unit 52 acquires a first matrix representing the low-resolution target image; a first generation unit 53 reconstructs the first matrix to obtain a second matrix and generates a random matrix based on the second matrix, wherein the second matrix and the random matrix are one-dimensional matrices and have the same number of elements; a first encryption unit 54 performs a bitwise XOR operation on the second matrix and the random matrix to obtain an encryption matrix, and encrypts the random matrix using a preset encryption algorithm to obtain encrypted information; a second generation unit 55 obtains the encryption result of the target image based on the encryption matrix and the encrypted information. This solves the problem in related technologies where complex encryption algorithms are used to encrypt images, resulting in low decryption efficiency and image distortion after decryption. By encrypting the matrix corresponding to the image using a random matrix, and then encrypting the random matrix using a preset encryption method, the complexity of image encryption is reduced while ensuring the image encryption effect. The encryption complexity is added to the encryption of the random matrix, thus achieving the effect of reducing the complexity of image encryption and improving encryption efficiency while maintaining the original confidentiality effect, and without causing image distortion.

[0093] Optionally, in the image processing apparatus provided in the embodiments of this application, the first acquisition unit 51 includes: a first processing module, used to blur the target image to obtain a first blurred image; a second processing module, used to perform image downsampling operation on the first blurred image to obtain a second blurred image; and an adding module, used to add noise to the second blurred image to obtain a low-resolution target image.

[0094] Optionally, in the image processing apparatus provided in the embodiments of this application, the first generation unit 53 includes: a segmentation module, used to segment the first matrix according to columns to obtain an M-column matrix; and a connection module, used to connect the M-column matrix end to end according to the matrix index to obtain a second matrix.

[0095] Optionally, in the image processing apparatus provided in this application embodiment, the first generation unit 53 includes: a first determining module, configured to determine a random initial value and random parameters, and input the random initial value and random parameters into a chaotic mapping algorithm to obtain an updated random initial value; an execution module, configured to use the updated random initial value as the first element in the initial matrix, and repeatedly execute the steps of inputting the random initial value and random parameters into the chaotic mapping algorithm to obtain an updated random initial value, and using the updated random initial value as the first element in the initial matrix, until the number of elements in the initial matrix is ​​the same as the number of elements in the second matrix; and a second determining module, configured to determine the initial matrix as a candidate matrix when the number of elements in the initial matrix is ​​the same as the number of elements in the second matrix, and normalize each element in the candidate matrix to obtain a random matrix.

[0096] Optionally, in the image processing apparatus provided in this application embodiment, the first encryption unit 54 includes: an encryption module, used to encrypt a random initial value and random parameters using a preset encryption algorithm to obtain first information; and a first combination module, used to combine the first information with a chaotic mapping algorithm to obtain encrypted information.

[0097] Optionally, in the image processing apparatus provided in the embodiments of this application, the second acquisition unit 52 includes: an identification module, used to identify the gray value of each pixel in the low-resolution target image to obtain multiple gray values; and a second combination module, used to combine the multiple gray values ​​into a first matrix according to the position information of the pixel corresponding to each gray value, wherein the position information of each gray value in the first matrix is ​​the same as the position information of the pixel corresponding to the gray value in the low-resolution target image.

[0098] Optionally, in the image processing apparatus provided in the embodiments of this application, the apparatus further includes: a first decryption unit, configured to decrypt encrypted information using a preset decryption algorithm to obtain a random matrix, wherein the preset decryption algorithm is associated with a preset encryption algorithm; a second decryption unit, configured to decrypt the encryption matrix using the random matrix to obtain a first matrix; and a first recovery unit, configured to recover the first matrix using a preset mapping relationship matrix to obtain a decrypted target image.

[0099] Optionally, in the image processing apparatus provided in the embodiments of this application, the apparatus further includes: a third acquisition unit, configured to acquire M high-resolution sample images and perform image degradation processing on each high-resolution sample image to obtain M low-resolution sample images; and a grouping unit, configured to group the high-resolution sample images and low-resolution sample images that have a corresponding relationship into a group to obtain M groups of sample images, and train a deep learning model using the M groups of sample images to obtain a preset mapping relationship matrix, wherein the preset mapping relationship matrix represents the mapping relationship between a group of high-resolution sample images and low-resolution sample images.

[0100] Optionally, in the image processing apparatus provided in the embodiments of this application, the apparatus further includes: a second recovery unit, used to generate a third matrix representing the decrypted target image, and to recover the third matrix through a preset mapping relationship matrix to obtain a high-resolution target image.

[0101] The image processing device includes a processor and a memory. The first acquisition unit 51, the second acquisition unit 52, the first generation unit 53, the first encryption unit 54, the second generation unit 55, etc., are all stored in the memory as program units. The processor executes the program units stored in the memory to realize the corresponding functions.

[0102] The processor contains a kernel, which retrieves the corresponding program units from memory. One or more kernels can be configured. By adjusting kernel parameters, the problem of low decryption efficiency and image distortion after decryption caused by using complex encryption algorithms to encrypt images in related technologies can be solved.

[0103] The memory may include non-permanent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.

[0104] This invention provides a computer-readable storage medium storing a program that, when executed by a processor, implements the image processing method.

[0105] This invention provides a processor for running a program, wherein the program executes a method for processing the image during runtime.

[0106] like Figure 6As shown, this embodiment of the invention provides an electronic device 60, which includes a processor, a memory, and a program stored in the memory and executable on the processor. When the processor executes the program, it performs the following steps: acquiring a target image to be encrypted and performing image degradation processing on the target image to obtain a low-resolution target image; acquiring a first matrix representing the low-resolution target image; reconstructing the first matrix to obtain a second matrix, and generating a random matrix based on the second matrix, wherein the second matrix and the random matrix are one-dimensional matrices with the same number of elements; performing a bitwise XOR operation on the second matrix and the random matrix to obtain an encryption matrix; encrypting the random matrix using a preset encryption algorithm to obtain encrypted information; and obtaining the encryption result of the target image based on the encryption matrix and the encrypted information. The device in this document can be a server, PC, PAD, mobile phone, etc.

[0107] This application also provides a computer program product, which, when executed on a data processing device, is suitable for executing an initialization program with the following method steps: acquiring a target image to be encrypted, and performing image degradation processing on the target image to obtain a low-resolution target image; acquiring a first matrix representing the low-resolution target image; reconstructing the first matrix to obtain a second matrix, and generating a random matrix based on the second matrix, wherein the second matrix and the random matrix are one-dimensional matrices, and the second matrix and the random matrix have the same number of elements; performing a bitwise XOR operation on the second matrix and the random matrix to obtain an encryption matrix; encrypting the random matrix using a preset encryption algorithm to obtain encrypted information; and obtaining the encryption result of the target image based on the encryption matrix and the encrypted information.

[0108] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0109] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0110] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0111] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0112] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0113] Memory may include non-persistent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.

[0114] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.

[0115] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0116] The above are merely embodiments of this application and are not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.

Claims

1. An image processing method, characterized in that, include: The target image to be encrypted is obtained, and the target image is subjected to image degradation processing to obtain a low-resolution target image; Obtain a first matrix characterizing the low-resolution target image; The first matrix is ​​reconstructed to obtain a second matrix, and a random matrix is ​​generated based on the second matrix, wherein the second matrix and the random matrix are one-dimensional matrices, and the second matrix and the random matrix have the same number of elements; The process of generating a random matrix based on the second matrix includes: determining a random initial value and random parameters, and inputting the random initial value and random parameters into a chaotic mapping algorithm to obtain an updated random initial value; using the updated random initial value as the first element in the initial matrix, and repeating the steps of inputting the random initial value and random parameters into the chaotic mapping algorithm to obtain an updated random initial value, and using the updated random initial value as the first element in the initial matrix, until the number of elements in the initial matrix is ​​the same as the number of elements in the second matrix; when the number of elements in the initial matrix is ​​the same as the number of elements in the second matrix, the initial matrix is ​​determined as a candidate matrix, and each element in the candidate matrix is ​​normalized to obtain the random matrix. Perform a bitwise XOR operation between the second matrix and the random matrix to obtain an encryption matrix. Then, encrypt the random matrix using a preset encryption algorithm to obtain encrypted information. The process of encrypting the random matrix using a preset encryption algorithm to obtain encrypted information includes: encrypting the random initial value and the random parameters using the preset encryption algorithm to obtain first information; and combining the first information with the chaotic mapping algorithm to obtain the encrypted information. Based on the encryption matrix and the encryption information, the encryption result of the target image is obtained.

2. The method according to claim 1, characterized in that, The target image is subjected to image degradation processing to obtain a low-resolution target image, including: The target image is blurred to obtain a first blurred image; The first blurred image is downsampled to obtain the second blurred image; Noise is added to the second blurred image to obtain the low-resolution target image.

3. The method according to claim 1, characterized in that, Reconstructing the first matrix yields the second matrix, which includes: The first matrix is ​​divided into columns to obtain an M-column matrix; The M columns of matrices are concatenated end-to-end according to their indexes to obtain the second matrix.

4. The method according to claim 1, characterized in that, Obtaining the first matrix characterizing the low-resolution target image includes: Identify the grayscale value of each pixel in the low-resolution target image to obtain multiple grayscale values; The multiple gray values ​​are combined into the first matrix according to the position information of the pixel corresponding to each gray value, wherein the position information of each gray value in the first matrix is ​​the same as the position information of the pixel corresponding to the gray value in the low-resolution target image.

5. The method according to claim 1, characterized in that, After obtaining the encryption result of the target image based on the encryption matrix and the encryption information, the method further includes: The encrypted information is decrypted using a preset decryption algorithm to obtain the random matrix, wherein the preset decryption algorithm is associated with the preset encryption algorithm; The first matrix is ​​obtained by decrypting the encryption matrix using the random matrix. The first matrix is ​​recovered using a preset mapping matrix to obtain the decrypted target image.

6. The method according to claim 5, characterized in that, Before recovering the first matrix using a preset mapping matrix to obtain the decrypted target image, the method further includes: Obtain M high-resolution sample images, and perform image degradation processing on each high-resolution sample image to obtain M low-resolution sample images; High-resolution sample images and low-resolution sample images that have a corresponding relationship are grouped into M groups of sample images. The deep learning model is trained using the M groups of sample images to obtain the preset mapping relationship matrix, wherein the preset mapping relationship matrix represents the mapping relationship between a group of high-resolution sample images and low-resolution sample images.

7. The method according to claim 5, characterized in that, After recovering the first matrix using a preset mapping matrix to obtain the decrypted target image, the method further includes: A third matrix representing the decrypted target image is generated, and the third matrix is ​​restored using the preset mapping relationship matrix to obtain a high-resolution target image.

8. An image processing apparatus, characterized in that, include: The first acquisition unit is used to acquire the target image to be encrypted and perform image degradation processing on the target image to obtain a low-resolution target image. The second acquisition unit is used to acquire a first matrix characterizing the low-resolution target image; The first generation unit is used to reconstruct the first matrix to obtain a second matrix, and generate a random matrix based on the second matrix, wherein the second matrix and the random matrix are one-dimensional matrices, and the second matrix and the random matrix have the same number of elements. The first generation unit includes: a first determining module, configured to determine a random initial value and random parameters, and input the random initial value and random parameters into a chaotic mapping algorithm to obtain an updated random initial value; an execution module, configured to use the updated random initial value as the first element in an initial matrix, and repeatedly execute the steps of inputting the random initial value and random parameters into the chaotic mapping algorithm to obtain an updated random initial value, and using the updated random initial value as the first element in the initial matrix, until the number of elements in the initial matrix is ​​the same as the number of elements in the second matrix; and a second determining module, configured to determine the initial matrix as a candidate matrix when the number of elements in the initial matrix is ​​the same as the number of elements in the second matrix, and normalize each element in the candidate matrix to obtain the random matrix. The first encryption unit is used to perform a bitwise XOR operation on the second matrix and the random matrix to obtain an encryption matrix, and to encrypt the random matrix using a preset encryption algorithm to obtain encrypted information. The first encryption unit includes: an encryption module, used to encrypt the random initial value and the random parameter using the preset encryption algorithm to obtain first information; and a first combination module, used to combine the first information with the chaotic mapping algorithm to obtain the encrypted information. The second generation unit is used to obtain the encryption result of the target image based on the encryption matrix and the encryption information.

9. A computer storage medium, characterized in that, The computer storage medium is used to store a program, wherein the program, when running, controls the device where the computer storage medium is located to execute the image processing method according to any one of claims 1 to 7.

10. An electronic device, characterized in that, It includes one or more processors and a memory, the memory being used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors cause the one or more processors to implement the image processing method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Method and apparatus for super-resolution reconstruction of remote sensing images based on mixed random downsampling

    CN109360148A

  • Image encryption method and device based on novel two-dimensional composite chaotic mapping and SHA-256

    CN113538203A