Semi-fragile watermarking with zero false alarm embeds and detection method
Technical field
The present invention relates to a kind of semi-fragile watermarking with zero false alarm and embed and detection method, be applicable to that the very high rest image of security requirement is distorted to detect and the location.
Background technology
The semi-fragile watermarking technology has obtained more and more scholars' concern in recent years.Its principal feature comprises:
1. watermark is invisible.
2. has the detectability of distorting.
3. can resist the JPEG compression.
4. do not need original image when detecting.
5. has the tampering location ability.
6. powerful encryption, opposing malice is distorted with watermark and is forged.
7. zero false alarm.
At present a lot of semi-fragile watermarking technology can both satisfy the first five items requirement.For the not high application of security requirement, first five items requires enough.But for the very high application of security requirement, distort detection as bank money, back two requirements are also most important.Can be good at resisting watermark forges technology at present seldom, and can realize that the technology of zero false alarm yet there are no open report.Distort detection for bank money, the appearance of false alarm will cause being difficult to determining whether image is distorted, and produces the problem that the user reduces the digital watermark degree of belief.
The digital watermark of existing main flow comprises three major types: based on least significant bit (LSB), based on discrete cosine transform (DCT) territory, based on wavelet field.Algorithm advantage based on LSB is to have very high Y-PSNR (PSNR), document " Protection of digital images using self embedding " (J.Fridrich and M.Goljan for example, in Proceedings of NJIT Symposium on ContentSecurity and Data Hiding in Digital Media, May 1999) proposed the DCT coefficient of each 8*8 piece is embedded the LSB of another piece, so not only PSNR is very high, but also can recovery to a certain degree be distorted part.But its limitation is also very outstanding, and promptly it can not be distinguished the lossy compression method and the malice that do not change picture material and distorts.And along with the continuous increase of the quantity and the size of image, compression of images is more and more significant for saving transmission and storage resources, so can distinguish compression and the algorithm distorted of malice becomes essential, therefore in recent years more research steering DCT territory and wavelet field.JPEG2000 than JPEG upgrade, rest image compress mode with better function, be based on wavelet field.But before JPEG2000 finally replaced JPEG, JPEG also will continue to occupy the leading position of rest image compression.And for jpeg image, because the JPEG compression is based on the DCT territory, so DCT territory embed watermark is the most direct and effective.At present the watermarking algorithm in DCT territory is many, and wherein majority is ignored the false alarm problem, thinks that very little false alarm probability can ignore.
Watermark embeds after the DCT territory, and when being transformed into spatial domain, all pixels all will be rounded to integer from floating number; Have some pixel simultaneously and exceed [0,255], no matter and image is that show all will be in [0,255], so off-limits value will be mapped to 0 or 255 or store.Error when rounding off is called round-off error, and the error during mapping is called shearing error.When image when spatial domain is transformed into the DCT territory once more, these two kinds of errors all can cause the variation of DCT domain coefficient, thereby cause the watermark that has embedded destroyed, thereby produce false alarm.And because the color space that JPEG adopts is YUV, and images such as BMP are to adopt RGB, and in the coloured image format conversion, the conversion of color space also can bring some transformed errors to cause false alarm.
Document " Semi-fragile watermarking scheme for authentication ofjpeg images " C.K.Ho and C.T.Li for example, International Conference onInformation Technology:Coding and Computing, vol.01, p.7, April2004.) propose watermark information is embedded last 4 of non-zero in the coefficient after the DCT piece quantizes.Because do not have special measure at false alarm, false alarm is inevitable.
By retrieval, found one piece of scientific paper (C.Y.Lin and S.F.Chang, " Semi-fragilewatermarking for authenticating jpeg visual content; " in Security andWatermarking of Multimedia Contents II, January 2000), claim and designed the watermarking algorithm with zero false alarm: SARI.Paper proposes cyclic transformation between DCT territory and spatial domain, rounds, till the DCT coefficient is constant through such conversion (convergence).At first such method is for the sub-fraction piece, and the DCT coefficient is not restrained.If secondly this method was carried out in the past at embed watermark, then the embed watermark process will be destroyed DCT coefficient convergence, if carry out after embed watermark, then this operation can destroy the watermark that has embedded.So it is this method does not reach the purpose of thorough elimination false alarm, necessary with new method.
Summary of the invention
The objective of the invention is at the deficiencies in the prior art, propose a kind of semi-fragile watermarking and embed and detection method, distorting of digital picture had stronger detection and station-keeping ability, realize zero false alarm with zero false alarm.
Be to realize this purpose, the present invention carries out linear mapping and low-pass filtering pre-service to original image earlier before embed watermark, be transformed into the DCT territory with image block and by piece then, and to the DCT parameter quantification, watermark is added on the parameter after low frequency part quantizes.Every watermark information is by block address, and DC position and preset password are formed, and by md5 encryption, draws a plurality of addresses and two value informations corresponding with each address in the low frequency range.Then each two value information is embedded in the DCT quantized value of corresponding address bit by default look-up table.During watermark detection, same method draws every block address during with embed watermark to the image of embed watermark, DC position and password, and calculate the address and the two corresponding value informations thereof of low frequency embed watermark.Use the JPEG quantization table to the DCT parameter quantification then, and same look-up table is found two value informations of the DCT parameter correspondence of being determined by the address during by embed watermark.Whether coupling according to two value informations has judged whether to distort, and finishes and detects and the location.
Method of the present invention comprises watermark embedding and watermark detection two big steps, and is specific as follows:
Watermark embed process:
Before embed watermark, original image is carried out pre-service, the image linearity is mapped in [20,235], and carries out low-pass filtering, to avoid round-off error and shearing error.Wave filter selection standard variance is the gauss low frequency filter of 0.6 3*3.Then according to the JPEG compression method, image is divided into the piece of nonoverlapping 8*8, be transformed into the DCT territory by piece, to the DCT parameter quantification, watermark is added on the parameter after low frequency part (remove the DC position, DC refers to DC component) quantizes with the JPEG quantization table.Every watermark information is by block address, and DC position and preset password are formed, and by md5 encryption, obtains a plurality of addresses and two value informations corresponding with each address in the low frequency range.Respectively each two value information is embedded in the DCT quantized value with this two value informations corresponding address position by a default look-up table then.Look-up table is the mapping of integer to two codomains.
Watermark detection process:
To the image of embed watermark, same method piecemeal during with embed watermark, dct transform and to the quantification of DCT parameter obtain every block address, DC position and password, and obtain the address and the two corresponding value informations thereof of low frequency embed watermark by MD5; Use the JPEG quantization table to the DCT parameter quantification then, and same look-up table is found two value informations of the DCT parameter correspondence of being determined by the address during by embed watermark; With these two value informations found and the previous two value informations contrast corresponding with low frequency embed watermark address, whether both are consistent, distort if mate entirely then illustrate not have, otherwise illustrate that this piece is distorted.So just reached the function of distorting detection and tampering location.
The present invention carried out linear mapping and filter preprocessing to original image earlier before watermark embeds, after this embed watermark just round-off error and shearing error can not occur again, make watermark can resist the influence of the error among the DCT and anti-dct transform in coloured image space conversion and the second-compressed process, thereby realized zero false alarm.And linear mapping is very little to the quality decline that image causes, and can ignore; Also in the scope that can tolerate, PSNR reaches 42 in the quality decline that low-pass filtering causes.
Method of the present invention can make the image that embedded watermark and be difficult to recognize difference with original image, and encryption function is strong, and has stronger tampering location ability, distorts for not tampered image or non-malice, and the bit error rate is zero; Distort for malice, the bit error rate is less than 2%.
The present invention has realized the zero false alarm under the situation of DCT territory embed digital watermark, and for the very high application of security requirement, this characteristic will be brought the remarkable minimizing of maintenance cost.
Description of drawings
Process flow diagram when Fig. 1 embeds for watermark of the present invention.
The process flow diagram of Fig. 2 during for watermark detection of the present invention.
Original image---the bill that Fig. 3 adopts for the embodiment of the invention.
Fig. 4 is the image behind the embed watermark.
The image of Fig. 5 for Fig. 4 having been carried out distort.
Fig. 6 is for distorting detection and location figure.
Embodiment
Below in conjunction with drawings and Examples technical scheme of the present invention is further described.
Method of the present invention comprises watermark embedding and watermark detection two parts.
Watermark embed process:
In the embodiments of the invention, at first image transformation is encoded to YUV, only luminance component Y is done watermark and embed and detect.Watermark embed process before embed watermark, carries out pre-service to original image earlier as shown in Figure 1, comprises linear mapping and low-pass filtering.If the image pixel value scope exceeds [20,235], then its linearity is hinted obliquely at [20,235], linear mapping F is defined as:
offset=20
P
min=MIN(MIN(I
k),offset)
P
max=MAX(MAX(I
k),255-offset)
Linear mapping F:x → y (x ∈ Z, y ∈ Z, y ∈ [P
Min, P
Max])
With the low pass window filter image is carried out filtering then, wave filter selection standard variance is the gauss low frequency filter of 0.6 3*3.Through original image I is carried out pre-service, obtain I '.
Image through after such pre-service again embed watermark round-off error and shearing error can not appear just.And linear mapping is very little to the quality decline that image causes, and can ignore; Also in the scope that can tolerate, PSNR reaches 42 in the quality decline that low-pass filtering causes.
The method that adopts with the JPEG compression is divided into nonoverlapping I of 8*8 with I '
p(p ∈ N, p≤m, m are total block data) transforms to the DCT territory by piece again and obtains D
p, to D
pQuantize to obtain Q
pQuantize with JPEG compression standard quantization table, present embodiment employing mass parameter is 50 quantization table.
Watermark is added on the parameter after low frequency part (remove DC position) quantizes.Every watermark information W
pBy the positional information (block address) of this piece, the value of the DC position of this piece and preset password are formed.
With the Hash cryptographic algorithm to watermark information W
pCalculate multidigit address code A
p(i) the two-value sign indicating number B of (i ∈ N, i≤n, n are the address code number) and each address correspondence
p(i).N=6 in the present embodiment.Present embodiment adopts MD5 to W
pCalculate summary, then summary is divided into 6 parts, in every part, extract an address code A respectively
p(i) and a two-value sign indicating number B corresponding with the address
p(i).Address code is selected as the parameter in certain region S in piece DCT.Preestablishing low frequency range S is second to the 9th that arranges according to the zigzag mode, wherein finds 6 embed watermarks.
According to A
pAnd B
pTo Q
pEmbed watermark.At first design a look-up table T, T is the mapping of integer to two codomains:
T:z→b(z∈Z,b∈{0,1})
It is long continuous 0 or 1 to avoid two codomains to occur when setting look-up table T, to avoid excessive to the DCT parameter change.
To each address code A
p(i) pairing Q
p(A
p(i)) obtain two-value sign indicating number B by the T mapping
p' (i):
B
p’(i)=T(Q
p(A
p(i)))
(i≤n) is if B for any i
p' (i) ≠ B
p(i), then with Q
p(A
p(i)) change into by T and be mapped to B
p(i) immediate value.Q
pObtain WQ behind the embed watermark
p
WQ
pCan obtain jpeg image output by Huffman coding, also can inverse quantization, obtain the image WI behind the spatial domain embed watermark behind the anti-piece DCT.
Watermark detection process:
Fig. 2 has provided watermark detection process of the present invention.
When detecting watermark, to the image of embed watermark, method same during with embed watermark obtains I with image WI ' piecemeal to be detected
p', transform to the DCT territory again and obtain D
p'.To D
p' quantize to obtain Q
p'.Use the positional information of piece then, the value of the DC position of piece and the watermark information W of preset password blocking
p'.Use W again
p' calculate n address code A by MD5
p' (i) and n two-value sign indicating number B
p' (i).To with each address code A
p' (i) corresponding Q
p' (A
p' (i)), look-up table T mapping same by with embed watermark the time obtains two-value sign indicating number B
p" (i).For each piece p, if, B is arranged for all i≤n
p' (i)=B
p" (i), then this piece is judged to be and is not distorted, and is distorted otherwise be judged to be.Also realized simultaneously positioning function.
Performance test
Fig. 3~Fig. 6 is the test result of one embodiment of the invention.Fig. 3 is the scintigram of a bill.Fig. 3 embed watermark is obtained Fig. 4.The image deterioration of Fig. 4 is invisible, comparison diagram 3 Fig. 4, and naked eyes can not discovered difference.Fig. 5 distorts Fig. 4, and unit price 2.00 has changed 2222.00 into.Fig. 6 is for distorting detection and location figure, and the shadow region indicates the place of distorting generation.Distort detection and locate successfully.
From implementation result, the inventive method has good characteristic:
1, watermark is invisible.The image and the former figure that embedded watermark are difficult to recognize difference.The JPEG mass parameter is 50 o'clock, and Y-PSNR is 42.
2, has the detectability of distorting.Distort (the JPEG mass parameter is in the compression more than 70) for not tampered image or non-malice, the bit error rate is zero; Distort for malice, the bit error rate is less than 2%.
3, opposing JPEG compression (mass parameter is more than 70).
Do not need former figure when 4, detecting.
5, has the tampering location ability.Precision is the 8*8 fritter.
Got rid of the generation of false alarm when 6, the image pre-service before embed watermark makes watermark detection.
7, encryption function is strong.The password that has added in the watermark information, and with MD5 to watermark encrypting, be added in the ciphertext of low frequency because the position be can not determine its position at random, so it is very big to forge the watermark difficulty.Watermark comprises this double address information of block address and hash address, has the piece correlativity, and making piece copy to different positions can be found.Effective like this having prevented in the danger of knowing the malice structure watermark information under the situation of algorithm.In addition the DC bit encryption in watermark, make that local brightness adjusted (regulate monoblock brightness) can be detected.
8,, make watermark can resist the influence of the error among the DCT and anti-dct transform in coloured image space conversion and the second-compressed process, thereby realized zero alarm owing to passed through the preprocessing process of linear mapping and filtering.