Summary of the invention
The technical problem to be solved in the present invention is: overcome the deficiencies in the prior art, a kind of reversible image watermark based on the self-adaptation difference expansion is provided, the method, in the situation that the embed watermark data are more, can provide larger embedding capacity and better picture quality.
The technical solution adopted for the present invention to solve the technical problems: a kind of reversible image watermark based on the self-adaptation difference expansion comprises watermark embed process, watermark extraction process and image recovery process; Before watermark embeds, first need original image is carried out to pre-service, comprise alternately division, difference calculating, computed image complexity parameters; In telescopiny, use the self-adaptation expansion to carry out corresponding watermark embedding; Then will embed additional information, watermark data meeting and additional information are mixed embedding under specific circumstances; In leaching process, at first carry out the additional information extraction, difference is calculated; Then carry out the inverse operation of self-adaptation difference expansion, carry out the watermark data extraction and reduce original difference; Finally by the difference after reduction, carry out the reduction of image;
Preprocessing process is:
(1) alternately divide.Original image is replaced to division, obtain two disjoint set of pixels S
1And S
2, and be each pixel structure context in image, so that the realization that the calculating of image complexity afterwards and pixel are estimated.
(2) difference is calculated.Use the context constructed in preprocessing process step (1), the estimated value of each pixel in computed image, then by with original pixels relatively ask difference, this step can be divided into successively two parts: first at first, utilize S
1In pixel estimate S
2In pixel, S now
1For original pixel value; Then second portion, utilize S
2In pixel estimate S
1In pixel, S now
2For the pixel value after embed watermark.
(3) parameter setting.This step mainly comprises the parameter setting of two aspects, at first for original image, utilizes the statistical property of generalized Gaussian distribution, and the feature that calculates image complexity is described α; Then, according to the embed watermark data the number, determine two parameter c and the T of self-adaptation difference expansion, last, when user's demand can not be satisfied, can also judge whether that report embeds unsuccessfully.
In watermark embed process, it is to expand by self-adaptation the process that user data is embedded to carrier image after parameter is determined that watermark data embeds.In specific situation, watermark data can and additional information mixing and be embedded into, at this moment just needing assurance watermark data and additional information to distinguish can be synchronous.Additional information embeds.After user data (or partial information) is embedded into, some additional informations are generally arranged, comprise parameter c here, the position table of T and recording pixel flooding information, also need to adopt certain strategy that they are embedded in carrier image thus.It is necessary that these additional informations start watermark extracting often, thereby need to guarantee that it can be calculated at first when watermark extracting.As shown in Figure 2, it is replaced additional information mode with LSB (least significant bit (LSB)) is embedded in image edge pixels a simple strategy.
The extraction of the reversible image watermark based on the self-adaptation difference expansion and image restoring process are:
1) additional information is extracted.At first this requirements of process obtains starting the necessary additional information of watermark extracting, two parameter c and the T that comprise the self-adaptation difference expansion, the image complexity parameter alpha, in addition, if watermark extracting starts, it also will obtain carrying out the additional information that next step watermark extracting instructed is position table information.For example, need to know whether next difference was expanded, or need to know which kind of situation is identifying the end of all leaching process.
2) difference is calculated.It is identical that this process and difference in watermark embed process are calculated, and will accomplish that difference when embedding is calculated and accomplish to mate fully.Here, be mainly that the division of pixel is consistent, it should be noted that watermark is first S while embedding
2Rear S
1, and be first S while extracting
1Rear S
2.
3) watermark data extracts.This step is mainly to carry out the inverse operation of self-adaptation difference expansion to extract data the original difference of reducing.When extracting operation, need the information in the reference position table, because some pixel is because overflow problem does not carry out the watermark embedding.
4) image restoring.This step need to revert to original state by current pixel by difference and the reference environment after reduction.
The advantage that the present invention compared with prior art had is:
(1) the present invention obtains the different complexity of image each several part by generalized Gaussian distribution, the watermark of carrying out adaptive difference expansion embeds and extracts, carry out a small amount of embedding in the zone of image complexity, the embedding of mass data is carried out in the zone mild at image, compare classic method, obviously increased the embedding capacity of watermark and improved the visual quality of image.
(2) the present invention due to complete structure context, therefore when identical PSNR, than conventional method, improved capacity distortion ratio.
(3) the present invention, by the image plateau region, embedding more watermark, when the embed watermark data are more, can obtain better effect.
Embodiment
The present invention is at first based on the Gaussian statistics characteristic, obtain image complexity, then proposing a kind of new pixel division alternately divides and obtains the context estimation model, and then obtain the estimation difference, finally utilize existing image complexity and estimation difference to carry out the self-adaptation difference expansion, realize embedding and the extraction of watermark.
As shown in Figure 1, overall flow of the present invention comprises watermark embedded part and watermark extracting part two large divisions.The watermark embedded part comprises preprocessing process and watermark embed process; Watermark extracting partly comprises extracts preprocessing process and watermark extraction process.Before watermark embeds, first need original image is carried out to pre-service, preprocessing process comprises alternately division, difference calculating, computed image complexity parameters, as shown in dotted line frame in upper left side in Fig. 1; In watermark embed process, use the self-adaptation expansion to carry out corresponding watermark embedding, then will embed additional information, in lower dashed line frame as left as Fig. 1 as shown in.In extracting preprocessing process, at first carry out the additional information extraction, difference is calculated, and then carries out the inverse operation of self-adaptation difference expansion, carries out the watermark data extraction and reduces original difference, as shown in dotted line frame in upper right side in Fig. 1; Finally in watermark extraction process, by the difference after reduction, carry out the extraction of watermark and the reduction of image, as shown in dotted line frame in right side in Fig. 1.Below introduce in detail respectively above-mentioned Four processes, preprocessing process and watermark embed process, extract preprocessing process and watermark extraction process.
1. as shown in Figure 1, preprocessing process specific implementation step of the present invention is as follows:
Step 1: alternately divide.For adaptive difference expansion, need build context model by all pixels around current pixel.Consider in eight pixels around current pixel, with current pixel immediate be laterally with four pixels longitudinally, therefore next hereinafter textural by these four pixels, as shown in Figure 3.Make original image be
L={x (i, j) | 1≤i≤H, 1≤j≤W}, i, j is pixel coordinate position (1)
Wherein H and W distinguish the height and width of presentation video.In order to give each pixel structure context, at first all pixels in original image are divided into to two disjoint set of pixels S
1And S
2, alternately divide, as shown in Figure 4, set of pixels by
Mean respectively, 1≤i≤H1≤j≤W wherein, mod is the remainder number,
For XOR, because the pixel of image border (showing with grey in Fig. 4) does not have complete context, so the present invention does not carry out difference expansion to it.
Step 2: difference is calculated.For the context built, calculate the estimated value of each pixel in image, then by with original pixels relatively obtain its difference.This step can be divided into successively two parts, and at first first, utilize S
1In pixel estimate S
2In pixel, S now
1For original pixel value; Then second portion, utilize S
2In pixel estimate S
1In pixel, S now
2For the pixel value after embed watermark.
Specific algorithm is divided into four neighbor pixels level and the vertical direction of quadrature, and as shown in Figure 5, neighbor pixel is respectively x
u, x
d, x
l, x
r, calculate respectively the mean value of two pixels of each direction, and the pixel x that gives the different weights Yi Dui center of these two mean values is estimated.The mean value of both direction is calculated by formula (3).
Make vertical direction mean value x
vWith horizontal direction mean value x
hWeights be w
v, w
h,
Account form be
Make σ (h) and σ (v) be respectively the mean square deviation of level and vertical direction, press formula
Calculated, wherein x
avgMean value for adjacent pixel
And order S
vAnd S
hFor the pixel set:
Weight w
vAnd w
hComputing method be
When the estimated value that obtains pixel
After, can basis
Calculate the evaluated error of x.S
1And S
2The set E that forms of evaluated error
1And E
2For
The evaluated error that wherein e (i, j) is the pixel x (i, j) that calculates by formula (9).These two evaluated error set will be used to the embed watermark data.
Step 3: parameter setting.This step mainly comprises the parameter setting of two aspects, at first calculates image complexity; Then, according to the embed watermark data the number, determine two parameter c and the T of self-adaptation difference expansion, last, when user's demand can not be satisfied, can also judge whether that report embeds unsuccessfully.
The estimation of image complexity: utilize the form parameter of density function of the generalized Gaussian distribution (GGD) in wavelet field as the parameter of measurement of image complexity, the estimation of image complexity is converted to the estimation of the form parameter of pair-density function thus, by curve-fitting method, estimated, and order finally to obtain estimated value be image complexity α.
For generalized Gaussian distribution, generally consider the situation of Gaussian distribution average u=0.If x=is (x
1, x
2..., x
n) be the sample from the overall X of GGD of average u=0, because GGD is symmetrical, its first moment about the origin is zero, therefore can adopt absolute moment to be calculated.
When u=0, the single order absolute moment is
Order
Obtain x=β y
1/ α,
The above-mentioned formula of substitution obtains
Again will
Substitution obtains
In like manner can obtain second moment is
m
2=E{|x
2|}=σ
2 (14)
R (α) is called to the Generalized Gaussian parameter ratio function; And m
1, m
2Estimation
Can be obtained by following formula
Thereby form parameter α is estimated as
Wherein
The inverse function R of R (x)
-1(x) analytic expression is difficult to try to achieve, therefore adopt the method for numerical fitting.
Hyperbolic function matching original function R (x) sets up model of fit y=a+b/x, adopts least square fitting, obtains antiderivative approximating function and is
Thereby the original function of approximating function is
Therefore model of fit is
Utilize least square method to try to achieve contrafunctional fitting function to be
In sum, obtain the estimation of parameter alpha by formula (17) and (20), and then obtained image complexity.
Determine two parameter constant c and the embedding capacity T of self-adaptation difference expansion, as shown in Figure 5, the steady degree in zone is passed through variances sigma
2Obtain,
Wherein
Thus, the radix of difference expansion can pass through
Wherein, c is constant, the complexity that α is carrier image, and T is threshold value, c and T are used for the embedding capacity of watermark of control chart picture.In order to prevent that pixel from overflowing seriousization, need to guarantee 2≤T≤10, for constant c, in general, its value is larger, and the watermark of embedding is more but distortion image is more serious, and vice versa.
2. watermark embed process
In watermark embed process, by image complexity α, self-adaptation spreading parameter c and T, determine self-adaptation expansion radix b
Ij.Suppose w mean length be l treat the water mark inlaying data, in order to express easily, make w=w
1, w
2..., w
n, wherein n=l/8 and w
1, i=1,2 ... n comprises 8 bit binary data.Next provide its detailed performing step:
(2.1) determine self-adaptation expansion radix b
Ij, by image complexity α, and self-adaptation spreading parameter c and T, by formula, calculate
Determine self-adaptation expansion radix b
Ij, σ wherein
2For variance, for weighing the steady degree in zone;
(2.2) suppose that w means the scale-of-two watermark data for the treatment of embedding that length is l, the piece that w is divided into to n 8, make w=w
1, w
2..., w
n, wherein n=l/8 order w
t, t=1,2 ... n comprises 8 bit binary data;
(2.3) read watermark data w
t, and be converted into decimal system w
Dt, in order to judge w
DtWhether embed completely, provide variable u and identified, initialization u is 1;
(2.4) scanning carrier image, for concrete pixel x
Ij, known estimated value x
Ij', self-adaptation expansion radix b
Ij, estimate difference e
Ij, pass through r
I, j=w
D, rMod b
IjObtain final embedding content r herein
I, j, then utilize formula
Carry out the self-adaptation embedding, thereby obtain embedding rear pixel value x
Ij";
In self-adaptation telescopiny in (2.4), if x ">255 or x "<0, the watermark of skipping this pixel embeds, and utilizes position and the pixel flooding information of position this pixel of table record;
(2.5), after step (2.4) has embedded, upgrade
U=u * b
IjIf u>255, read in next watermark data w
T+1Juxtaposition u=1, proceed to step (2.3) and embed the next bit watermark; Otherwise proceed to step (2.4) and continue w
D, tEmbedding;
(2.6) carry out the additional information embedding, described additional information comprises parameter c, T, and parameter alpha is the position table of recording pixel flooding information in image complexity and telescopiny (2.5); So far watermark embed process finishes, and obtains embedding rear image;
After watermark has embedded, carry out the additional information telescopiny.Additional information comprises parameter c, the position table of T and recording pixel flooding information.These additional informations are that the startup watermark extracting is necessary, thereby need to guarantee that it can be calculated at first when watermark extracting.As shown in Figure 2, the mode that additional information is replaced with LSB is embedded in image edge pixels a simple strategy.So far watermark embeds and finishes, and obtains embedding rear image.
3. watermark extracting partly comprises the extraction preprocessing process.
Extract preprocessing process, at first extract additional information, this flow process is the inverse process that additional information embeds.
(3.1) at first carry out the additional information leaching process, this process is the inverse process that additional information embeds, obtain two parameter c and the T of self-adaptation difference expansion, image complexity parameter alpha and position table, if for example use being embedded in image edge pixels that additional information is reversible of LSB (least significant bit (LSB)) mode, can use the watermark extracting algorithm of LSB, additional information is extracted from image edge pixels;
(3.2) then by division identical in the preprocessing process embedded with watermark, carry out difference calculating, this process is calculated identical with the difference in preprocessing process (2.1), and accomplish that difference when embedding is calculated and accomplish to mate fully, the division that is pixel is consistent, because watermark embeds time difference value, calculating is first set of computations S
2Difference, then use S
2Result calculate S
1Difference, so be first to calculate S while extracting
1Difference, then calculate S
2Difference;
4. watermark extraction process
Watermark extraction process is watermark extracting and image restoring process: the extraction by additional information has obtained image complexity α, self-adaptation spreading parameter c, T and position table, and, after utilizing contextual structure to obtain the estimation difference of embedded images, next provide its detailed performing step:
Described watermark extraction process, be the inverse process of telescopiny, and concrete steps are as follows:
(4.1) initialization marking variable u is 1, because the embedding of watermark is not carried out in the zone, image border, so to the zone of i=1 or j=1, image pixel remains unchanged, direct-reduction;
(4.2) scanning embedded images, for concrete pixel x ", known estimated value x ', self-adaptation expansion radix b
Ij, the estimation difference e '
Ij, pass through formula
r
ij=e
ij′%b
ij,b
ij≠1
Obtain embed watermark r herein
I, j, then utilize formula
Recover original difference e
Ij, and then obtain the image original pixels;
In leaching process in (4.2), if recorded this position in the table of position, skip the watermark extracting of this position, keep pixel constant simultaneously.
(4.3) after step (4.2) has been extracted, by r
I, j, b
IjPut into respectively set R
t, B
tIn, r
I, j, b
IjIn i, j is coordinate, it is at R
t, B
tIn position be the order of putting into, and upgrade u=u * b
Ij
If u>255, the size that note is now gathered R is m, passes through formula
Complete watermark w
t=w
t(1), again put u=1, carry out step (4.2) and extract next bit watermark w
T+1If step (4.2) is proceeded in u≤255 item.
The content be not described in detail in instructions of the present invention belongs to the known prior art of professional and technical personnel in the field.