Disclosure of Invention
An object of the embodiments of the present application is to provide an image processing method, an image processing apparatus, an image processing device, and a storage medium, which are used to improve security of image encryption.
In a first aspect, an image processing method provided in an embodiment of the present application includes: determining a quaternion matrix corresponding to each frame of image in a plurality of frames of images, wherein the plurality of frames of images comprise a first frame of image and a second frame of image; processing the quaternion matrix corresponding to the first frame image to obtain a first amplitude and a first phase of the first frame image; processing the quaternion matrix corresponding to the second frame image to obtain a second amplitude and a second phase corresponding to the second frame image; and taking the first amplitude and the second amplitude as ciphertexts of the multi-frame images, and generating a key of the multi-frame images according to the first phase and the second phase.
In the implementation process, the first amplitude, the first phase, the second amplitude and the second phase are quickly determined, and the key of the multi-frame image is generated according to the first phase and the second phase, so that the encrypted image is higher in security.
With reference to the first aspect, an embodiment of the present application provides a first possible implementation manner of the first aspect, where the processing the quaternion matrix corresponding to the first frame image to obtain a first amplitude and a first phase of the first frame image includes: determining a first real matrix corresponding to the first frame image after the quaternion matrix corresponding to the first frame image is processed; determining a first complex matrix corresponding to the first frame of image according to the first real matrix; carrying out block processing on the first complex matrix to obtain a first new complex matrix; and performing phase truncation coding and amplitude truncation coding on the first new complex matrix to obtain a first amplitude and a first phase of the first frame image.
In the implementation process, the complex matrix is subjected to blocking-parameter conversion, so that a time-consuming iterative process is avoided, higher efficiency is achieved, and processing time can be saved.
With reference to the first possible implementation manner of the first aspect, an embodiment of the present application provides a second possible implementation manner of the first aspect, where the determining a first real matrix corresponding to the first frame image after the quaternion matrix processing includes: carrying out transform domain modulation on the quaternion matrix corresponding to the first frame image to obtain a transformed quaternion matrix; extracting a first component, a second component, a third component and a fourth component of the transformed quaternion matrix; and determining a first real matrix corresponding to the first frame image according to the first component, the second component, the third component and the fourth component.
with reference to the second possible implementation manner of the first aspect, an embodiment of the present application provides a third possible implementation manner of the first aspect, where determining a first real matrix corresponding to the first frame image according to the first component, the second component, the third component, and the fourth component includes: determining a first difference matrix corresponding to the first component and the second component; determining a sum matrix of the second component corresponding to the third component; determining a second difference matrix corresponding to the third component and the fourth component; determining a third difference matrix corresponding to the fourth component and the first component; and combining the first difference matrix, the sum matrix, the second difference matrix and the third difference matrix to obtain a first real matrix corresponding to the first frame of image.
With reference to the third possible implementation manner of the first aspect, an embodiment of the present application provides a fourth possible implementation manner of the first aspect, where the transformed quaternion matrix satisfies: wherein, expressing the quaternion Gyrator transformation with the rotation angle alpha, P expresses a randomly generated phase mask; g1 represents the quaternion matrix corresponding to the first frame image.
With reference to the second possible implementation manner or the third possible implementation manner of the first aspect, an embodiment of the present application provides a fifth possible implementation manner of the first aspect, where a first real matrix corresponding to the first frame image satisfies: wherein S (Q1) represents extracting the first component of Q1; x (Q1) represents the second component of extraction Q1; y (Q1) represents the third component of extracted Q1; z (Q1) represents the fourth component of extracted Q1; q1 represents the transformed quaternion matrix; s (Q1) -X (Q1) represents the first difference matrix; x (Q1) + Y (Q1) represents the sum matrix; y (Q1) -Z (Q1) represents the second difference matrix; z (Q1) -S (Q1) represents the third difference matrix.
With reference to the first possible implementation manner of the first aspect, an embodiment of the present application provides a sixth possible implementation manner of the first aspect, where determining, according to the first real matrix, a first complex matrix corresponding to the first frame image includes: acquiring an initial real number matrix generated randomly; and combining the initial real matrix as a real component and the first real matrix as an imaginary component into a first complex matrix corresponding to the first frame image.
With reference to the sixth possible implementation manner of the first aspect, an embodiment of the present application provides a seventh possible implementation manner of the first aspect, where a first complex matrix corresponding to the first frame image satisfies: g1 ═ R0+ jR 1; wherein R0 represents the initial real matrix; r1 represents the first real matrix; j represents the imaginary part of the quaternion matrix.
With reference to the first possible implementation manner of the first aspect, an embodiment of the present application provides an eighth possible implementation manner of the first aspect, where the performing block processing on the first complex matrix to obtain a first new complex matrix includes: and partitioning the first complex matrix, and performing parameter-containing transformation on each partition to obtain a first new complex matrix.
with reference to the eighth possible implementation manner of the first aspect, an embodiment of the present application provides a ninth possible implementation manner of the first aspect, where the first new complex matrix satisfies: wherein T1 represents the first new complex matrix and the notation T {. cndot } represents a parametric complex transform; g1 denotes the first complex matrix; g11, G12, G21, and G22 denote blocks obtained by blocking the first complex matrix.
With reference to the ninth possible implementation manner of the first aspect, an embodiment of the present application provides a tenth possible implementation manner of the first aspect, where the first amplitude satisfies: h2 ═ PT [ T1 ]; the first phase satisfies: p1 ═ AT [ T1 ]; wherein, the symbols PT [, AT [ ] represent the amplitude and phase of T1 respectively.
With reference to the first aspect, an embodiment of the present application provides an eleventh possible implementation manner of the first aspect, where the processing the quaternion matrix corresponding to the second frame image to obtain a second amplitude and a second phase corresponding to the second frame image includes: determining a second real matrix corresponding to the second frame image after the quaternion matrix corresponding to the second frame image is processed; determining a second complex matrix corresponding to the second frame image according to the first amplitude and the second real matrix; and performing phase truncation coding and amplitude truncation coding on the second complex matrix to obtain a second phase and a second amplitude.
With reference to the eleventh possible implementation manner of the first aspect, an embodiment of the present application provides a twelfth possible implementation manner of the first aspect, where a second complex matrix corresponding to the second frame image satisfies: g2 ═ h2+ iR 2; wherein h2 represents the first amplitude; r2 represents the second matrix of real numbers; i represents the imaginary part of the quaternion matrix.
with reference to the twelfth possible implementation manner of the first aspect, this example provides a thirteenth possible implementation manner of the first aspect, where the second phase satisfies: m1 ═ AT [ G2 ]; wherein G2 represents a second complex matrix corresponding to the second frame image.
With reference to the first aspect, this embodiment provides a fourteenth possible implementation manner of the first aspect, where the generating a key of the multiple frames of images according to the first phase and the second phase includes: determining the result of conjugate transportation of the first phase and the second phase; and using the result as the key of the multi-frame image.
with reference to the fourteenth possible implementation manner of the first aspect, in an embodiment of the present application, there is provided a fifteenth possible implementation manner of the first aspect, where the secret key satisfies: p1, d ═ m1conj (p 1); wherein conj (·) represents the conjugation of m1 and p1, and m1 represents the second phase; p1 represents the first phase.
in a second aspect, an embodiment of the present application provides an image processing apparatus, including: the device comprises a first processing module, a second processing module and a processing module, wherein the first processing module is used for determining a quaternion matrix corresponding to each frame of image in a plurality of frames of images, and the plurality of frames of images comprise a first frame of image and a second frame of image; the second processing module is used for processing the quaternion matrix corresponding to the first frame image to obtain a first amplitude and a first phase of the first frame image; a third processing module, configured to process the quaternion matrix corresponding to the second frame image to obtain a second amplitude and a second phase corresponding to the second frame image; a fourth processing module, configured to determine a key according to the first phase and the second phase; and the encryption module is used for encrypting the multi-frame images by taking the first amplitude and the key as the ciphertext of the multi-frame images.
With reference to the second aspect, an embodiment of the present application provides a first possible implementation manner of the second aspect, and the second processing module is further configured to: determining a first real matrix corresponding to the first frame image after the quaternion matrix corresponding to the first frame image is processed; determining a first complex matrix corresponding to the first frame of image according to the first real matrix; carrying out block processing on the first complex matrix to obtain a first new complex matrix; and performing phase truncation coding and amplitude truncation coding on the first new complex matrix to obtain a first amplitude and a first phase of the first frame image.
With reference to the first possible implementation manner of the second aspect, an embodiment of the present application provides a second possible implementation manner of the second aspect, where the determining a first real matrix corresponding to the first frame image after the quaternion matrix processing includes: carrying out transform domain modulation on the quaternion matrix corresponding to the first frame image to obtain a transformed quaternion matrix; extracting a first component, a second component, a third component and a fourth component of the transformed quaternion matrix; and determining a first real matrix corresponding to the first frame image according to the first component, the second component, the third component and the fourth component.
with reference to the second possible implementation manner of the second aspect, an embodiment of the present application provides a third possible implementation manner of the second aspect, where determining a first real matrix corresponding to the first frame image according to the first component, the second component, the third component, and the fourth component includes: determining a first difference matrix corresponding to the first component and the second component; determining a sum matrix of the second component corresponding to the third component; determining a second difference matrix corresponding to the third component and the fourth component; determining a third difference matrix corresponding to the fourth component and the first component; and combining the first difference matrix, the sum matrix, the second difference matrix and the third difference matrix to obtain a first real matrix corresponding to the first frame of image.
with reference to the third possible implementation manner of the second aspect, in an embodiment of the present application, there is provided a fourth possible implementation manner of the second aspect, where the transformed quaternion matrix satisfies: wherein, expressing the quaternion Gyrator transformation with the rotation angle alpha, P expresses a randomly generated phase mask; g1 represents the quaternion matrix corresponding to the first frame image.
with reference to the second possible implementation manner or the third possible implementation manner of the second aspect, an embodiment of the present application provides a fifth possible implementation manner of the second aspect, where a first real matrix corresponding to the first frame image satisfies: wherein S (Q1) represents extracting the first component of Q1; x (Q1) represents the second component of extraction Q1; y (Q1) represents the third component of extracted Q1; z (Q1) represents the fourth component of extracted Q1; q1 represents the transformed quaternion matrix; s (Q1) -X (Q1) represents the first difference matrix; x (Q1) + Y (Q1) represents the sum matrix; y (Q1) -Z (Q1) represents the second difference matrix; z (Q1) -S (Q1) represents the third difference matrix.
With reference to the first possible implementation manner of the second aspect, an embodiment of the present application provides a sixth possible implementation manner of the second aspect, where determining, according to the first real matrix, a first complex matrix corresponding to the first frame image includes: acquiring an initial real number matrix generated randomly; and combining the initial real matrix as a real component and the first real matrix as an imaginary component into a first complex matrix corresponding to the first frame image.
With reference to the sixth possible implementation manner of the second aspect, an embodiment of the present application provides a seventh possible implementation manner of the second aspect, where the first complex matrix corresponding to the first frame image satisfies: g1 ═ R0+ jR 1; wherein R0 represents the initial real matrix; r1 represents the first real matrix; j represents the imaginary part of the quaternion matrix.
With reference to the first possible implementation manner of the second aspect, an embodiment of the present application provides an eighth possible implementation manner of the second aspect, where the performing block processing on the first complex matrix to obtain a first new complex matrix includes: and partitioning the first complex matrix, and performing parameter-containing transformation on each partition to obtain a first new complex matrix.
with reference to the eighth possible implementation manner of the second aspect, in this embodiment, there is provided a ninth possible implementation manner of the second aspect, where the first new complex matrix satisfies: wherein T1 represents the first new complex matrix and the notation T {. cndot } represents a parametric complex transform; g1 denotes the first complex matrix; g11, G12, G21, and G22 denote blocks obtained by blocking the first complex matrix.
With reference to the ninth possible implementation manner of the second aspect, the present application provides a tenth possible implementation manner of the second aspect, where the first amplitude satisfies: h2 ═ PT [ T1 ]; the first phase satisfies: p1 ═ AT [ T1 ]; wherein, the symbols PT [, AT [ ] represent the amplitude and phase of T1 respectively.
with reference to the second aspect, an embodiment of the present application provides an eleventh possible implementation manner of the second aspect, and the third processing module is further configured to: determining a second real matrix corresponding to the second frame image after the quaternion matrix corresponding to the second frame image is processed; determining a second complex matrix corresponding to the second frame image according to the first amplitude and the second real matrix; and performing phase truncation coding and amplitude truncation coding on the second complex matrix to obtain a second phase and a second amplitude.
with reference to the eleventh possible implementation manner of the second aspect, in this example, a twelfth possible implementation manner of the second aspect is provided, where the second complex matrix corresponding to the second frame image satisfies: g2 ═ h2+ iR 2; wherein h2 represents the first amplitude; r2 represents the second matrix of real numbers; i represents the imaginary part of the quaternion matrix.
With reference to the twelfth possible implementation manner of the second aspect, this example provides a thirteenth possible implementation manner of the second aspect, where the second phase satisfies: m1 ═ AT [ G2 ]; wherein G2 represents a second complex matrix corresponding to the second frame image.
With reference to the second aspect, an embodiment of the present application provides a fourteenth possible implementation manner of the second aspect, and the fourth processing module is further configured to include: determining the result of conjugate transportation of the first phase and the second phase; and using the result as the key of the multi-frame image.
With reference to the fourteenth possible implementation manner of the second aspect, the present application provides a fifteenth possible implementation manner of the second aspect, where the secret key satisfies: p1, d ═ m1conj (p 1); wherein conj (·) represents the conjugation of m1 and p1, and m1 represents the second phase; p1 represents the first phase.
In a third aspect, an electronic device provided in an embodiment of the present application includes a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor implements the method according to any one of the first aspect when executing the computer program.
In a fourth aspect, an embodiment of the present application provides a storage medium having instructions stored thereon, which when executed on a computer, cause the computer to perform the method according to any one of the first aspect.
in a fifth aspect, an embodiment of the present application provides a computer program product, which when run on a computer, causes the computer to execute the method according to any one of the first aspect
Additional features and advantages of the disclosure will be set forth in the description which follows, or in part may be learned by the practice of the above-described techniques of the disclosure, or may be learned by practice of the disclosure.
In order to make the aforementioned objects, features and advantages of the present application more comprehensible, preferred embodiments accompanied with figures are described in detail below.
Detailed Description
The technical solutions in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application.
referring to fig. 1, fig. 1 is a flowchart of an image processing method provided in this embodiment of the present application, it should be understood that the method may be executed by an image processing apparatus shown in fig. 3 to implement encryption of a color image, and the apparatus corresponds to an electronic device shown in fig. 4, which may be various devices capable of executing the method, such as a computer or a server, and this embodiment of the present application is not limited thereto, and specifically includes the following steps:
Step S101, determining a quaternion matrix corresponding to each frame of image in a plurality of frames of images, wherein the plurality of frames of images comprise a first frame of image and a second frame of image.
optionally, the image includes, but is not limited to, a color image.
optionally, determining a quaternion matrix corresponding to each frame of the multiple frames of images includes: the color components of the color image are combined into a quaternion matrix as components of the quaternion matrix.
Optionally, the quaternion matrix satisfies:
Where red (R), green (G), and blue (B) color components of the color image are represented, respectively, and (x, y) represent spatial domain coordinates. t is an integer greater than or equal to 1, which is used to represent the number of images. i, j are the imaginary parts of the quaternion matrix.
Of course, in practical use, the four-element matrix may also take other forms, such as:
Alternatively, the first and second electrodes may be,
Alternatively, the first and second electrodes may be,
Where k is also used to represent the imaginary part of the quaternion matrix.
It is to be understood that the above description is intended to be illustrative, and not restrictive.
optionally, the multi-frame image may further include a third frame image, a fourth frame image, and an nth frame image. n is an integer greater than 2.
Optionally, the first frame image and the second frame image are two adjacent frame images on a time axis.
Of course, in actual use, the first frame image and the second frame image may also be user-specified, which may have no time relationship on the time axis. For example, when a user is going to encrypt a plurality of color images, one image may be randomly selected from the plurality of color images as a first frame image (or a first image), and then the other images are sequentially ordered to obtain a second image, a third image, and the like. Here, the number of the carbon atoms is not particularly limited.
Alternatively, the first frame image may also be referred to as a first image. The second frame image may be referred to as a second image. It should be understood that the first frame or the second frame is only used to distinguish between two different images.
Step S102, processing the quaternion matrix corresponding to the first frame image to obtain a first amplitude and a first phase of the first frame image.
As an embodiment, step S102 includes: determining a first real matrix corresponding to the first frame image after the quaternion matrix corresponding to the first frame image is processed; determining a first complex matrix corresponding to the first frame of image according to the first real matrix; carrying out block processing on the first complex matrix to obtain a first new complex matrix; and performing phase truncation coding and amplitude truncation coding on the first new complex matrix to obtain a first amplitude and a first phase of the first frame image.
In the implementation process, a first real matrix corresponding to the first frame image after the quaternion matrix corresponding to the first frame image is processed is determined; determining a first complex matrix corresponding to the first frame of image according to the first real matrix; carrying out block processing on the first complex matrix to obtain a first new complex matrix; and performing phase truncation coding and amplitude truncation coding on the first new complex matrix to obtain a first amplitude and a first phase of the first frame image, so that one phase can be obtained without iteration, the processing time can be saved, and the processing efficiency can be improved.
Optionally, the determining a first real matrix corresponding to the processed quaternion matrix corresponding to the first frame image includes: carrying out transform domain modulation on the quaternion matrix corresponding to the first frame image to obtain a transformed quaternion matrix; extracting a first component, a second component, a third component and a fourth component of the transformed quaternion matrix; and determining a first real matrix corresponding to the first frame image according to the first component, the second component, the third component and the fourth component.
optionally, the quaternion matrix corresponding to the first frame image may be transform domain modulated based on a Gyrator transform to obtain a transformed quaternion matrix.
of course, in actual use, the quaternion matrix corresponding to the first frame image may also be subjected to transform domain modulation based on fourier transform, fresnel transform, or the like, so as to obtain a transformed quaternion matrix. Here, the number of the carbon atoms is not particularly limited.
Optionally, the determining a first real matrix corresponding to the first frame image according to the first component, the second component, the third component, and the fourth component includes: determining a first difference matrix corresponding to the first component and the second component; determining a sum matrix of the second component corresponding to the third component; determining a second difference matrix corresponding to the third component and the fourth component; determining a third difference matrix corresponding to the fourth component and the first component; and combining the first difference matrix, the sum matrix, the second difference matrix and the third difference matrix to obtain a first real matrix corresponding to the first frame of image.
Optionally, in the present application, a Gyrator transform is taken as an example, and the transformed quaternion matrix satisfies: wherein, expressing the quaternion Gyrator transformation with the rotation angle alpha, P expresses a randomly generated phase mask; g1 represents the quaternion matrix corresponding to the first frame image.
Optionally, a first real matrix corresponding to the first frame image satisfies:
wherein S (Q1) represents extracting the first component of Q1; x (Q1) represents the second component of extraction Q1; y (Q1) represents the third component of extracted Q1; z (Q1) represents the fourth component of extracted Q1; q1 represents the transformed quaternion matrix; s (Q1) -X (Q1) represents the first difference matrix; x (Q1) + Y (Q1) represents the sum matrix; y (Q1) -Z (Q1) represents the second difference matrix; z (Q1) -S (Q1) represents the third difference matrix.
It should be understood that in the present application, each component is actually a matrix.
Optionally, the determining, according to the first real matrix, a first complex matrix corresponding to the first frame of image includes: acquiring an initial real number matrix generated randomly; and combining the initial real matrix as a real component and the first real matrix as an imaginary component into a first complex matrix corresponding to the first frame image.
Optionally, the first complex matrix corresponding to the first frame image satisfies: g1 ═ R0+ jR 1; wherein R0 represents the initial real matrix; r1 represents the first real matrix; j represents the imaginary part of the quaternion matrix.
Optionally, the performing block processing on the first complex matrix to obtain a first new complex matrix includes: and partitioning the first complex matrix, and performing parameter-containing transformation on each partition to obtain a first new complex matrix.
Optionally, blocking the first complex matrix comprises: and carrying out non-overlapping blocking on the first complex matrix. For example, the first frame image is divided into 2 × 2 image sub-blocks: the first new complex matrix satisfies:
Wherein T1 represents the first new complex matrix and the notation T {. cndot } represents a parametric complex transform; g1 denotes the first complex matrix; g11, G12, G21, and G22 denote blocks obtained by blocking the first complex matrix.
Alternatively, the parametric complex transform may be a Gyrator transform.
Of course, in practical use, it is also possible to perform parameter-containing transformation on each block by fresnel transformation to obtain the first new complex matrix. Here, the number of the carbon atoms is not particularly limited.
Alternatively, in practical use, the specific number of blocks may generally be determined according to the size of the image, and is not particularly limited herein.
Optionally, the first amplitude satisfies: h2 ═ PT [ T1 ];
The first phase satisfies: p1 ═ AT [ T1 ]; it is understood that p1 is the phase of G1 after transformation.
Wherein, the symbols PT [, AT [ ] represent the amplitude and phase of T1 respectively.
as another embodiment, step S102 includes: and obtaining the amplitude and the phase of the quaternion matrix corresponding to the first frame image to obtain a first amplitude and a first phase of the first frame image.
alternatively, the amplitude and phase operations may be directly performed on the quaternion matrix to obtain the first amplitude and the first phase of the first frame image.
Step S103, processing the quaternion matrix corresponding to the second frame image to obtain a second amplitude and a second phase corresponding to the second frame image.
As an embodiment, step S103 includes: determining a second real matrix corresponding to the second frame image after the quaternion matrix corresponding to the second frame image is processed; determining a second complex matrix corresponding to the second frame image according to the first amplitude and the second real matrix; and performing phase truncation coding and amplitude truncation coding on the second complex matrix to obtain a second phase and a second amplitude.
Optionally, "determining a second real matrix corresponding to the processed quaternion matrix corresponding to the second frame image" in the above; determining a second complex matrix corresponding to the second frame image according to the first amplitude and the second real matrix; the specific implementation of these two steps may refer to the description of the first frame image, and is not described herein again.
Optionally, the second complex matrix corresponding to the second frame image satisfies: g2 ═ h2+ iR 2;
Wherein h2 represents the first amplitude; r2 represents the second matrix of real numbers; i represents the imaginary part of the quaternion matrix.
The second phase satisfies: m1 ═ AT [ G2 ]; wherein G2 represents a second complex matrix corresponding to the second frame image. It will be appreciated that the second phase is the phase of the second complex matrix prior to transformation.
in a possible embodiment, the method further comprises: partitioning the second complex matrix, and performing parameter-containing transformation on each partition to obtain a second new complex matrix; and performing phase truncation coding on the second new complex matrix to obtain a transformed phase.
Optionally, blocking the second complex matrix comprises: and carrying out non-overlapping blocking on the second complex matrix. For example, the second frame image is divided into 2 × 2 image sub-blocks: the second new complex matrix satisfies:
wherein T2 represents the second new complex matrix and the notation T {. cndot } represents a parametric complex transform; g2 denotes the second complex matrix; g2,11, G2, 12, G2, 21, G2, 22 denote blocks obtained by blocking the second complex matrix.
Optionally, the second amplitude satisfies: h3 ═ PT [ T2 ].
Optionally, the specific implementation process may refer to a processing process of the first complex matrix, and details are not repeated here.
It should be understood that for the nth frame image, the corresponding nth complex matrix satisfies: gn + iRn, and the corresponding nth new complex matrix satisfies: the amplitude of the nth frame image satisfies: hn +1 equals PT [ Tn ], and the phase satisfies: pn ═ AT [ Tn ], and n is an integer of 2 or more.
It is to be understood that d in pn, d does not have any value, and is used for distinction only.
In the implementation process, the time-consuming iterative process is avoided through the cascaded block-parameter-contained transformation, so that the method has higher efficiency and can save the processing time.
as an embodiment, step S103 includes: and obtaining the amplitude and the phase of the quaternion matrix corresponding to the second frame image to obtain a second amplitude and a second phase of the second frame image.
Alternatively, the amplitude and phase operations may be directly performed on the quaternion matrix to obtain the second amplitude and the second phase of the second frame image.
And step S104, using the first amplitude and the second amplitude as ciphertexts of the multi-frame images, and generating keys of the multi-frame images according to the first phase and the second phase.
Optionally, taking the first amplitude and the second amplitude as the ciphertext of the multi-frame image, includes: and taking the first amplitude value as the ciphertext of the first frame image, and taking the second amplitude value as the ciphertext of the second frame image.
Alternatively, the ciphertext refers to the encrypted image.
Optionally, the generating a key of the plurality of frames of images according to the first phase and the second phase includes: determining the result of conjugate transportation of the first phase and the second phase; and using the result as the key of the multi-frame image.
optionally, the key satisfies: p1, d ═ m1conj (p 1); wherein conj (·) represents the conjugation of m1 and p1, and m1 represents the second phase; p1 represents the first phase.
it should be understood that for the key between two adjacent frames of images: pn-1, d-mn-1 conj (pn-1), n is an integer of 2 or more.
In the implementation process, by combining the phase of the first frame image and the phase of the second frame image, the key can be made more complex, so that the security of the color image is higher.
For example, assuming that the multi-frame image includes a first frame image, a second frame image and a third frame image, the processing procedure for the third frame image is as follows: processing the third frame image according to the processing process of the second frame image to obtain a third complex matrix corresponding to the third frame image, wherein the third complex matrix satisfies the following requirements: g3 ═ h3+ iR3, and its corresponding third new complex matrix satisfies: the amplitude of the third frame image satisfies: h3+1 ═ PT [ T3], the phase before transformation satisfies: m2 ═ AT [ G3], the transformed phase satisfying: p3 ═ AT [ T3], and the key between the second frame image and the third frame image is: p2, d ═ m2conj (p 2).
it should be understood that the phase of the complex matrix of the second frame image and all subsequent frame images before transformation satisfies: mn ═ AT [ Gn +1 ].
By way of example, the image processing method in the present application is described above in conjunction with fig. 1, and is described in detail below, by way of example and not limitation, in conjunction with fig. 2. Making the multi-frame color images to be encrypted respectively as follows: f1(x, y), f2(x, y), …, fn (x, y), with dimensions of NxM, the specific process is described as:
(1) Combining the color components of the color image as components of a quaternion matrix into a quaternion matrix, which is specifically expressed as:
(2) The quaternion matrix g1(x, y) corresponding to the first color image is transform domain modulated. Here, the quaternion Gyrator transformation is exemplified and specifically expressed as:
(3) And (3) extracting four components of the quaternion matrix in the step (2), and combining the four components into a real matrix. The concrete expression is as follows:
(4) Combining the randomly generated real matrix R0 and the real matrix of step (3) as real and imaginary components, respectively, into a first complex matrix G1, i.e.: g1 ═ R0+ jR 1;
(5) The first complex matrix G1 is partitioned into non-overlapping blocks, and each block is transformed with parameters. For example, dividing the image into 2 × 2 image sub-blocks, the first new complex matrix satisfies:
(6) the first new complex matrix T1 is phase-truncated and amplitude-truncated, i.e.: the first amplitude satisfies: h2 ═ PT [ T1 ]; the first phase satisfies: p1 ═ AT [ T1 ];
(7) and (3) executing the steps (1) to (3) on the second color image to obtain a second real matrix R2, and combining the second real matrix R2 with the amplitude truncation coding matrix obtained in the step (6) to form a second complex matrix, namely: g2 ═ h2+ iR 2; the second complex matrix G2 is phase-truncated and encoded to obtain a phase matrix, i.e. the second phase satisfies: m1 ═ AT [ G2 ];
(8) Multiplying the first phase in the step (6) and the second phase in the step (7) to obtain a new phase function, namely the secret key satisfies the following conditions: p1, d ═ m1conj (p 1);
Meanwhile, step (5) and step (6) are performed on the second complex matrix G2 in step (7).
(9) and (3) performing the step (7) and the step (8) on the third color image until the last color image is processed to obtain the amplitude and the phase, namely:
h=PT[T],p=AT[T]。
Optionally, hn +1 is ciphertext (E).
Optionally, the specific implementation process of step (1) to step (9) may refer to the foregoing description, and is not described herein again.
The image processing method comprises the steps that a quaternion matrix corresponding to each frame of image in a plurality of frames of images is determined, and the plurality of frames of images comprise a first frame of image and a second frame of image; processing the quaternion matrix corresponding to the first frame image to obtain a first amplitude and a first phase of the first frame image; processing the quaternion matrix corresponding to the second frame image to obtain a second amplitude and a second phase corresponding to the second frame image; and taking the first amplitude and the second amplitude as ciphertexts of the multi-frame images, and generating a key of the multi-frame images according to the first phase and the second phase. The image is integrally coded, and the coded result is converted into a real number matrix for cascade transmission, so that the transmission efficiency is higher, meanwhile, a time-consuming iterative process is avoided through cascade block-parameter-containing transformation, so that the efficiency is higher, and the key of the multi-frame image is determined through the first phase and the second phase, so that the image has higher safety.
based on the same inventive concept, an image processing apparatus as shown in fig. 3 is also provided in the embodiment of the present application, and it should be understood that the apparatus 300 corresponds to the above-mentioned method embodiment of fig. 1, and can perform the various steps related to the above-mentioned method embodiment, and the specific functions of the apparatus 300 can be referred to the above description, and in order to avoid repetition, the detailed description is appropriately omitted here. Specifically, the apparatus 300 includes:
The first processing module 310 is configured to determine a quaternion matrix corresponding to each frame of images in multiple frames of images, where the multiple frames of images include a first frame of image and a second frame of image.
The second processing module 320 is configured to process the quaternion matrix corresponding to the first frame image to obtain a first amplitude and a first phase of the first frame image.
A third processing module 330, configured to process the quaternion matrix corresponding to the second frame image to obtain a second amplitude and a second phase corresponding to the second frame image.
And the encryption module 340 is configured to use the first amplitude and the second amplitude as ciphertexts of the multiple frames of images, and generate a key of the multiple frames of images according to the first phase and the second phase.
Optionally, the second processing module 320 is further configured to: determining a first real matrix corresponding to the first frame image after the quaternion matrix corresponding to the first frame image is processed; determining a first complex matrix corresponding to the first frame of image according to the first real matrix; carrying out block processing on the first complex matrix to obtain a first new complex matrix; and performing phase truncation coding and amplitude truncation coding on the first new complex matrix to obtain a first amplitude and a first phase of the first frame image.
Optionally, the determining a first real matrix corresponding to the processed quaternion matrix corresponding to the first frame image includes: carrying out transform domain modulation on the quaternion matrix corresponding to the first frame image to obtain a transformed quaternion matrix; extracting a first component, a second component, a third component and a fourth component of the transformed quaternion matrix; and determining a first real matrix corresponding to the first frame image according to the first component, the second component, the third component and the fourth component.
Optionally, the determining a first real matrix corresponding to the first frame image according to the first component, the second component, the third component, and the fourth component includes: determining a first difference matrix corresponding to the first component and the second component; determining a sum matrix of the second component corresponding to the third component; determining a second difference matrix corresponding to the third component and the fourth component; determining a third difference matrix corresponding to the fourth component and the first component; and combining the first difference matrix, the sum matrix, the second difference matrix and the third difference matrix to obtain a first real matrix corresponding to the first frame of image.
Optionally, the transformed quaternion matrix satisfies: wherein, expressing the quaternion Gyrator transformation with the rotation angle alpha, P expresses a randomly generated phase mask; g1 represents the quaternion matrix corresponding to the first frame image.
Optionally, a first real matrix corresponding to the first frame image satisfies: wherein S (Q1) represents extracting the first component of Q1; x (Q1) represents the second component of extraction Q1; y (Q1) represents the third component of extracted Q1; z (Q1) represents the fourth component of extracted Q1; q1 represents the transformed quaternion matrix; s (Q1) -X (Q1) represents the first difference matrix; x (Q1) + Y (Q1) represents the sum matrix; y (Q1) -Z (Q1) represents the second difference matrix; z (Q1) -S (Q1) represents the third difference matrix.
Optionally, the determining, according to the first real matrix, a first complex matrix corresponding to the first frame of image includes: acquiring an initial real number matrix generated randomly; and combining the initial real matrix as a real component and the first real matrix as an imaginary component into a first complex matrix corresponding to the first frame image.
Optionally, the first complex matrix corresponding to the first frame image satisfies: g1 ═ R0+ jR 1; wherein R0 represents the initial real matrix; r1 represents the first real matrix; j represents the imaginary part of the quaternion matrix.
optionally, the performing block processing on the first complex matrix to obtain a first new complex matrix includes: and partitioning the first complex matrix, and performing parameter-containing transformation on each partition to obtain a first new complex matrix.
Optionally, the first new complex matrix satisfies: wherein T1 represents the first new complex matrix and the notation T {. cndot } represents a parametric complex transform; g1 denotes the first complex matrix; g11, G12, G21, and G22 denote blocks obtained by blocking the first complex matrix.
optionally, the first amplitude satisfies: h2 ═ PT [ T1 ]; the first phase satisfies: p1 ═ AT [ T1 ]; wherein, the symbols PT [, AT [ ] represent the amplitude and phase of T1 respectively.
Optionally, the third processing module 330 is further configured to: determining a second real matrix corresponding to the second frame image after the quaternion matrix corresponding to the second frame image is processed; determining a second complex matrix corresponding to the second frame image according to the first amplitude and the second real matrix; and performing phase truncation coding and amplitude truncation coding on the second complex matrix to obtain a second phase and a second amplitude.
Optionally, the second complex matrix corresponding to the second frame image satisfies: g2 ═ h2+ iR 2; wherein h2 represents the first amplitude; r2 represents the second matrix of real numbers; i represents the imaginary part of the quaternion matrix.
Optionally, the second phase satisfies: m1 ═ AT [ G2 ]; wherein G2 represents a second complex matrix corresponding to the second frame image.
Optionally, the encryption module 340 is further configured to include: determining the result of conjugate transportation of the first phase and the second phase; and using the result as the key of the multi-frame image.
Optionally, the key satisfies: p1, d ═ m1conj (p 1); wherein, conj [. cndot. ] represents the conjugation operation between m1 and p1, and m1 represents the second phase; p1 represents the first phase.
based on the same inventive concept, the present application further provides an electronic device, and fig. 4 is a block diagram of an electronic device 400 in an embodiment of the present application. Electronic device 400 may include a processor 410, a communication interface 420, a memory 430, and at least one communication bus 440. Wherein the communication bus 440 is used to enable direct connection communication of these components. In this embodiment, the communication interface 420 of the device in this application is used for performing signaling or data communication with other node devices. The processor 410 may be an integrated circuit chip having signal processing capabilities.
The Processor 410 may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; but may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic, discrete hardware components. The various methods, steps, and logic blocks disclosed in the embodiments of the present application may be implemented or performed. A general purpose processor may be a microprocessor or the processor 410 may be any conventional processor or the like.
The Memory 430 may be, but is not limited to, a Random Access Memory (RAM), a Read Only Memory (ROM), a Programmable Read-Only Memory (PROM), an Erasable Read-Only Memory (EPROM), an electrically Erasable Read-Only Memory (EEPROM), and the like. The memory 430 stores computer readable instructions that, when executed by the processor 410, the electronic device 400 may perform the steps involved in the method embodiment of fig. 1 described above.
Optionally, the electronic device 400 may further include a memory controller and an input-output unit.
The memory 430, the memory controller, the processor 410, and the input/output unit are electrically connected to each other directly or indirectly to realize data transmission or interaction. For example, these components may be electrically coupled to each other via one or more communication buses 440. The processor 410 is used to execute executable modules stored in the memory 430, such as software functional modules or computer programs included in the apparatus 300. Also, the apparatus 300 is configured to perform the following method: determining a quaternion matrix corresponding to each frame of image in a plurality of frames of images, wherein the plurality of frames of images comprise a first frame of image and a second frame of image; processing the quaternion matrix corresponding to the first frame image to obtain a first amplitude and a first phase of the first frame image; processing the quaternion matrix corresponding to the second frame image to obtain a second amplitude and a second phase corresponding to the second frame image; and taking the first amplitude and the second amplitude as ciphertexts of the multi-frame images, and generating a key of the multi-frame images according to the first phase and the second phase.
The input and output unit is used for providing input data for a user to realize the interaction of the user and the server (or the local terminal). The input/output unit may be, but is not limited to, a mouse, a keyboard, and the like.
It will be appreciated that the configuration shown in fig. 4 is merely illustrative and that the electronic device 400 may include more or fewer components than shown in fig. 4 or may have a different configuration than shown in fig. 4. The components shown in fig. 4 may be implemented in hardware, software, or a combination thereof.
The embodiment of the present application further provides a storage medium, where the storage medium stores instructions, and when the instructions are executed on a computer, the method in the method embodiment is implemented when the computer executes the instructions, and details are not repeated here to avoid repetition.
The present application also provides a computer program product which, when run on a computer, causes the computer to perform the method of the method embodiments.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one logical division, and there may be other divisions when actually implemented, and for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection of devices or units through some communication interfaces, and may be in an electrical, mechanical or other form.
In addition, units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
Furthermore, the functional modules in the embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
In this document, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions.
The above description is only an example of the present application and is not intended to limit the scope of the present application, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the present application shall be included in the protection scope of the present application.