Background technology
Fast development and widespread use along with Digital Image Processing, digital image processing techniques and information security also closely combine, and just possess the typical feature of this digital picture combining information safety requirements as the Digital Image Processing that shows with the seal form.
Seal has long history, has special status and effect in politics, economy and culture life.The kind of seal is a lot, the office chapter of promising government offices, enterprises and institutions, public organization's service, the personal chapter of also promising numerous common people's service.Seal is being brought into play important effect as the prestige voucher in the social life every field.Also because the special role of seal, so lawless person's falsification of seal is always arranged and utilizes falsification of seal to carry out various illegal activities, not only seriously upset normal economic order and public security order, caused enormous economic loss and abominable social influence also can for country, collective and individual.
Along with computer network and digital signature technology develop rapidly, a kind of emerging digital sealing technology is assented and is given birth to.It is corresponding with unit, digital signature and its specific official seal of individual, signet, makes the holder of seal can finish signature on e-file, affix one's seal, with traditional handwritten signature, affixing one's seal has identical function.Digital sealing can solve the problem of signing and sealing of e-file, is used for identification e-file signatory's identity, guarantees the integrality of file, guarantees authenticity, the reliability of file.The while digital signature technology also can be used for the ordinary file printing and determine one's identity.But under the situation that ecommerce is not at present also popularized, most normal document and agreement still need affixing one's seal of physical property, and this makes the application of digital signature receive great restriction.Therefore, the feasible solution of seeking at present utilizes digital watermark technology that digital signature seamlessly is fused in " digital sealing " exactly, thus make " digital signature " can with numeral or papery form exist with file on.The problem that is faced is exactly how to guarantee that digital signature information can be kept perfectly in the printing of image fault, document, scanning, transmission course so technically, in other words, be exactly how to make applied digital watermarking algorithm have higher robustness.
A kind of digital anti-fake method that adopts the binary watermarking technology has been proposed in the prior art.Wherein mention, this binary image watermarking technology can be applied to comprise in the bianry image of seal image, in conjunction with digital signature technology, can solve the true and false authentication function of electronic document and paper file.But there is following defective in the binary image watermarking model of its structure:
1, in the digital watermark embed process, at first image is carried out the rectangle piecemeal, hide 1 information in each pixel value sum in greater than the image block of threshold value S then.If image block is big more, can hide into quantity of information can reduce; If image block is more little, the possibility that complete black or full white region occurs can increase, and quantity of information also can reduce, and if complete white zone by malice or not inadvertently pollute, may cause significantly identification by mistake during detection;
2, owing to the information of hiding 1 in the image block, and the detection of information just depends on the pixel value sum in this image.If can resist the attack of printing, scanner uni duplicating process, then the number of the pixel that need change in each image block must be very many, and this will inevitably cause the decline of visual effect;
3, the concentration setting that depends on printing, scanning and duplicate that the success rate of extracting of this binary image watermarking is too much.If the concentration in the copying image process is excessive or too small, will cause the increase or the minimizing of the pixel value sum in some image block, this is influence detection effect directly.
In sum, in other words this binary image watermarking model, does not solve the robustness of binary image watermarking algorithm to printing and scanning process well not in the contradiction that has truly solved between visual effect, quantity of information and the success rate of extracting.And in the prior art all binary image watermarking algorithms all exist and this model class like weakness, do not possess good robustness.
Summary of the invention
The invention provides method and device that a kind of digital watermarking that is used for digital picture embeds, extracts, in order to improve the robustness in the digital watermarking use, the information embedded quantity that solves in the digital picture is little, the problem that visual effect is relatively poor, when having solved digital picture further and being used for the common paper media document, because the information dropout problems that operation brought such as image fault, geometric deformation, printing, scanning and duplicating.
A kind of data waterprint embedded method that is used for digital picture of the present invention, technical scheme comprises the steps:
By first rule digital picture is divided into the plurality of sub zone;
Add up the stain number in all subregion, and calculate average stain number according to subregion quantity and the total number of stain;
Calculate pixel first number of needs upset in each subregion according to the stain number in the described all subregion and average stain number, watermark information bit string and first step-length;
By overturn pixel in each subregion of described first number.
Preferably, described digital picture is divided into the plurality of sub zone, comprises the steps:
Determine the boundary rectangle of digital picture, and the central point of definite boundary rectangle is the central point of digital picture;
Determine to divide subregion behind the center line according to central point.
Preferably, described subregion is m, and described m is the even number greater than zero.
Preferably, described first step-length step-length that is step-length odd or odd even embedding inlay technique.
Preferably,, this ratio is adjusted, be multiply by average stain number with the amplitude of described adjustment and obtain first number by the odd even multiple of first step-length according to the ratio of the stain number in all subregion with average stain number.
Preferably, described first step-length is less than 0.5.
Preferably, further comprise the steps:
Adjacent in twos subregion is divided into one group, and according to first number upset pixel, second subregion is done opposite upset according to first number to pixel for first subregion in the grouping.
Preferably, further comprise the steps:
Stain number according to subregion is divided into groups, and according to first number upset pixel, the 4th subregion is done opposite upset according to first number to pixel for the 3rd subregion in the grouping.
Preferably, described grouping is that the individual two adjacent sub regions that keep count of of stain are divided into one group.
The present invention also provides a kind of digital watermarking extracting method of data waterprint embedded method, and technical scheme comprises the steps:
By described first rule digital picture is divided into the plurality of sub zone;
Add up the stain number in all subregion, and calculate average stain number according to subregion quantity and the total number of stain;
Extract the watermark information bit string according to the stain number in the described subregion and the average stain number and first step-length.
Preferably, described digital picture is divided into the plurality of sub zone, comprises the steps:
Determine the boundary rectangle of digital picture, and the central point of definite boundary rectangle is the central point of digital picture;
Determine to divide subregion behind the center line according to central point.
Preferably, described subregion is m, and described m is the even number greater than zero.
Preferably, described first step-length step-length that is step-length odd or odd even embedding inlay technique.
Preferably, extract the watermark information bit string according to the ratio between stain number in the described subregion and the average stain number and the odd even multiple of first step-length.
The invention provides a kind of digital watermarking flush mounting that is used for digital picture, technical scheme comprises:
The piecemeal module is used for by first rule digital picture being divided into the plurality of sub zone;
Statistical module links to each other with the piecemeal module, is used to add up the stain number in all subregion, and calculates average stain number according to subregion quantity and the total number of stain;
The number computing module links to each other with statistical module, is used for calculating according to the stain number in the described all subregion and average stain number, watermark information bit string and first step-length pixel first number of needs upset in each subregion;
Flip module links to each other with the number computing module, is used for by overturn pixel in each subregion of described first number.
Preferably, described piecemeal module comprises:
The central point determining unit be used for determining the boundary rectangle of digital picture, and the central point of definite boundary rectangle is the central point of digital picture;
Division unit links to each other with the central point determining unit, is used for determining to divide subregion behind the center line according to central point.
Preferably, described number computing module is further used for according to the ratio of the stain number in all subregion with average stain number, odd even multiple by first step-length is adjusted this ratio, multiply by average stain number with the amplitude of described adjustment and obtains first number.
Preferably, described flip module comprises:
First grouped element is used for adjacent in twos subregion is divided into one group;
First roll-over unit links to each other with first grouped element, is used for for first subregion in the grouping according to first number upset pixel, and second subregion is done opposite upset according to first number to pixel.
Preferably, described flip module comprises:
Second grouped element is used for the individual two adjacent sub regions that keep count of of stain are divided into one group;
Second roll-over unit links to each other with second grouped element, is used for for the 3rd subregion in the grouping according to first number upset pixel, and the 4th subregion is done opposite upset according to first number to pixel.
The present invention also provides a kind of digital watermarking extraction element that is used for digital picture, and technical scheme comprises:
The piecemeal module is used for by described first rule digital picture being divided into the plurality of sub zone;
Statistical module links to each other with the piecemeal module, is used to add up the stain number in all subregion, and calculates average stain number according to subregion quantity and the total number of stain;
Extraction module links to each other with statistical module, is used for extracting the watermark information bit string according to the stain number in the described subregion and the average stain number and first step-length.
Preferably, described piecemeal module comprises:
The central point determining unit be used for determining the boundary rectangle of digital picture, and the central point of definite boundary rectangle is the central point of digital picture;
Division unit links to each other with the central point determining unit, is used for determining to divide subregion behind the center line according to central point.
Preferably, described extraction module is further used for extracting the watermark information bit string according to the ratio between stain number in the described subregion and the average stain number and the odd even multiple of first step-length.
Beneficial effect of the present invention is as follows:
Because the present invention considers absolute number of pixels in the single subregion, but considered and average stain number between proportionate relationship, therefore can avoid owing to print, the variation of the absolute number of single subregion interior pixels brought of different concentration settings in scanning and the duplicating process, thereby can resist printing better, uncertain factor in scanning and the duplicating process is attacked, especially for printing, duplicate, scanning waits the resolution mismatch problem in the copying image process, and because the image deviations that scale factors in various degree causes has adaptability and robustness well.
Embodiment
Design of the present invention is, by dividing, utilize the proportionate relationship and the step-length of stain number and average stain number in each subdivision subregion that watermark information is embedded in the digital picture according to certain method digital picture, thereby obtain a kind of digital watermarking embedding and extracting method that is used for digital picture.Below in conjunction with accompanying drawing concrete enforcement of the present invention is described.
Because the representativeness that information security required in digital picture of digital sealing image, be that example describes to embed and to extract digital watermarking in the enforcement at digital sealing.In the enforcement, have outstanding seal characteristics as the digital sealing image of embodiment, promptly circular, but along with to the concrete explanation of implementing of the present invention, obviously, the digital sealing image process method of being given an example is equally applicable to application to all digital pictures.
Fig. 1 is an embed digital watermark method implementing procedure synoptic diagram in digital sealing, as shown in the figure, may further comprise the steps:
Step 101, determine the direction of digital sealing image and subdivision digital sealing image;
Fig. 2 is original digital sealing image synoptic diagram, describes with this figure in the enforcement, in this step, chooses digital sealing image as shown in Figure 2, and the icon at its center is positive pentagram.When determining the direction of digital sealing image, can locate the boundary rectangle of digital seal image earlier, the central point of determining boundary rectangle is the central point of digital sealing image; Fig. 2 is also the same with other seal images simultaneously, can find out its centre symmetry line 201 at an easy rate.201 cut apart seal image simultaneously equably, also are the centre symmetry line of pentagram, and the rectilinear direction at 201 places also is the direction of this digital sealing image.Getting 201 mid point is the central point of whole seal image, is the even subdivision seal image of benchmark then with the central point.Fig. 3 is a digital sealing image segmentation synoptic diagram, as shown in the figure, in force, is starting point with the central point of seal image, 201 to be start ray, adopts dividing method as shown in Figure 3 that seal image is carried out even subdivision.The subregion number m of cutting apart can change according to the size of the hiding watermark information amount of need, but m is arbitrarily greater than zero even number.For convenience of description, circle shown in Figure 3 is evenly cut apart for 60 sector regions, per two each and every one zones can hide a Bit information, and the gross information content that can hide is 30bit.Fig. 4 is the synoptic diagram that utilizes dividing method subdivision shown in Figure 3 image shown in Figure 2, Fig. 5 is the synoptic diagram that a sub regions is amplified behind Fig. 4 subdivision, as shown in the figure, the regional correspondence of the circle that dividing method shown in Figure 3 is cut apart is added on Fig. 2, just obtain as shown in Figure 4 seal image by the effect synoptic diagram after evenly cutting apart, the effect synoptic diagram after one of them subregion is amplified as shown in Figure 5.
Need to prove, selected for use the mode of dividing equally that image is cut apart at the characteristics of seal image in the enforcement with center radiation, but as can be known by design of the present invention, become the zone just can realize the present invention image segmentation as long as can reach, simultaneously, by in the following step 102 to the packet transaction in zone as can be known, the zone that is separated into is not to need equalization yet.In like manner as can be known, in the enforcement to the explanation of seal image being implemented for to the present invention of only choosing of central point and center line, the present invention is applicable to that the watermark of all images shape embeds extraction, just when image when being irregularly shaped, according to inventive concept, as long as image division is become subregion.The process that embeds in the present invention and extract is corresponding, when therefore when embedding, pressing the first rule division subregion, then when extracting, also divide by first rule, first regular expression consistance when dividing between the two, but be not limited to explain a fixing division rule.
Step 102, add up stain number in the seal image subregion behind the subdivision respectively, and calculate the average stain number of seal image;
Respectively the even stain number of all subregion inside behind the subdivision seal image in the statistic procedure 101 is designated as ∑ i, i=1 wherein, 2,3...60.Calculate total stain number sum ∑:
∑=∑1+∑2+∑3+...∑60;
And calculate average stain number
For:
Step 103, calculate pixel first number of needs upset in each subregion according to proportionate relationship, watermark information bit string and first step-length between stain number in all subregion and the average stain number; In this step, calculate stain number and average stain number in each subregion
Between proportionate relationship
i=1,2,3...60;
Next, when judging 0/1 data bit of embed watermark, can adopt among the embodiment step-length odd come to explanation, the step-length odd is the expansion of odd even embedding inlay technique.Ratio between stain number in the subregion behind each subdivision and the average stain number represents 0/1 with respect to the parity of the multiple of a fixed step size Q.Make algorithm have certain fault-tolerant ability like this, being no more than Q/2 through the above-mentioned ratio maximum in watermark attack back can effectively be detected.The image that obtains after the print scanned process seems identical with original image, in fact this process synthesis multiple image processing process, very big conversion has taken place in the pixel value of image and geometric position, needs watermarking algorithm to have very strong robustness and could resist this attack.This moment, the selection of step-length Q became particularly important, if step-length is excessive, needed the number of the pixel of change to increase, and can the visual effect of former text image be made a big impact like this; If step-length is too small, be subjected to the influence of print scanned process, the data message after the embedding is lost especially easily.In a preferred embodiment, selecting step-length is 0.1, and in general not choosing of step-length surpasses 0.5.
After calculating the ratio of stain number and average stain number in each subregion, according to the restriction of the odd even multiple of first step-length, carry out this ratio is made amendment, the amplitude of modification multiply by average stain number and is first number.
In order to make hide Info stain number in the subregion of bit string remain unchanged with ratio between the average stain number, just must guarantee the stain number in each subregion of modification after, total stain number of seal image does not change.For this reason, after the stain number in the sub regions changed, the stain number in the corresponding subregion of another one will be done opposite variation.That is to say that when the stain number in the sub regions increased, the stain number in the sub regions in addition must reduce with identical quantity, vice versa.
Here, remain unchanged as long as guarantee the stain number summation of whole seal image, the variation pattern division of the stain number in the subregion can have multiple.The most direct method is exactly, m sub regions behind the subdivision is one group with adjacent in twos subregion averages division, two sub regions A and B for a packets inner, subregion A is according to the inner pixel of its first number upset, and the another one subregion in this group, then do opposite upset pixel operation according to the first identical number, guarantee that the total stain number of image of digital sealing remains unchanged, vice versa.
When but if the stain number difference in the two adjacent sub regions is big, and when needing to change identical pixel number, bigger to the influence of visual effect.Therefore, consider the stain number difference of all subregion, can earlier with how much the sorting of the m sub regions behind the subdivision according to the stain number, be one group and evenly divide according to adjacent in twos since an end, two sub regions in each grouping are carried out opposite upset pixel operation according to identical first respectively, thereby make upset relative equilibrium between the pixel of all subregion inside.Be in the zone stain number and the average relational application between the stain number by group areas spirit of the present invention as can be seen, also promptly be the stain number but not the zone the size or impartial, processing by grouping has overcome the different problem of stain number in the zones of different, therefore for other digital pictures that do not possess regular shape, its disposal route is consistent.
Through said process, just can calculate first number that needs the solarization image vegetarian refreshments in each subregion.
Step 104, by overturn pixel in each subregion of first number.
In this step, search for the image boundary profile in each subregion.If the connected region that this moment, black pixel point was formed is in the inside of subregion, then the image boundary profile is closed; Otherwise be inc.When changing the stain number, along every in the subregion profile one group of pixel of overturning continuously, travel through along contour direction when needing to increase black color dots, the white point in upset stain eight neighborhoods is a black, till the first number pixel of having overturn.When needing to reduce stain, equally along the profile traversal, upset profile stain is a white, till the upset first number pixel.Wherein all homochromy up and down stain is not overturn, can play the effect of certain level and smooth visual effect.
Fig. 6 is the effect synoptic diagram behind the seal image embed digital watermark shown in Figure 2, utilize behind the above-mentioned method embed watermark information the seal image effect as shown in the figure, as seen from the figure, vision smoothness before and after changing is more satisfactory, and carefully contrast is checked and is not easy to find wherein to hide Info.
Based on same design, the present invention also provides the method for extracting digital watermarking in digital picture, process contrary in the method for digital watermarking embedding just can be extracted digital watermarking, promptly by the stain number in the digital picture of embed watermark etc. is extracted the watermark information that embeds, thereby digital picture is reduced.Come the concrete enforcement of extracting method is described below in conjunction with accompanying drawing.According to the explanation in the enforcement of embedding grammar, still be example during this method enforcement with the digital sealing.
Fig. 7 extracts digital watermark method implementing procedure synoptic diagram in digital sealing, as shown in the figure, may further comprise the steps:
Step 701, obtain the digital sealing image, determine the direction of digital sealing image, and subdivision digital sealing image;
Can be in the enforcement by equipment such as scanners, obtain the digital sealing gray level image after the printing, carry out following operation then:
Gray level image is carried out well straightening to be handled;
Gray level image is carried out obtaining black and white binary image after thresholding is handled, can adopt big Tianjin method, process of iteration or bimodal method and other border following algorithm etc.;
In bianry image, redefine the direction of seal, determine that the method for direction is identical with telescopiny;
Adopt with the identical method of telescopiny digital seal image is carried out subdivision.
Step 702, add up stain number in the seal image subregion behind the subdivision respectively, and calculate average stain number;
Add up among the S701 stain number of all subregion inside behind the even subdivision seal image respectively, be designated as ∑ i, i=1 wherein, 2,3...60.Calculate total stain number sum ∑:
∑=∑1+∑2+∑3+...∑60;
And calculate average stain number
For:
Step 703, extract embedded watermark information bit string according to the ratio relation and first step-length between stain number in each subregion and the average stain number.
Calculate the stain number of each subregion inside and the ratio between the average stain number,, extract 0 or 1 bit string in the watermark information according to the odd even multiple of first step-length.
Based on same inventive concept, the present invention also provides a kind of digital watermarking embedding and extraction element that is used for digital picture, below in conjunction with accompanying drawing the embodiment of embedding with extraction element is described.
Fig. 8 is the digital watermarking flush mounting structural representation of digital picture, and as shown in the figure, statistical module 802 links to each other with piecemeal module 801 in the flush mounting, and number computing module 803 links to each other with statistical module 802, flip module 804, wherein:
After the piecemeal module is divided into the plurality of sub zone by first rule with digital picture, stain number in the statistical module counts all subregion, and calculate average stain number according to subregion quantity and the total number of stain, the number computing module then calculates pixel first number of needs upset in each subregion according to the stain number in all subregion and average stain number, watermark information bit string and first step-length, last flip module is by overturn pixel in each subregion of first number.
In piecemeal module 801, comprised the division unit 8012 that links to each other with central point determining unit 8011, wherein:
The central point determining unit is determined the boundary rectangle of digital picture, and the central point of definite boundary rectangle is the central point of digital picture; The central point that division unit is determined according to the central point determining unit is determined to divide subregion behind the center line.
Number computing module 803 can be according to the ratio of the stain number in all subregion with average stain number, odd even multiple by first step-length is adjusted this ratio, multiply by average stain number with the amplitude of adjusting and obtain first number, in a preferred embodiment, selecting step-length is 0.1, and in general not choosing of step-length surpasses 0.5.
Comprise in the flip module 804:
First grouped element is divided into one group with adjacent in twos subregion;
First roll-over unit links to each other with first grouped element, and according to first number upset pixel, second subregion is done opposite upset according to first number to pixel for first subregion in the grouping.
Described flip module can also comprise:
Second grouped element is divided into one group with the individual two adjacent sub regions that keep count of of stain;
Second roll-over unit links to each other with second grouped element, and according to first number upset pixel, the 4th subregion is done opposite upset according to first number to pixel for the 3rd subregion in the grouping.
Fig. 9 is the digital watermarking extraction element structural representation of digital picture, and as shown in the figure, statistical module 802 links to each other with piecemeal module 801, extraction module 901 in the flush mounting, wherein:
The piecemeal module is divided into the plurality of sub zone by first rule with digital picture; Stain number in the statistical module counts all subregion, and calculate average stain number according to subregion quantity and the total number of stain; Extraction module extracts the watermark information bit string according to the stain number in the subregion and the average stain number and first step-length.
In piecemeal module 801, comprised the division unit 8012 that links to each other with central point determining unit 8011, wherein:
The central point determining unit is determined the boundary rectangle of digital picture, and the central point of definite boundary rectangle is the central point of digital picture; The central point that division unit is determined according to the central point determining unit is determined to divide subregion behind the center line.
Extraction module 901 extracts the watermark information bit string according to the ratio between stain number in the subregion and the average stain number and the odd even multiple of first step-length.
Embedding is a corresponding process with extraction among the present invention, carries out the specific implementation process of complete digital watermarking embedding with extraction below again under same inventive concept in order to explanation the present invention for an embodiment.
Figure 10 is that the digital watermarking that is used for digital picture embeds and the implementing procedure synoptic diagram that extracts, as shown in the figure, during this is implemented, provided the complete procedure that watermark embeds and extracts, in order to further the total concrete enforcement of conceiving of the present invention is comprehensively illustrated, can may further comprise the steps in the enforcement:
Step 1001, determine the direction of digital picture and subdivision digital picture by first rule;
Step 1002, add up the stain number in each subdivision subregion;
Step 1003, the average stain number of calculating;
Step 1004, calculate stain number and the average proportionate relationship between the stain number in all subregion respectively;
Pixel first number of the needs counter-rotating in step 1005, the calculating all subregion;
Pixel in step 1006, the upset all subregion;
Step 1007, obtain the image that adds after the watermark;
Step 1008, determine the direction of digital picture and subdivision digital picture by first rule;
Step 1009, add up stain number in the image region behind the subdivision respectively, and calculate average stain number;
Step 1010, extraction watermark bit information.
Use the present invention to avoid because the variation of the absolute number of single subregion interior pixels that different concentration settings brings in printing, scanning and the duplicating process, thereby the uncertain factor that can resist better in printing, scanning and the duplicating process is attacked; Especially for the resolution mismatch problem in the copying image processes such as printing, duplicating, scanning and because the image deviations that in various degree scale factors causes all has adaptability and robustness well.
Spirit of the present invention is, according to relation and the step-length of the stain number in the subregion behind the digital picture subdivision with average stain number watermark information is embedded in the digital picture, then according in like manner therefrom extracting watermark information.Obviously, those skilled in the art can carry out various changes and modification to the present invention and not break away from the spirit and scope of the present invention.Like this, if of the present invention these are revised and modification belongs within the scope of claim of the present invention and equivalent technologies thereof, then the present invention also is intended to comprise these changes and modification interior.