Summary of the invention
The object of the present invention is to provide a kind of digital image tampering detection method with stealthy watermark, can effectively detect host image and whether distort.
The technical solution adopted in the present invention is: with the digital image tampering detection method of stealthy watermark, it is characterized in that, comprise the steps:
Step 1: digital picture is carried out to stealthy watermark encrypting: host image and encrypted watermark image are represented with picture element matrix form respectively, the picture element matrix of encrypted watermark image is embedded in host image through watermark encrypting algorithm;
Step 2: the digital picture with stealthy watermark is decoded: the picture element matrix that extracts reductive water watermark image from the picture element matrix of host image through watermark decode algorithm;
Step 3: relatively encrypted watermark image and reductive water watermark image: if the picture element matrix of encrypted watermark image equate with the picture element matrix of reductive water watermark image, illustrate that host image is not tampered, otherwise, illustrate that host image is tampered.
Described watermark encrypting algorithm comprises the steps:
1) host image and encrypted watermark image are represented with picture element matrix form respectively:
If the picture element matrix of host image by N capable × a M row arrangement of subpixels forms, and is designated as A
nM, A
nMin the sub-pixel of capable, the j of i row be designated as a
ij; Wherein, 1≤i≤N, 1≤j≤M, 0≤a
ij≤ 255;
If the picture element matrix of encrypted watermark image by n capable × a m row arrangement of subpixels forms, and is designated as B
nm, B
nmin the sub-pixel of capable, the t of s row be designated as b
st; Wherein, 1≤s≤n, 1≤t≤m, 0≤b
st≤ 255;
Wherein, N >=n, M >=3m;
2) extract B
nmhundred, ten, individual position of sub-pixel: establish sub-pixel b
sthundred, ten, individual position be designated as respectively x, y, z;
3) by A
nMin the position of sub-pixel to be encrypted make zero: selected A
nMthe middle value of being expert at is not more than n, and the sub-pixel that place train value is not more than 3m is sub-pixel to be encrypted, made zero in a position for sub-pixel to be encrypted, and the sub-pixel a'' after i is capable, j row make zero
ijrepresent;
4) encrypted watermark image is embedded to host image: by A
nMin the sub-pixel of capable, the j of i row after encrypting be designated as
By sub-pixel b
sthundred x and a''
s (3t-2)be added,
By sub-pixel b
stten y and a''
s (3t-1)be added,
By sub-pixel b
stposition z and a''
s (3t)be added,
The rest may be inferred, until by B
nmin all sub-pixels be embedded into A
nMin, A
nMin the sub-pixel that is not encrypted remain unchanged, obtain thus the image pixel matrix C after encrypting
nM.
Described watermark decode algorithm comprises the steps:
1) selected C
nMthe middle value of being expert at is not more than n, and the region that place train value is not more than 3m is region to be decoded;
2) in region to be decoded, with behavior unit, from left to right successively at C
nMin get three sub-pixels, and extract the units of three sub-pixels: establish from C
nMin three capable got sub-pixels of p be respectively
wherein,
units be designated as x ',
units be designated as y ',
units be designated as z ';
3) units of three sub-pixels is multiplied by respectively to 100,10,1, and summation, reduction draws the picture element matrix of reductive water watermark image
in sub-pixel:
represent
in p capable,
the sub-pixel of row.
Compared with prior art, the beneficial effect that the present invention reaches: a kind of digital image tampering detection method with stealthy watermark is provided, and its algorithm is simple, easy to operation, can judge that whether image distorts detection, is beneficial to copyright protection fast; By adjusting unessential data, less on the visual effect impact of original image; And the method calculated amount is little, requirement of real time.
Embodiment
Following examples are only for technical scheme of the present invention is more clearly described, and can not limit the scope of the invention with this.
As shown in Figure 1, with the digital image tampering detection method of stealthy watermark, comprise the steps:
Step 1: digital picture is carried out to stealthy watermark encrypting: host image and encrypted watermark image are represented with picture element matrix form respectively, the picture element matrix of encrypted watermark image is embedded in host image through watermark encrypting algorithm.
Watermark encrypting algorithm comprises the steps:
1) host image and encrypted watermark image are represented with picture element matrix form respectively:
If the picture element matrix of host image by N capable × a M row arrangement of subpixels forms, and is designated as A
nM, A
nMin the sub-pixel of capable, the j of i row be designated as ai
j; Wherein, 1≤i≤N, 1≤j≤M, 0≤ai
j≤ 255;
If the picture element matrix of encrypted watermark image by n capable × a m row arrangement of subpixels forms, and is designated as B
nm, B
nmin the sub-pixel of capable, the t of s row be designated as b
st; Wherein, 1≤s≤n, 1≤t≤m, 0≤b
st≤ 255;
Wherein, N >=n, M >=3m;
2) extract B
nmhundred, ten, individual position of sub-pixel: establish sub-pixel b
sthundred, ten, individual position be designated as respectively x, y, z;
3) by A
nMin the position of sub-pixel to be encrypted make zero: selected A
nMthe middle value of being expert at is not more than n, and the sub-pixel that place train value is not more than 3m is sub-pixel to be encrypted, made zero in a position for sub-pixel to be encrypted, and the sub-pixel a'' after i is capable, j row make zero
ijrepresent;
4) encrypted watermark image is embedded to host image: by A
nMin the sub-pixel of capable, the j of i row after encrypting be designated as
By sub-pixel b
sthundred x and a''
s (3t-2)be added,
By sub-pixel b
stten y and a''
s (3t-1)be added,
By sub-pixel b
stposition z and a''
s (3t)be added,
The rest may be inferred, until by B
nmin all sub-pixels be embedded into A
nMin, A
nMin the sub-pixel that is not encrypted remain unchanged, obtain thus the image pixel matrix C after encrypting
nM.
Now for example above-mentioned watermark encrypting algorithm is further explained to explanation: host image is represented with picture element matrix form, be assumed to be hypothesis A
nMbe 8 row 8 column matrix:
Equally, encrypted watermark image is represented with picture element matrix form, suppose B
nmbe 2 row 2 column matrix:
Suppose a
11=207, a
12=143, a
13=89, b
11=120, extract b
11hundred, ten, individual position be designated as respectively x,
y, z, x=1,
y=2, z=0, with b
11corresponding sub-pixel to be encrypted is a
11, a
12, a
13, by a
11, a
12, a
13position make zero, obtain a''
11, a''
12, a''
13, a''
11=200, a''
12=140, a''
13=80, then by x and a''
11be added, obtain
by y and a''
12be added, obtain
by z and a''
13be added, obtain
identical, if a
14=137, a
15=123, a
16=29, b
12=13,
If a
21=47, a
22=142, a
23=189, b
21=246,
If a
24=242, a
25=172, a
26=191, b
22=135,
A
8 × 8in the sub-pixel that is not encrypted remain unchanged, obtain thus the image pixel matrix C after encrypting
8 × 8:
Step 2: the digital picture with stealthy watermark is decoded: the picture element matrix that extracts reductive water watermark image from the picture element matrix of host image through watermark decode algorithm;
Watermark decode algorithm comprises the steps:
1) selected C
nMthe middle value of being expert at is not more than n, and the region that place train value is not more than 3m is region to be decoded;
2) in region to be decoded, with behavior unit, from left to right successively at C
nMin get three sub-pixels, and extract the units of three sub-pixels: establish from C
nMin three capable got sub-pixels of p be respectively
wherein,
units be designated as x ',
units be designated as y ',
units be designated as z ';
3) units of three sub-pixels is multiplied by respectively to 100,10,1, and summation, reduction draws the picture element matrix of reductive water watermark image
in sub-pixel:
represent
in p capable,
the sub-pixel of row.
Now with the image pixel matrix C after encrypting
8 × 8for example:
To C
8 × 8the computing of decoding, the picture element matrix B of known encryption watermarking images
nmbe 2 row 2 column matrix, i.e. n=m=2, C
8 × 8middle row value is not more than 2, and it is region to be decoded that train value is not more than 6 region, from C
8 × 8the first row starts, and 3 are one group and get sub-pixel from left to right, and first group is:
units be designated as x '=1,
units be designated as y '=2,
units be designated as z '=0;
Second group is:
units be designated as x '=0,
units be designated as y '=1,
units be designated as z '=3;
after the first row has been decoded, continue the second row decoding, draw
Obtain thus the picture element matrix of reductive water watermark image
Step 3: relatively encrypted watermark image and reductive water watermark image: if the picture element matrix of encrypted watermark image equate with the picture element matrix of reductive water watermark image, illustrate that host image is not tampered, otherwise, illustrate that host image is tampered.Even B
2 × 2with
equate, illustrate that host image is not tampered, otherwise, illustrate that host image is tampered.
The above is only the preferred embodiment of the present invention; it should be pointed out that for those skilled in the art, do not departing under the prerequisite of the technology of the present invention principle; can also make some improvement and distortion, these improvement and distortion also should be considered as protection scope of the present invention.