Disclosure of Invention
In view of the above, the present application provides a watermark embedding method, a watermark identifying method and an electronic device, so as to solve the above technical problems.
In a first aspect, an embodiment of the present application provides a watermark embedding method, including:
processing the carrier image to obtain first low-frequency features, and generating s first subrings based on the first low-frequency features;
Processing the watermark image to obtain second low-frequency characteristics, and generating s second subrings based on the second low-frequency characteristics;
encrypting the s second subrings to obtain s encrypted second subrings;
Determining s zero watermarks based on the s first sub-loops and the corresponding encrypted second sub-loops;
And embedding s zero watermarks into the carrier image to obtain the carrier image containing watermark information.
In some possible implementations, processing the carrier image to obtain the first low frequency features, generating s first sub-loops based on the first low frequency features includes:
Converting the carrier image into a YCbCr color space to obtain a Y component;
performing double-tree complex wavelet transformation on the Y component to obtain a first low-frequency characteristic Wherein e represents the number of stages of the double-tree complex wavelet transformation decomposition, and t represents frequency domain sub-bands in different directions;
and dividing s first subrings on the first low-frequency characteristic, wherein h 1,h2,…hs, h i is the ith first subring, and i is more than or equal to 1 and less than or equal to s.
In some possible implementations, the encrypting the s second sub-rings to obtain s encrypted second sub-rings includes:
Randomly generating s positioning matrixes M 1,M2,…Ms, wherein an ith positioning matrix M i represents an ith key i;
The ith second sub-ring w i is encrypted by using the ith secret key i to obtain an encrypted ith second sub-ring
Wherein, Is an exclusive or operation.
In some possible implementations, determining s zero watermarks based on s first sub-loops and corresponding encrypted second sub-loops includes:
Performing improved Schur decomposition on the ith first sub-ring h i to obtain an ith upper triangular matrix
For the ith upper triangular matrixPerforming binarization operation to obtain an ith binary feature matrix F i:
Wherein mod is a modulo arithmetic function;
encryption-based ith second sub-ring And an ith binary feature matrix F i to obtain an ith zero watermark Z i:
Wherein, Is an exclusive or operation.
In some possible implementations, embedding a zero watermark in a carrier image results in a carrier image containing watermark information, comprising:
Based on the ith zero watermark Z i, the upper triangular matrix of the ith first sub-loop First row and first column elements of (a)Processing to obtain the ith upper triangular matrix embedded with watermarkMaximum singular value of (2)
Wherein, delta is quantization step length, mu is embedding strength, rem 1,i is first residual value:
upper triangular matrix for embedding watermark into ith Reconstructing to obtain the ith feature matrix containing watermark information
Wherein U is unitary matrix, and U T is transposed matrix of U;
For the ith feature matrix containing watermark information Reconstructing to obtain an ith third sub-loop containing watermark information;
Performing inverse transformation on the dual-tree complex wavelet on the ith third sub-loop containing watermark information to obtain an ith fourth sub-loop;
And carrying out image reconstruction on all the fourth subrings to obtain a carrier image containing watermark information.
In a second aspect, an embodiment of the present application provides a watermark identifying method, including:
Processing the carrier image containing watermark information to obtain a third low-frequency characteristic, and generating s fifth subrings based on the third low-frequency characteristic;
performing improved Schur decomposition on each fifth subring to obtain s upper triangular matrixes;
Determining s first watermarks based on the s upper triangular matrixes;
decrypting the corresponding first watermarks by using the s keys respectively to obtain s second watermarks, wherein the second watermarks are decrypted first watermarks;
And processing the s second watermarks by using the optimized network which is trained in advance to obtain s third watermarks.
In one possible implementation, determining s first watermarks based on s upper triangular matrices includes:
based on the ith upper triangular matrix Determining an ith first watermark W i e:
wherein, delta is quantization step length, mu is embedding strength, rem 2,i is second residual value: Is a matrix Is a first column element of a first row of a picture frame.
In one possible implementation, the optimization network includes a downsampling unit, a first convolution layer, a first batch processing layer, a first ReLU function, a second convolution layer, a second batch processing layer, a second ReLU function, a third convolution layer, a third batch processing layer, a third ReLU function and a full-connection layer which are sequentially connected, wherein the convolution kernel size of the first convolution layer is 3×3, the convolution kernel size of the second convolution layer is 3×3, and the convolution kernel size of the third convolution layer is 3×3;
The method further comprises the steps of:
a training set is established, wherein the training set comprises a plurality of groups of watermark image samples, and each group of watermark image samples comprises an original watermark image and an attacked watermark image;
processing the attacked watermark image by using an optimization network to obtain an optimized watermark image;
determining a loss value based on the optimized watermark image and the original watermark image;
parameters of the optimized network are updated based on the loss values.
In a third aspect, an embodiment of the present application provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, where the processor implements the watermark embedding method or the watermark identifying method of the embodiment of the present application when executing the computer program.
In a fourth aspect, an embodiment of the present application is a computer readable storage medium, where a computer program is stored, where the computer program is executed by a processor to implement a watermark embedding method or a watermark identifying method according to an embodiment of the present application.
The application carries out ring encryption on the carrier image and the copyright watermark, can improve the security of watermark information, and can realize multi-copyright sharing.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present application more apparent, the technical solutions of the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application, and it is apparent that the described embodiments are some embodiments of the present application, but not all embodiments of the present application. The components of the embodiments of the present application generally described and illustrated in the figures herein may be arranged and designed in a wide variety of different configurations.
Thus, the following detailed description of the embodiments of the application, as presented in the figures, is not intended to limit the scope of the application, as claimed, but is merely representative of selected embodiments of the application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
First, the design idea of the embodiment of the present application will be briefly described.
In order to overcome the technical problems of the prior digital watermarking, the application provides a dual watermarking method integrating annular embedding and deep learning. And performing dual-tree complex wavelet transform (DT-CWT) on the carrier image to obtain a stable embedded domain so as to eliminate the influence of the random signal on the watermark, and constructing a ring-shaped embedded unit in a stable low-frequency domain so as to improve the synchronism of the watermark under rotation attack and multiple attacks. And secondly, decomposing the improved schur into circular ring areas for construction, so as to further improve the stability of the watermark. Meanwhile, in order to balance the robustness and invisibility of the watermark, the influence of the watermark on the image vision is reduced by utilizing the embedding strength of the deep learning training watermark, the attacked watermark image is trained, a copyright very similar to the original watermark is generated, and when copyright disputes occur, the definition of the watermark can be improved through a trained network model. Different watermark rings are encrypted by adopting different encryption methods for the same watermark, and the encrypted watermark information is embedded in an encryption domain, so that the information security can be improved.
The application comprises the following steps:
1. Ring encryption
Because the encryption method used in the existing blind watermarking technology is single, the security is low, copyright sharing cannot be realized, and the image and the watermark are preprocessed and encrypted respectively on the basis of a block mode, so that the security of the watermark is improved. In the present invention, the water-printing sub-ring is formed by adopting a ring-shaped modeAnd image sub-ring
Wherein H is a carrier image, and W is an original copyright watermark. To further increase the unpredictability of the copyright watermark, a positioning matrix M i containing a plurality of characterization keys is randomly generated, i E [1, s ], and then different encryption methods are selected by judging the elements in the positioning matrix M i to encrypt the watermark subring:
Since the copyrights of portions of digital works are sometimes not owned by individuals or individual organizations, but are commonly owned by multiple individuals or organizations. The copyright-shared works for multiple persons can be held by one person only, and cannot be shared by multiple persons, so that internal copyright disputes among members are caused. In order to realize key sharing and facilitate management of later copyright information, a Lagrange interpolation method is adopted to distribute the keys.
The user set is U= { U 1,u2,…us }, the shared key set is K= { K 1,k2,…ks }, wherein each element in the shared key set satisfies the following conditionsAnd the elements in K are in one-to-one correspondence with the elements in U, (x i,f(xi)) and are used for solving the coefficient item a i in the key sharing equation, and the keyThe chaotic mapping parameter or scrambling frequency is used for solving an encryption algorithm, and the decryption formula is as follows:
Wherein a 0 is the initial value of the encryption method, and f (x) is the use of the corresponding key And solving the obtained chaotic mapping parameters or scrambling times. When the user u i takes the key, the constant term a i of the decryption formula is substituted by (x i,f(xi)) and the initial value a 0, and then the key is usedSubstituting the chaotic mapping parameters into a decryption formula to obtain the chaotic mapping parameters.
2. Ring-based watermark embedding strategy
The strategy is divided into two stages, ring division and zero watermark generation. In a first stage, in order to reduce the impact of geometrical attacks on watermark synchronicity, the circular sub-bands are partitioned before embedding the watermark. Firstly, dividing a low frequency domain of a carrier image into different annular subbands by taking an image center as a circle center, and calculating the distance d s between all pixels and the circle center according to the following formula as shown in fig. 1:
And dividing all pixels with the same distance into a circular ring h, wherein the distance is the radius of the circular ring, and calculating the last circular ring with the minimum radius.
Wherein (x 0,y0) is the center coordinates, (x, y) is the coordinates of the image pixels, round is a rounding function, r s is the radius of the circular ring, s is the number of concentric circles, and s is more than or equal to 1 and less than or equal to r/b. Fig. 1 shows concentric circles of different radii, wherein the numbers on the yellow sub-blocks are the distances of the corresponding pixels from the center of the circle, i.e. the radius of the circle.
The second stage is used to generate zero watermark, after obtaining the embedded ring h of the image, the method is based on the followingCutting each ring into two equal parts, namely a left half ring h l and a right half ring h r, and extracting DCT coefficients of ring-shaped subsections by using Discrete Cosine Transform (DCT)Calculating the first 9 DCT coefficients to obtain energy information for each half-loopSecondly, generating an image characteristic lambda according to the energy of each semi-ring:
and finally, generating zero watermark information by the extracted image characteristics and the encrypted watermark for embedding subsequent watermark embedding.
3. Improved Schur decomposition
Schur decomposition is used as a matrix decomposition method for feature extraction, image redundancy can be well removed, and the feature with invariable translation and robustness is decomposed. The method has wide application in the fields of image recognition, information hiding, digital evidence obtaining and the like, and for an m multiplied by n matrix I epsilon C m×n, a unitary matrix U epsilon C m×n exists, so that
Wherein U is unitary matrix, R e C m×n is upper triangular matrix, and since a large amount of characteristic information of the matrix is contained in the matrix R, watermark information is embedded into the maximum singular value λ=eig (R) of the image to resist conventional attacks. Embedding watermark information in an image can be considered as a noise signal, and most existing watermarking methods directly quantize and embed watermark information into lambda in the first element of the R matrix of the image:
λ'=λ+μW
Wherein lambda is the original maximum singular value, lambda' is the maximum singular value after embedding watermark information, mu is the embedding strength, and W is the watermark information. In the absence of any attack, W is expressed as
When a watermark-containing image is attacked, a default attack signal acts on the pixel value of the image as the watermark information with an additive signal, and influences lambda' carrying the watermark information:
λatt=λ+μW+A
=λ'+A
Wherein lambda att is the maximum value of watermark after attack, and when the watermark-containing image is attacked, the watermark is extracted as
Wherein, W' is the extracted watermark, W att attacks the information, can see that the definition of the watermark information is directly influenced by the strength of the attack signal, when the strength of the attack signal is increased, the attack signal can directly cover the watermark information. In order to further reduce the influence of the attack signal on the watermark information, the present embodiment improves on the traditional Schur decomposition:
Wherein R F is a modulation matrix, F is an adjusting factor, and is used for controlling the magnitude of R F (1, 1), and when the improved Schur decomposition decomposes the image after attack, the variation range of singular values can be reduced by F.
4. Deep learning model
The information is transmitted in the channel, and the copyright information of the watermark-containing image is influenced due to the influence of noise, compression or filtering, so that the extracted watermark image contains more noise points, and in order to further improve the definition of the watermark image, an intermediate copyright image generation model is designed for optimizing the extracted watermark.
Compared with the prior art, the application has the following beneficial effects:
1. the carrier image and the copyright watermark are subjected to ring encryption, so that the security of watermark information can be improved, and multi-copyright sharing can be realized.
2. Compared with the block-based watermark, the ring-based watermark embedding method has higher robustness, can improve the robustness of an algorithm, has smaller influence on the characteristic information of the image subring even if the watermark-containing image is subjected to geometric deformation, further improves the resistance of the algorithm to shearing attack and row-column offset, and can reduce the influence of noise attack, JPEG compression and filtering attack on the image due to the multidirectional property and the singularity of the DT-CWT.
3. The improved Schur decomposition is based on further improving the resistance performance of the watermark, and the annular watermark embedding and extracting method effectively improves the capacity of embedding the watermark.
4. The watermark image after the attack is trained by using the deep learning method, and a copyright image with extremely high similarity with the original watermark can be generated through a network, so that the definition of the watermark is improved.
After the application scenario and the design idea of the embodiment of the present application are introduced, the technical solution provided by the embodiment of the present application is described below.
As shown in fig. 2, an embodiment of the present application provides a watermark embedding method, including:
Step 101, processing a carrier image to obtain first low-frequency characteristics, and generating s first subrings based on the first low-frequency characteristics;
102, processing the watermark image to obtain second low-frequency characteristics, and generating s second subrings based on the second low-frequency characteristics;
step 103, carrying out encryption processing on the s second subrings to obtain s encrypted second subrings;
Step 104, determining s zero watermarks based on s first sub-loops and corresponding encrypted second sub-loops;
step 105, embedding s zero watermarks in the carrier image to obtain a carrier image containing watermark information.
In the embodiment, the annular sub-bands are respectively constructed on the carrier image and the watermark image, so that the influence of geometric attacks on watermark synchronism can be reduced and the security of the watermark can be improved
In some embodiments, processing the carrier image to obtain first low frequency features, generating s first sub-loops based on the first low frequency features includes:
Converting the carrier image into a YCbCr color space to obtain a Y component;
performing double-tree complex wavelet transformation on the Y component to obtain a first low-frequency characteristic Wherein e represents the number of stages of the double-tree complex wavelet transformation decomposition, and t represents frequency domain sub-bands in different directions;
and dividing s first subrings on the first low-frequency characteristic, wherein h 1,h2,…hs, h i is the ith first subring, and i is more than or equal to 1 and less than or equal to s.
In some embodiments, the encrypting process is performed on the s second sub-rings to obtain s encrypted second sub-rings, including:
Randomly generating s positioning matrixes M 1,M2,…Ms, wherein an ith positioning matrix M i represents an ith key i;
The ith second sub-ring w i is encrypted by using the ith secret key i to obtain an encrypted ith second sub-ring
Wherein, Is an exclusive or operation.
According to the embodiment, different secret keys are adopted for encryption of different sub-rings, so that the security of the watermark can be improved.
In some embodiments, determining s zero watermarks based on s first sub-loops and corresponding encrypted second sub-loops includes:
Performing improved Schur decomposition on the ith first sub-ring h i to obtain an ith upper triangular matrix
Performing binarization operation on the ith upper triangular matrix R i F to obtain an ith binary feature matrix F i:
Wherein mod is a modulo arithmetic function;
encryption-based ith second sub-ring And an ith binary feature matrix F i to obtain an ith zero watermark Z i:
Wherein, Is an exclusive or operation.
The embodiment adopts improved Schur decomposition, can refine image characteristics and improve the information accuracy and robustness of the watermark.
In some embodiments, embedding a zero watermark in a carrier image resulting in a carrier image containing watermark information comprises:
Based on the ith zero watermark Z i, the upper triangular matrix of the ith first sub-loop First row and first column elements of (a)Processing to obtain the ith upper triangular matrix embedded with watermarkMaximum singular value of (2)
Wherein, delta is quantization step length, mu is embedding strength, rem 1,i is first residual value:
upper triangular matrix for embedding watermark into ith Reconstructing to obtain the ith feature matrix containing watermark information
Wherein U is unitary matrix, and U T is transposed matrix of U;
For the ith feature matrix containing watermark information Reconstructing to obtain an ith third sub-loop containing watermark information;
Performing inverse transformation on the dual-tree complex wavelet on the ith third sub-loop containing watermark information to obtain an ith fourth sub-loop;
And carrying out image reconstruction on all the fourth subrings to obtain a carrier image containing watermark information.
As shown in fig. 3, an embodiment of the present application provides a watermark identifying method, including:
Step 201, processing a carrier image containing watermark information to obtain a third low-frequency characteristic, and generating s fifth subrings based on the third low-frequency characteristic;
step 202, performing improved Schur decomposition on each fifth subring to obtain s upper triangular matrixes;
Step 203, determining s first watermarks based on s upper triangular matrixes;
Step 204, decrypting the corresponding first watermarks by using the s keys respectively to obtain s second watermarks, wherein the second watermarks are decrypted first watermarks;
And 205, processing the s second watermarks by using the optimized network which is trained in advance to obtain s third watermarks.
In some embodiments, determining s first watermarks based on s upper triangular matrices includes:
based on the ith upper triangular matrix Determining the ith first watermark
Wherein, delta is quantization step length, mu is embedding strength, rem 2,i is second residual value: Is a matrix Is a first column element of a first row of a picture frame.
In some embodiments, the optimization network comprises a downsampling unit, a first convolution layer, a first batch processing layer, a first ReLU function, a second convolution layer, a second batch processing layer, a second ReLU function, a third convolution layer, a third batch processing layer, a third ReLU function and a full-connection layer which are sequentially connected, wherein the convolution kernel size of the first convolution layer is 3×3, the moving step size is 2, the packing=1, the convolution kernel size of the second convolution layer is 3×3, the moving step size is 2, the packing=1, the convolution kernel size of the third convolution layer is 3×3, and the moving step size is 2, the packing=1.
The method further comprises the steps of:
the method comprises the steps of establishing a training set, wherein the training set comprises a plurality of groups of watermark image samples, each group of watermark image samples comprises an original watermark image and an attacked watermark image, and the attack mode comprises geometric attack, non-geometric attack and combined attack of the two;
processing the attacked watermark image by using an optimization network to obtain an optimized watermark image;
determining a loss value by utilizing the minimum mean square error based on the optimized watermark image and the original watermark image;
parameters of the optimized network are updated based on the loss values.
The following describes a specific implementation of the present application in connection with a specific application scenario.
In fig. 4, (a), (b), (c), (d) and (f) are original carrier images, in fig. 4, (g) is an encrypted watermark, a peak signal-To-Noise Ratio (PSNR) is adopted To evaluate the visual effect of an embedded watermark image, the higher the PSNR is, the better the invisibility is, in addition, a normalized correlation coefficient (Normalized Correlation, NC) is adopted To measure the similarity between the original watermark and the extracted watermark after attack, the higher the NC value is, the clearer the extracted watermark is, and the better the robustness is. The experimental results are shown in fig. 5, 6,7 and 8, wherein fig. 5 shows PSNR values after watermark embedding of different carrier images. Fig. 6 shows NC values of different carrier images after a cropping attack. Fig. 7 shows NC values of the carrier image under different median filter size attacks. Fig. 8 shows the NC values obtained after various levels of JEPG compression attacks.
Based on the above embodiments, the present application further provides an electronic device, and referring to fig. 9, the electronic device 300 provided in the embodiment of the present application at least includes a processor 301, a memory 302, and a computer program stored in the memory 302 and capable of running on the processor 301, where the watermark embedding method or the watermark identifying method provided in the embodiment of the present application is implemented when the processor 301 executes the computer program.
The electronic device 300 provided by embodiments of the present application may also include a bus 303 that connects the different components, including the processor 301 and the memory 302. Bus 303 represents one or more of several types of bus structures, including a memory bus, a peripheral bus, a local bus, and so forth.
Memory 302 may include readable media in the form of volatile Memory, such as random access Memory (Random Access Memory, RAM) 3021 and/or cache Memory 3022, and may further include Read Only Memory (ROM) 3023.
Memory 302 may also include a program tool 3025 having a set (at least one) of program modules 3024, the program modules 3024 including, but not limited to, an operating subsystem, one or more application programs, other program modules, and program data, each or some combination of which may include an implementation of a network environment.
The electronic device 300 may also communicate with one or more external devices 304 (e.g., keyboard, remote control, etc.), one or more devices that enable a user to interact with the electronic device 300 (e.g., cell phone, computer, etc.), and/or any device that enables the electronic device 300 to communicate with one or more other electronic devices 300 (e.g., router, modem, etc.). Such communication may occur through an Input/Output (I/O) interface 305. Also, electronic device 300 may communicate with one or more networks such as a local area network (Local Area Network, LAN), a wide area network (Wide Area Network, WAN), and/or a public network such as the internet via network adapter 306. As shown in fig. 9, the network adapter 306 communicates with other modules of the electronic device 300 over the bus 303. It should be appreciated that although not shown in FIG. 9, other hardware and/or software modules may be used in connection with electronic device 300, including, but not limited to, microcode, device drivers, redundant processors, external disk drive arrays, disk array (Redundant Arrays of INDEPENDENT DISKS, RAID) subsystems, tape drives, and data backup storage subsystems, among others.
It should be noted that the electronic device 300 shown in fig. 9 is only an example, and should not be construed as limiting the function and the application scope of the embodiment of the present application.
The embodiment of the application also provides a computer readable storage medium, which stores computer instructions that when executed by a processor implement the watermark embedding method or the watermark identifying method provided by the embodiment of the application. Specifically, the executable program may be built into or installed in the electronic device 300, so that the electronic device 300 may implement the watermark embedding method or the watermark identifying method provided by the embodiment of the present application by executing the built-in or installed executable program.
The watermark embedding method or watermark identifying method provided by the embodiments of the present application may also be implemented as a program product comprising program code for causing the electronic device 300 to execute the watermark embedding method or watermark identifying method provided by the embodiments of the present application when the program product is run on the electronic device 300.
The program product provided by embodiments of the present application may take the form of any combination of one or more readable media, which may be a readable signal medium or a readable storage medium, and which may be, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof, and more specific examples (a non-exhaustive list) of a readable storage medium include an electrical connection having one or more wires, a portable disk, a hard disk, RAM, ROM, erasable programmable read-Only Memory (Erasable Programmable Read Only Memory, EPROM), optical fiber, portable compact disk read-Only Memory (Compact Disc Read-Only Memory, CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof.
The program product provided by embodiments of the present application may be implemented as a CD-ROM and include program code that may also be run on a computing device. However, the program product provided by the embodiments of the present application is not limited thereto, and in the embodiments of the present application, the readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
It should be noted that although several units or sub-units of the apparatus are mentioned in the above detailed description, such a division is merely exemplary and not mandatory. Indeed, the features and functions of two or more of the elements described above may be embodied in one element in accordance with embodiments of the present application. Conversely, the features and functions of one unit described above may be further divided into a plurality of units to be embodied.
Furthermore, although the operations of the methods of the present application are depicted in the drawings in a particular order, this is not required or suggested that these operations must be performed in this particular order or that all of the illustrated operations must be performed in order to achieve desirable results. Additionally or alternatively, certain steps may be omitted, multiple steps combined into one step to perform, and/or one step decomposed into multiple steps to perform.
Finally, it should be noted that the above embodiments are only for illustrating the technical solution of the present application and are not limiting. Although the present application has been described in detail with reference to the embodiments, it should be understood by those skilled in the art that modifications and equivalents may be made thereto without departing from the spirit and scope of the present application, which is intended to be covered by the appended claims.