A kind of addition image blind watermarking method based on frequency domain
Technical field
The present invention relates to technical field of image processing more particularly to a kind of addition image blind watermarking methods based on frequency domain.
Background technique
Digital watermark technology is to be directly embedded into some identification informations, i.e. digital watermarking in digital carrier or indirect table
Show, and do not influence the use value of original vector, while being not easy to be ascertained and modify again.But it can be identified and be distinguished by producer
Recognize.Hide information in the carrier by these, can achieve confirmation content creator, buyer, transmission secret information or
The purpose of whether carrier is tampered judged.
Digital watermarking be protection information security, realize it is anti-fake trace to the source, the effective way of copyright protection, be Information Hiding Techniques
The important branch and research direction of research field.For example, the intellectual property protection of copyright, including digital music, three-dimensional are dynamic
Picture, video, scan image;Bill anti-counterfeit in business transaction, the development of the image input-output equipment of high quality make to forge more
It is easy to add;The true and false of certificate identifies, including identity card, passport, driver's license, academic certificate, credentials;Audio-visual-data is hidden
Identify and distort prompt;Covert communications and its confrontation.
Digital watermark technology has the special feature that: 1, safety, the information of digital watermarking should be safe, it is difficult to distort or
It forges, there is lower false detection rate, when raw content changes, digital watermarking should change, and to repetition added with very
Strong repellence;
2, concealment, digital watermarking can not consciousness, do not influence the normal use of protected data;
3, robustness, refer to undergo it is a variety of be not intended to or intentional signal processing after, digital watermarking remains to holding part
Integrality simultaneously can accurately be identified;
4, sensibility, after distribution, transmission, use process, digital watermarking can accurately judge whether data are usurped
Change.
To add digital blind watermark by frequency domain means, realizing image copyright in the case where not destroying original artwork
Protection and tracking.It is proposed a kind of addition image blind watermarking method based on frequency domain.
Summary of the invention
In view of above-mentioned technical background, it is an object of the invention to: in the case where not destroying original artwork, pass through frequency domain hand
Duan Tianjia digital blind watermark realizes the protection and tracking of image copyright.
In order to solve the above technical problems, the present invention provides a kind of addition image blind watermarking method based on frequency domain, including
Following steps:
Step 1: watermark information is generated as by QR code watermark figure according to the error-correction level of the version number of QR code and QR code;
Step 2: the original image of input is pressed the size equal part of QR code watermark figure, and is calculated respectively using Image differentiation
Partial average gradient;
Step 3: the conversion in airspace to frequency domain is carried out to the highest multiple regions image of average gradient in step 2;
Step 4: watermarking images are encoded and are superimposed with frequency domain obtained in step 3;
Step 5: the inverse transformation for carrying out airspace to frequency domain obtains the output after addition watermark, the image exported;
Wherein, the average gradient includes the X of two-dimensional digital image, the differential in Y-direction, partial differential, amplitude, angle.
Preferably, the conversion regime of the airspace to frequency domain is constructed by two-dimensional fast fourier transform.
Preferably, the QR code watermark figure includes author's watermark, performing artist's watermark, record person watermark of recording a video;It calculates
The software full name watermark of machine software copyright, software abbreviation watermark, software version watermark, copyright owner and record date watermark.
Preferably, the region average gradient algorithm the following steps are included:
Step S1: watermark information is generated as by QR code watermark figure according to the error-correction level of the version number of QR code and QR code;
Step S2: pressing original image the size equal part of QR code watermark figure, and the gradient of each section is calculated using Image differentiation;
First differential is realized respectively using X-direction and Y-direction, finds out amplitude, realizes image gradient effect.One-dimensional differential formulas: Δ f
=f (x+1)-f (x) needs to complete the differential in XY both direction for two-dimensional digital picture, and the vector of gradient can indicate
Are as follows:
The amplitude of the vector are as follows:
The deflection of the vector are as follows:
Then partial differential is asked to XY both direction respectively, obtains gradient;
It is that region template carries out convolutional calculation using Sobel operator, the Sobel warp factor includes two group of 3 × 3 square
Battle array, it is respectively horizontal and vertical, Sobel operator and original image are done into convolution, obtain horizontal and vertical brightness difference approximation,
Formula is as follows:
Wherein, A represents original image, and Gx and Gy represent the gray value of image of horizontal and vertical edge detection, specific to calculate
It is as follows:
Gx=(- 1) * f (x-1, y-1)+0*f (x, y-1)+1*f (x+1, y-1)+(- 2) * f (x-1, y)+0*f (x, y)+2*
F (x+1, y)+(- 1) * f (x-1, y+1)+0*f (x, y+1)+1*f (x+1, y+1)=[f (x+1, y-1)+2*f (x+1, y)+f (x+
1,y+1)]-[f(x-1,y-1)+2*f(x-1,y)+f(x-1,y+1)]
Gy=1*f (x-1, y-1)+2*f (x, y-1)+1*f (x+1, y-1)+0*f (x-1, y) 0*f (x, y)+0*f (x+1,
Y)+(- 1) * f (x-1, y+1)+(- 2) * f (x, y+1)+(- 1) * f (x+1, y+1)=[f (x-1, y-1)+2f (x, y-1)+f (x+
1,y-1)]-[f(x-1,y+1)+2*f(x,y+1)+f(x+1,y+1)]
Wherein, f (a, b) represents the gray value of (a, b) point.
Step S3: airspace is carried out to the highest area image of average gradient in step 2 using two dimensional discrete Fourier transform
To the conversion of frequency domain;
Two-dimentional fast Fourier FFT is obtained by calculating FFT one-dimensional twice, the line number of image, columns is made to be all satisfied 2
N times side, if conditions are not met, first meeting 2 n times to image zero padding before calculating FFT;
The two dimensional image f (x, y) of one M row N column is first in one-dimensional discrete Fu that a length is N by row queue variable y
Leaf transformation, then by calculated result by column to variable x do a length be M Fourier transformation obtain the Fourier transformation of the image
As a result, as shown in formula:
It is exactly following two parts that above formula, which is disassembled, is first obtained F (x, v), then obtains F (u, v) by F (x, v):
Every a line is carried out discrete Fourier transform to the one-dimensional N point sequence of every a line and is obtained F (x, u) by N number of point, then right
F (x, u) is obtained by column to the discrete Fourier transform that each column are done with M point, just obtains the direct computation of DFT of two dimensional image f (x, y)
Leaf transformation F (u, v).
Step S4: watermarking images are encoded and are superimposed with frequency domain obtained in step S3;
Step S5: the inverse transformation for carrying out airspace to frequency domain obtains the image after addition watermark;
The mode of the inverse transformation are as follows: the two dimensional image f (x, y) of M row N column, when doing inverse Fourier transform, first to column
To doing one-dimensional inverse Fourier transform, then one-dimensional inverse Fourier transform is done to row, is shown below:
Preferably, the level of error correction of the QR code is that the mistake of maximum 30% can be corrected.
Preferably, the coding mode in the step S4 is encoded using random sequence.
A kind of addition image blind watermarking method based on frequency domain proposed by the present invention, beneficial effect are: the present invention utilizes
It is superimposed digital blind watermark, under the premise of guaranteeing that original image is basically unchanged, is superimposed at the transformation of QR code watermark by design part frequency domain
Reason, effectively remains image major part raw information, avoids the information loss as caused by the superposition of full figure frequency domain.
Detailed description of the invention
Fig. 1 is the flow diagram of present invention superposition watermark.
The flow diagram of the position Fig. 2 watermark extracting of the invention.
Specific embodiment
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete
Site preparation description, it is clear that described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.
Embodiment 1
A kind of addition image blind watermarking method based on frequency domain, comprising the following steps:
Step 1: watermark information is generated as by QR code watermark figure according to the error-correction level of the version number of QR code and QR code;QR
Code watermark figure includes author's watermark, performing artist's watermark, record person watermark of recording a video;The software full name of Copyright in Computer Software
Watermark, software abbreviation watermark, software version watermark, copyright owner and record date watermark;
Step 2: the original image of input is pressed the size equal part of QR code watermark figure, and is calculated respectively using Image differentiation
Partial average gradient;
Step 3: the conversion in airspace to frequency domain is carried out to the highest multiple regions image of average gradient in step 2;Airspace
Conversion regime to frequency domain is constructed by two-dimensional fast fourier transform;
Step 4: watermarking images are encoded and are superimposed with frequency domain obtained in step 3;
Step 5: the inverse transformation for carrying out airspace to frequency domain obtains the output after addition watermark, the image exported;
Wherein, average gradient includes the X of two-dimensional digital image, the differential in Y-direction, partial differential, amplitude, angle.
The algorithm of region average gradient the following steps are included:
Step S1: watermark information is generated as by QR code watermark figure according to the error-correction level of the version number of QR code and QR code;QR
The mode of code is divided into Model1 and Model2 both of which, uses Model2 in the present invention.In view of the attack to watermark, to mention
The agility and defense of high digital watermarking, the version for presetting QR code is 1, i.e. 21*21.The level of error correction of QR code is H, i.e., maximum
30% mistake can be corrected.
Step S2: pressing original image the size equal part of QR code watermark figure, and the gradient of each section is calculated using Image differentiation;
First differential is realized respectively using X-direction and Y-direction, finds out amplitude, realizes image gradient effect.One-dimensional differential formulas: Δ f
=f (x+1)-f (x) needs to complete the differential in XY both direction for two-dimensional digital picture, and the vector of gradient can indicate
Are as follows:
The amplitude of vector are as follows:
The deflection of vector are as follows:
Then partial differential is asked to XY both direction respectively, obtains gradient;
For discrete image, the mathematic(al) representation of first differential is equivalent to the difference of two adjacent pixels.Image gradient
Algorithm is the grey scale change for considering some neighborhood of each pixel of image, and it is region mould that Sobel operator is chosen in the present invention
Plate carries out convolutional calculation.Sobel warp factor are as follows:
Sobel warp factor includes two group of 3 × 3 matrix, respectively horizontal and vertical, and Sobel operator is done with original image
Convolution obtains horizontal and vertical brightness difference approximation, and formula is as follows:
Wherein, A represents original image, and Gx and Gy represent the gray value of image of horizontal and vertical edge detection, specific to calculate
It is as follows:
Gx=(- 1) * f (x-1, y-1)+0*f (x, y-1)+1*f (x+1, y-1)+(- 2) * f (x-1, y)+0*f (x, y)+2*
F (x+1, y)+(- 1) * f (x-1, y+1)+0*f (x, y+1)+1*f (x+1, y+1)=[f (x+1, y-1)+2*f (x+1, y)+f (x+
1,y+1)]-[f(x-1,y-1)+2*f(x-1,y)+f(x-1,y+1)]
Gy=1*f (x-1, y-1)+2*f (x, y-1)+1*f (x+1, y-1)+0*f (x-1, y) 0*f (x, y)+0*f (x+1,
Y)+(- 1) * f (x-1, y+1)+(- 2) * f (x, y+1)+(- 1) * f (x+1, y+1)=[f (x-1, y-1)+2f (x, y-1)+f (x+
1,y-1)]-[f(x-1,y+1)+2*f(x,y+1)+f(x+1,y+1)]
Wherein, f (a, b) represents the gray value of (a, b) point.
Step S3: airspace is carried out to the highest area image of average gradient in step 2 using two dimensional discrete Fourier transform
To the conversion of frequency domain.
The basic thought of Computing Two-dimensional Discrete Fourier Transform DFT separability is that DFT is separated into dimension DFT twice.Therefore
Two-dimentional fast Fourier fft algorithm can be obtained with by calculating FFT one-dimensional twice.According to the meter of Fast Fourier Transform (FFT)
It calculates and requires, need the line number of image, columns to be all satisfied 2 n times side, if conditions are not met, first to mend to image before calculating FFT
Zero with the n times of satisfaction 2.The two dimensional image f (x, y) of one M row N column, first doing a length by row queue variable y is the one-dimensional of N
Discrete Fourier transform, then by calculated result by column to variable x do a length be M Fourier transformation can be obtained by the figure
The Fourier transformation of picture is as a result, as shown in formula:
It is exactly following two parts that above formula, which is disassembled, is first obtained F (x, v), then obtains F (u, v) by F (x, v):
Every a line is carried out discrete Fourier transform to the one-dimensional N point sequence of every a line and is obtained F (x, u) by N number of point, then right
F (x, u) is obtained by column to the discrete Fourier transform that each column are done with M point, just obtains the direct computation of DFT of two dimensional image f (x, y)
Leaf transformation F (u, v).
Step S4: encoding watermarking images and be superimposed with frequency domain obtained in step S3, and coding mode uses random sequence
Coding.
Step S5: the inverse transformation for carrying out airspace to frequency domain obtains the image after addition watermark.
The mode of inverse transformation are as follows: the two dimensional image f (x, y) of M row N column, when doing inverse Fourier transform, first to column to doing
One-dimensional inverse Fourier transform, then one-dimensional inverse Fourier transform is done to row, it is shown below:
Embodiment 2
The picture exported to embodiment 1 carries out aggressive experiment, to verify the addition image blind watermarking side based on frequency domain
The robustness of method.
Picture after watermarking is smeared respectively, is sheared, is scaled, is rotated, JPEG compression, PS, screenshotss, brightness tune
After section, form and aspect adjusting, saturation degree adjusting, contrast adjustment, denoising, U.S. figure software processing, watermark can be extracted.
Embodiment 3
For the image of web page, addition image blind watermarking method of the use based on frequency domain is added treated back
Scape picture can also extract watermark after screenshot.
The foregoing is only a preferred embodiment of the present invention, but scope of protection of the present invention is not limited thereto,
Anyone skilled in the art in the technical scope disclosed by the present invention, according to the technique and scheme of the present invention and its
Inventive concept is subject to equivalent substitution or change, should be covered by the protection scope of the present invention.