Watermark processing method and device for watermark carrier
1. A watermarking method for a watermark carrier, comprising:
generating a watermark image reflecting the user identification according to the user identification browsing the watermark carrier;
acquiring a positioning image, wherein the positioning image comprises a positioning texture used for positioning the position of the watermark image in the watermark carrier in the watermark extraction process;
embedding the watermark image into the positioning image to obtain a composite image, wherein the composite image comprises the positioning texture;
and superposing the composite image into the watermark carrier.
2. The watermarking method of claim 1, wherein superimposing the composite image onto the watermark carrier comprises:
according to the superposition transparency required by the superposition of the composite image preset by the user, carrying out enhancement processing on the composite image;
and superposing the enhanced composite image into the watermark carrier according to the superposition transparency.
3. The watermarking method according to claim 2, wherein the enhancing the composite image comprises:
and for each pixel point of the composite image, determining a target pixel value of each pixel point in the composite image according to a first pixel value of each pixel point in the positioning image, a second pixel value of each pixel point in the composite image and the superposition transparency.
4. A watermarking method according to claim 3, wherein, for each pixel:
the target pixel value is negatively correlated with the first pixel value and positively correlated with the second pixel value;
in the event that the second pixel value is greater than the first pixel value, the target pixel value is inversely related to the overlay transparency;
in the case that the second pixel value is smaller than the first pixel value, the target pixel value is positively correlated with the overlay transparency;
in the case where the second pixel value is equal to the first pixel value, the target pixel value is equal to the first pixel value.
5. The watermarking method of claim 4, wherein determining a target pixel value for the each pixel point in the composite image comprises:
calculating the difference value between the second pixel value and the first pixel value of each pixel point;
calculating the ratio of the difference value to the superposition transparency;
and calculating the target pixel value of each pixel point according to the sum of the ratio and the first pixel value.
6. The watermarking method of claim 1, wherein superimposing the composite image onto the watermark carrier comprises:
modifying the pixel value of the pixel point of which the pixel value is smaller than the truncation threshold value in the composite image into the truncation threshold value so as to perform pixel value truncation on the composite image;
and superposing the composite image subjected to pixel value truncation into the watermark carrier.
7. The watermarking method of claim 1, wherein superimposing the composite image onto the watermark carrier comprises:
acquiring a first pixel value of a positioning texture in the positioning image;
restoring second pixel values of a located texture in the composite image to the first pixel values;
and superposing the second pixel value of the positioning texture into a composite image of the first pixel value, and restoring the second pixel value into the watermark carrier.
8. The watermarking method according to claim 1, wherein generating a watermark image reflecting an identity of a user viewing the watermark carrier, based on the identity of the user, comprises:
determining a digital code corresponding to the identification of a user browsing the watermark carrier, wherein the digital code comprises one or more digits, and the value range of each digit is 0 to 9;
acquiring a blank image bearing the digital code;
determining the position coordinates of a pixel block for bearing each digit of the digital code in the blank image;
and setting the pixel value of the pixel block of each digit used for bearing the digital code in the blank image as a preset pixel value according to the determined position coordinates of the pixel block of each digit, wherein the absolute value of the difference between the preset pixel value and the pixel values of other pixel blocks except the pixel block bearing each digit in the blank image is greater than the threshold value of the pixel block.
9. The watermarking method according to claim 8, wherein the width of the blank image is positively correlated to the size of the pixel block and the number of bits of the digital code, respectively, and the height of the blank image is determined according to the size of the pixel block.
10. The watermarking method according to claim 8, wherein the number of digitally encoded bits is positively correlated to the width and height, respectively, of the scout image.
11. The watermarking method of claim 1, wherein superimposing the composite image onto the watermark carrier comprises:
and superposing the composite image to the watermark carrier in a tiled mode.
12. The watermarking method of claim 1, wherein the localized texture comprises at least one of textual content and graphical content.
13. A watermark processing method for a watermark carrier, wherein the watermark carrier is superimposed with a composite image in which a watermark image is embedded in a positioning image, the watermark image is generated according to an identifier of a user browsing the watermark carrier and reflects the identifier of the user, the positioning image and the composite image both include positioning textures for positioning the position of the watermark image in the watermark carrier in a watermark extraction process, the watermark processing method comprising:
acquiring at least one part of image of the watermark carrier as an image to be processed;
positioning the position of the composite image in the watermark carrier by using the positioning texture in the positioning image and the positioning texture in the image to be processed so as to position the position of the watermark image in the watermark carrier;
and extracting the watermark image from the image to be processed according to the position of the composite image in the watermark carrier.
14. The watermarking method of claim 13, wherein locating the position of the composite image in the watermark carrier comprises:
performing image feature point matching operation on the positioning image and the image to be processed to obtain a plurality of groups of feature point pairs, wherein each group of feature point pairs is a corresponding relation between pixel position coordinates of pixel points of feature matching in the positioning image and pixel position coordinates of pixel points in the image to be processed;
and positioning the position of the composite image in the watermark carrier according to the plurality of groups of characteristic point pairs.
15. The watermarking method according to claim 14, wherein extracting the watermark image from the image to be processed comprises:
calculating an affine matrix according to the plurality of groups of feature point pairs;
according to the affine matrix, performing alignment operation on the image to be processed;
intercepting a sub-image to be processed, on which one composite image is superimposed, from the aligned image to be processed according to the position of the composite image in the watermark carrier;
and extracting the watermark image from the sub-image to be processed.
16. The watermarking method according to claim 15, wherein extracting the watermark image from the sub-image to be processed comprises:
determining a pixel value range representing the background of the sub-image to be processed according to the pixel value of each pixel point in each image channel aiming at each image channel of the sub-image to be processed;
according to the pixel value range, performing enhancement processing on the composite image superposed in the sub-image to be processed;
and extracting the watermark image from the sub-image to be processed after the enhancement processing.
17. The watermarking method according to claim 16, wherein the enhancing the composite image superimposed in the sub-image to be processed comprises:
determining a maximum pixel value and a minimum pixel value in the range of pixel values;
and updating the pixel value of each pixel point according to the size relation between the pixel value of each pixel point and the maximum pixel value and the minimum pixel value aiming at each image channel of the sub-image to be processed so as to increase the contrast between the background of the sub-image to be processed and the composite image.
18. The watermarking method according to claim 17, wherein the composite image and the sub-image to be processed are both gray-scale maps, and updating the pixel value of each pixel point comprises:
for each pixel point in each image channel of the sub-image to be processed,
updating the pixel value of each pixel point to be 0 under the condition that the pixel value of each pixel point is smaller than the minimum pixel value;
under the condition that the pixel value of each pixel point is larger than the maximum pixel value, updating the pixel value of each pixel point to be 255;
and under the condition that the pixel value of each pixel point is greater than or equal to the minimum pixel value and less than or equal to the maximum pixel value, updating the pixel value of each pixel point according to the difference value between the maximum pixel value and the minimum pixel value and the pixel value of each pixel point, so that the updated pixel value is greater than the pixel value before updating.
19. The watermarking method according to claim 18, wherein for each pixel point in each image channel of the sub-image to be processed, when the pixel value of the pixel point is greater than or equal to the minimum pixel value and less than or equal to the maximum pixel value, the updated pixel value is negatively correlated with the difference value and positively correlated with the pixel value before updating.
20. The watermarking method of claim 13, wherein locating the position of the composite image in the watermark carrier comprises:
preprocessing the image to be processed, wherein the preprocessing comprises at least one of histogram equalization and local binarization;
and positioning the position of the composite image in the watermark carrier by using the positioning texture in the positioning image and the positioning texture in the preprocessed image to be processed.
21. The watermarking method according to claim 13, further comprising:
after the watermark image is extracted, calculating the average value of the pixel values of all the pixel points in each pixel block in the extracted watermark image as the pixel block average value;
determining the position of a pixel block where each digit of the digital code corresponding to the user identifier is located according to the pixel block average value;
determining the digital codes according to the positions of the pixel blocks where the determined digits are located;
and determining the identification of the user according to the digital code.
22. The watermarking method of claim 21, wherein the digital code is N bits, N being a positive integer, and determining the location of the pixel block in which each bit of the digital code corresponding to the user's identification is located comprises:
calculating an average value of the average values of the pixel blocks corresponding to the pixel blocks as a reference average value;
and determining the positions of the N pixel blocks with the largest difference value with the reference average value as the positions of the pixel blocks where the digit numbers of the digit codes are located from the pixel block average values corresponding to the pixel blocks.
23. A watermark processing apparatus for a watermark carrier, comprising:
a generating module configured to generate a watermark image reflecting an identification of a user who browses the watermark carrier according to the identification of the user;
an obtaining module configured to obtain a positioning image, the positioning image including a positioning texture for positioning a position of the watermark image in the watermark carrier in a watermark extraction process;
an embedding module configured to embed the watermark image into the positioning image, resulting in a composite image, the composite image comprising the positioning texture;
an overlay module configured to overlay the composite image into the watermark carrier.
24. A watermark processing apparatus for a watermark carrier, wherein the watermark carrier is superimposed with a composite image in which a watermark image is embedded in a positioning image, the watermark image is generated according to an identifier of a user who browses the watermark carrier and reflects the identifier of the user, the positioning image and the composite image both include positioning textures for positioning a position of the watermark image in the watermark carrier in a watermark extraction process, the watermark processing apparatus comprising:
an acquisition module configured to acquire an image of at least a part of the watermark carrier as an image to be processed;
a positioning module configured to position the position of the composite image in the watermark carrier by using a positioning texture in the positioning image and a positioning texture in the image to be processed, so as to position the position of the watermark image in the watermark carrier;
an extraction module configured to extract the watermark image from the image to be processed according to a position of the composite image in the watermark carrier.
25. A watermark processing apparatus for a watermark carrier, comprising:
a memory; and
a processor coupled to the memory, the processor configured to perform at least one of the watermarking method of any of claims 1 to 12 and the watermarking method of any of claims 13 to 22 based on instructions stored in the memory.
26. A computer-storable medium having stored thereon computer program instructions which, when executed by a processor, implement at least one of a watermarking method according to any of claims 1 to 12 and a watermarking method according to any of claims 13 to 22.
Background
The watermark has important and wide application in copyright protection and leakage tracing of watermark carriers such as web pages, pictures, documents and the like.
In the related art, a watermark image is directly embedded in a watermark carrier.
Disclosure of Invention
In the related art, under the condition that the related information of the watermark carrier cannot be obtained in advance, the addition and extraction of the watermark are difficult, and the accuracy is poor.
In view of the above technical problems, the present disclosure provides a solution that can reduce the difficulty of adding and extracting watermarks and improve the accuracy of extracting watermarks.
According to a first aspect of the present disclosure, there is provided a watermarking method for a watermark carrier, including: generating a watermark image reflecting the user identification according to the user identification browsing the watermark carrier; acquiring a positioning image, wherein the positioning image comprises a positioning texture used for positioning the position of the watermark image in the watermark carrier in the watermark extraction process; embedding the watermark image into the positioning image to obtain a composite image, wherein the composite image comprises the positioning texture; and superposing the composite image into the watermark carrier.
In some embodiments, superimposing the composite image into the watermark carrier comprises: according to the superposition transparency required by the superposition of the composite image preset by the user, carrying out enhancement processing on the composite image; and superposing the enhanced composite image into the watermark carrier according to the superposition transparency.
In some embodiments, enhancing the composite image comprises: and for each pixel point of the composite image, determining a target pixel value of each pixel point in the composite image according to a first pixel value of each pixel point in the positioning image, a second pixel value of each pixel point in the composite image and the superposition transparency.
In some embodiments, for each of said pixel points: the target pixel value is negatively correlated with the first pixel value and positively correlated with the second pixel value; in the event that the second pixel value is greater than the first pixel value, the target pixel value is inversely related to the overlay transparency; in the case that the second pixel value is smaller than the first pixel value, the target pixel value is positively correlated with the overlay transparency; in the case where the second pixel value is equal to the first pixel value, the target pixel value is equal to the first pixel value.
In some embodiments, determining the target pixel value of each pixel point in the composite image comprises: calculating the difference value between the second pixel value and the first pixel value of each pixel point; calculating the ratio of the difference value to the superposition transparency; and calculating the target pixel value of each pixel point according to the sum of the ratio and the first pixel value.
In some embodiments, superimposing the composite image into the watermark carrier comprises: modifying the pixel value of the pixel point of which the pixel value is smaller than the truncation threshold value in the composite image into the truncation threshold value so as to perform pixel value truncation on the composite image; and superposing the composite image subjected to pixel value truncation into the watermark carrier.
In some embodiments, superimposing the composite image into the watermark carrier comprises: acquiring a first pixel value of a positioning texture in the positioning image; restoring second pixel values of a located texture in the composite image to the first pixel values; and superposing the second pixel value of the positioning texture into a composite image of the first pixel value, and restoring the second pixel value into the watermark carrier.
In some embodiments, generating a watermark image reflecting an identity of a user viewing the watermark carrier from the identity of the user comprises: determining a digital code corresponding to the identification of a user browsing the watermark carrier, wherein the digital code comprises one or more digits, and the value range of each digit is 0 to 9; acquiring a blank image bearing the digital code; determining the position coordinates of a pixel block for bearing each digit of the digital code in the blank image; and setting the pixel value of the pixel block of each digit used for bearing the digital code in the blank image as a preset pixel value according to the determined position coordinates of the pixel block of each digit, wherein the absolute value of the difference between the preset pixel value and the pixel values of other pixel blocks except the pixel block bearing each digit in the blank image is greater than the threshold value of the pixel block.
In some embodiments, the width of the blank image is positively correlated with the size of the pixel block and the number of bits of the digital code, respectively, and the height of the blank image is determined according to the size of the pixel block.
In some embodiments, the digitally encoded number of bits is positively correlated with the width and height, respectively, of the scout image.
In some embodiments, superimposing the composite image into the watermark carrier comprises: and superposing the composite image to the watermark carrier in a tiled mode.
In some embodiments, the positioning texture comprises at least one of textual content and graphical content.
According to a second aspect of the present disclosure, a watermark processing method for a watermark carrier is provided, where the watermark carrier is superimposed with a composite image in which a watermark image is embedded in a positioning image, the watermark image is generated according to an identifier of a user browsing the watermark carrier and reflects the identifier of the user, the positioning image and the composite image both include positioning textures for positioning a position of the watermark image in the watermark carrier in a watermark extraction process, and the watermark processing method includes: acquiring at least one part of image of the watermark carrier as an image to be processed; positioning the position of the composite image in the watermark carrier by using the positioning texture in the positioning image and the positioning texture in the image to be processed so as to position the position of the watermark image in the watermark carrier; and extracting the watermark image from the image to be processed according to the position of the composite image in the watermark carrier.
In some embodiments, locating the position of the composite image in the watermark carrier comprises: performing image feature point matching operation on the positioning image and the image to be processed to obtain a plurality of groups of feature point pairs, wherein each group of feature point pairs is a corresponding relation between pixel position coordinates of pixel points of feature matching in the positioning image and pixel position coordinates of pixel points in the image to be processed; and positioning the position of the composite image in the watermark carrier according to the plurality of groups of characteristic point pairs.
In some embodiments, extracting the watermark image from the image to be processed comprises: calculating an affine matrix according to the plurality of groups of feature point pairs; according to the affine matrix, performing alignment operation on the image to be processed; intercepting a sub-image to be processed, on which one composite image is superimposed, from the aligned image to be processed according to the position of the composite image in the watermark carrier; and extracting the watermark image from the sub-image to be processed.
In some embodiments, extracting the watermark image from the sub-image to be processed comprises: determining a pixel value range representing the background of the sub-image to be processed according to the pixel value of each pixel point in each image channel aiming at each image channel of the sub-image to be processed; according to the pixel value range, performing enhancement processing on the composite image superposed in the sub-image to be processed; and extracting the watermark image from the sub-image to be processed after the enhancement processing.
In some embodiments, the enhancing the composite image superimposed in the sub-image to be processed includes: determining a maximum pixel value and a minimum pixel value in the range of pixel values; and updating the pixel value of each pixel point according to the size relation between the pixel value of each pixel point and the maximum pixel value and the minimum pixel value aiming at each image channel of the sub-image to be processed so as to increase the contrast between the background of the sub-image to be processed and the composite image.
In some embodiments, the composite image and the sub-image to be processed are both gray-scale maps, and updating the pixel value of each pixel point includes: for each pixel point in each image channel of the sub-image to be processed, under the condition that the pixel value of each pixel point is smaller than the minimum pixel value, updating the pixel value of each pixel point to be 0; under the condition that the pixel value of each pixel point is larger than the maximum pixel value, updating the pixel value of each pixel point to be 255; and under the condition that the pixel value of each pixel point is greater than or equal to the minimum pixel value and less than or equal to the maximum pixel value, updating the pixel value of each pixel point according to the difference value between the maximum pixel value and the minimum pixel value and the pixel value of each pixel point, so that the updated pixel value is greater than the pixel value before updating.
In some embodiments, for each pixel point in each image channel of the sub-image to be processed, when the pixel value of each pixel point is greater than or equal to the minimum pixel value and less than or equal to the maximum pixel value, the updated pixel value is in negative correlation with the difference value and in positive correlation with the pixel value before updating.
In some embodiments, locating the position of the composite image in the watermark carrier comprises: preprocessing the image to be processed, wherein the preprocessing comprises at least one of histogram equalization and local binarization; and positioning the position of the composite image in the watermark carrier by using the positioning texture in the positioning image and the positioning texture in the preprocessed image to be processed.
In some embodiments, the watermarking method further includes: after the watermark image is extracted, calculating the average value of the pixel values of all the pixel points in each pixel block in the extracted watermark image as the pixel block average value; determining the position of a pixel block where each digit of the digital code corresponding to the user identifier is located according to the pixel block average value; determining the digital codes according to the positions of the pixel blocks where the determined digits are located; and determining the identification of the user according to the digital code.
In some embodiments, the numeric code is N bits, where N is a positive integer, and determining the position of the pixel block where each bit of the numeric code corresponding to the user's identification is located includes: calculating an average value of the average values of the pixel blocks corresponding to the pixel blocks as a reference average value; and determining the positions of the N pixel blocks with the largest difference value with the reference average value as the positions of the pixel blocks where the digit numbers of the digit codes are located from the pixel block average values corresponding to the pixel blocks.
According to a third aspect of the present disclosure, there is provided a watermark processing apparatus for a watermark carrier, including: a generating module configured to generate a watermark image reflecting an identification of a user who browses the watermark carrier according to the identification of the user; an obtaining module configured to obtain a positioning image, the positioning image including a positioning texture for positioning a position of the watermark image in the watermark carrier in a watermark extraction process; an embedding module configured to embed the watermark image into the positioning image, resulting in a composite image, the composite image comprising the positioning texture; an overlay module configured to overlay the composite image into the watermark carrier.
According to a fourth aspect of the present disclosure, a watermark processing apparatus for a watermark carrier is provided, where the watermark carrier is superimposed with a composite image in which a watermark image is embedded in a positioning image, the watermark image is generated according to an identifier of a user browsing the watermark carrier and reflects the identifier of the user, the positioning image and the composite image both include positioning textures for positioning a position of the watermark image in the watermark carrier in a watermark extraction process, and the watermark processing apparatus includes: an acquisition module configured to acquire an image of at least a part of the watermark carrier as an image to be processed; a positioning module configured to position the position of the composite image in the watermark carrier by using a positioning texture in the positioning image and a positioning texture in the image to be processed, so as to position the position of the watermark image in the watermark carrier; an extraction module configured to extract the watermark image from the image to be processed according to a position of the composite image in the watermark carrier.
According to a fifth aspect of the present disclosure, there is provided a watermark processing apparatus for a watermark carrier, comprising: a memory; and a processor coupled to the memory, the processor being configured to execute the watermarking method for the watermark carrier according to any of the above embodiments based on the instructions stored in the memory.
According to a sixth aspect of the present disclosure, there is provided a computer-readable storage medium having stored thereon computer program instructions, which when executed by a processor, implement the watermarking method for a watermark carrier according to any of the embodiments described above.
In the embodiment, the difficulty of adding and extracting the watermark can be reduced, and the accuracy of extracting the watermark is improved.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments of the disclosure and together with the description, serve to explain the principles of the disclosure.
The present disclosure may be more clearly understood from the following detailed description, taken with reference to the accompanying drawings, in which:
fig. 1 is a flow diagram illustrating a watermarking method according to some embodiments of the present disclosure;
fig. 2A is a schematic diagram illustrating a watermark image according to some embodiments of the present disclosure;
FIG. 2B is a schematic diagram illustrating a positioning image according to some embodiments of the present disclosure;
FIG. 2C is a schematic diagram illustrating a composite image according to some embodiments of the present disclosure;
FIG. 2D is a schematic diagram illustrating a composite image according to further embodiments of the present disclosure;
fig. 3A is a schematic diagram illustrating the superimposition of a composite image onto a watermark carrier, according to some embodiments of the present disclosure;
fig. 3B is a schematic diagram illustrating the superimposition of a composite image onto a watermark carrier according to further embodiments of the present disclosure;
FIG. 4 is a flow diagram illustrating a watermarking method according to some embodiments of the present disclosure;
FIG. 5A is a schematic diagram illustrating an image to be processed according to some embodiments of the present disclosure;
FIG. 5B shows a schematic diagram of a sub-image to be processed according to further embodiments of the present disclosure;
FIG. 5C is a schematic diagram illustrating sub-images to be processed according to still further embodiments of the present disclosure;
FIG. 5D is a schematic diagram illustrating a sub-image to be processed after enhancement processing according to some embodiments of the present disclosure;
fig. 5E is a schematic diagram illustrating a watermark image extracted from a sub-image to be processed according to some embodiments of the present disclosure;
FIG. 6 is a block diagram illustrating a watermarking apparatus according to some embodiments of the present disclosure;
FIG. 7 is a block diagram illustrating a watermarking apparatus according to further embodiments of the present disclosure;
FIG. 8 is a block diagram illustrating a watermarking apparatus according to some embodiments of the present disclosure;
FIG. 9 is a block diagram illustrating a computer system for implementing some embodiments of the present disclosure.
Detailed Description
Various exemplary embodiments of the present disclosure will now be described in detail with reference to the accompanying drawings. It should be noted that: the relative arrangement of the components and steps, the numerical expressions, and numerical values set forth in these embodiments do not limit the scope of the present disclosure unless specifically stated otherwise.
Meanwhile, it should be understood that the sizes of the respective portions shown in the drawings are not drawn in an actual proportional relationship for the convenience of description.
The following description of at least one exemplary embodiment is merely illustrative in nature and is in no way intended to limit the disclosure, its application, or uses.
Techniques, methods, and apparatus known to those of ordinary skill in the relevant art may not be discussed in detail but are intended to be part of the specification where appropriate.
In all examples shown and discussed herein, any particular value should be construed as merely illustrative, and not limiting. Thus, other examples of the exemplary embodiments may have different values.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, further discussion thereof is not required in subsequent figures.
Fig. 1 is a flow diagram illustrating a watermarking method according to some embodiments of the present disclosure.
As shown in fig. 1, a watermarking method for a watermark carrier includes: step S110, generating a watermark image reflecting the user identification; step S120, acquiring a positioning image; step S130, embedding the watermark image into a positioning image (tile image) to obtain a composite image; and step S140, overlapping the composite image to a watermark carrier. Under the condition that the related information of the watermark carrier cannot be obtained in advance, the difficulty of adding the watermark can be reduced by obtaining the positioning image comprising the positioning texture, embedding the watermark image into the positioning image comprising the positioning texture to obtain the composite image fused with the watermark information, and superposing the composite image to the watermark carrier. In addition, the positioning texture can assist in positioning the position of the watermark image in the watermark carrier in the watermark extraction process, so that the difficulty of watermark extraction can be reduced, and the accuracy of watermark extraction is improved. For example, the watermarking method is performed by a watermarking apparatus.
In step S110, a watermark image reflecting the user 'S identification is generated according to the user' S identification browsing the watermark carrier. In some embodiments, the watermark carrier includes, but is not limited to, a web page, a picture, a document. For example, the identification of the user is a user ID (Identity document).
In some embodiments, generating a watermark image reflecting the identity of the user may be accomplished as follows.
First, a digital code corresponding to the identity of the user browsing the watermark carrier is determined. The digital code comprises one or more digits, each digit having a value in the range of 0 to 9. In some embodiments, the numeric code corresponding to the user's identification may be determined by way of a hash map, md5(message-digest algorithm 5) map, or a hard-coded look-up table map.
For example, the number of bits of the digital code is positively correlated with the width and height, respectively, of the scout image. In some embodiments, the digital code comprises an N-bit number (code), N being a positive integer. For example, N — W1 × H1/C. W1 is the width of the scout image, H1 is the height of the scout image, and C is a constant. Taking an example of a watermark embedding algorithm in which one digit of a digitally encoded pixel block occupies 5 × 5, and a watermark image embedding positioning image is DWT-DCT (Discrete Wavelet transform-Discrete Cosine transform) algorithm, where C is 8 × 5 × 10 4000, 8 is determined by the watermark embedding algorithm, 5 × 5 is the pixel size of the pixel block, and 10 indicates 10 digits of which each digit takes a value of 0 to 9. For example, the number corresponding to the user's identification is encoded as "123456".
Second, a blank image is obtained bearing a digital code. For example, each digit of the digital code is carried in a block of pixels of a blank image. The size of the pixel block may be preset by the user. For example, the size of the pixel block is 5 × 5.
In some embodiments, the width of the blank image is positively correlated with the size of the pixel block and the number of digitally encoded bits, respectively. The height of the blank image is determined according to the size of the pixel block. Taking the example that the digital coding is "123456", the pixel block size is 5 × 5, and the numeric value range of each digit is 0 to 9, the height H2 of the blank image is 50 pixels, and the width W2 is 5 × 6 is 30 pixels.
The position coordinates of the blocks of pixels of each digit carrying the digital code in the blank image are then determined. For example, taking the example that the digital code is "123456", the pixel block size is 5 × 5, and the value range of each digit is 0 to 9, each column of the blank image includes 10 pixel blocks in the height direction, and the numbers 0 to 9 are represented from top to bottom. Each digit of the digital code is represented by a column of the blank image. According to this rule, the position coordinates of the pixel block of each digit of the digital code "123456" can be determined. For example, the position coordinates of the pixel block of "1" is (1,1), "the position coordinates of the pixel block of" 2 "is (2,2)," the position coordinates of the pixel block of "3" is (3,3), "the position coordinates of the pixel block of" 4 "is (4,4)," the position coordinates of the pixel block of "5" is (5,5), "the position coordinates of the pixel block of" 6 "is (6, 6).
And finally, setting the pixel value of the pixel block of each digit for bearing the digital code in the blank image as a preset pixel value according to the determined position coordinate of the pixel block of each digit. The absolute value of the difference value between the preset pixel value and the pixel values of other pixel blocks except the pixel block bearing each bit number in the blank image is larger than the pixel block threshold value. For example, the preset pixel value is 0 (black), and the pixel values of the other pixel blocks are 255 (white).
For example, for the digital encoding "123456", the watermark image is as shown in FIG. 2.
Fig. 2A is a schematic diagram illustrating a watermark image according to some embodiments of the present disclosure.
As shown in fig. 2A, each dotted line small square represents a pixel block, each column includes 10 pixel blocks, and the pixel blocks represent numbers 0 to 9 from top to bottom. Each column from left to right represents the position of each digit in the numerical code. I.e., six digits arranged from left to right. The dotted lines in the figure merely assist in understanding the structure of the watermark image and do not belong to a part of the watermark image.
Each digit of the digital code "123456" has a pixel value of 0 at a pixel position (1,1), (2,2), (3,3), (4,4), (5,5), (6,6) of the watermark image, and appears black. The pixel values of the pixel blocks other than the pixel block in which each digit is located are 255, and white appears. The watermark image is a binary image.
Returning to fig. 1, in step S120, a positioning image is acquired. The positioning image comprises a positioning texture for positioning the position of the watermark image in the watermark carrier during the watermark extraction process. In some embodiments, the positioning texture includes at least one of textual content and graphical content. For example, the text content may be a reminder such as "copyright ownership, piracy do not need to be studied", "internal data, do not need to be transferred outside", etc. For example, the graphic content may be a company logo (logo), or the like.
In some embodiments, the localization image may be generated according to the width W3, the height H3, the background gray value, and the localization texture of the localization image, which are pre-configured by the user. For example, the watermark carrier is taken as a webpage, and in order to ensure the coverage density of the watermark image, the value ranges of W3 and H3 are 150-300 mm. For example, the background gray scale value is 230. The gray value of the localization texture is for example smaller than the background gray value. In some embodiments, transparency may also be set for the positioning texture in the positioning image according to the transparency of the positioning texture pre-configured by the user.
Fig. 2B is a schematic diagram illustrating a positioning image according to some embodiments of the present disclosure.
As shown in FIG. 2B, the positioning image includes a "no external transfer of internal data" positioning texture with a gray value of 230. The gray value of the locating texture is less than 230.
Returning to fig. 1, in step S130, the watermark image is embedded into the positioning image to obtain a composite image. The composite image includes a localization texture.
In some embodiments, the watermark image may be embedded in the positioning image using a digital watermark embedding algorithm. For example, the digital watermark embedding algorithm is Discrete Cosine Transform (DCT), Discrete Wavelet Transform (DWT), Discrete Fourier Transform (DFT), Discrete Wavelet Transform-Discrete Cosine Transform (DWT-DCT). In other embodiments, the background and the positioning texture of the positioning image may be separated, and after the watermark image is embedded into the background image layer of the positioning image, the image layers are combined.
In step S140, the composite image is superimposed onto the watermark carrier.
In some embodiments, superimposing the composite image into the watermark carrier may be achieved as follows.
Firstly, according to the superposition transparency required by superposing the composite image preset by a user, the composite image is subjected to enhancement processing.
For example, for each pixel point of the composite image, a target pixel value of each pixel point in the composite image is determined according to a first pixel value of each pixel point in the positioning image, a second pixel value of each pixel point in the composite image and the superposition transparency.
In some embodiments, for each of said pixel points: the target pixel value is negatively correlated with the first pixel value and positively correlated with the second pixel value; in the case that the second pixel value is greater than the first pixel value, the target pixel value is inversely related to the overlay transparency; under the condition that the second pixel value is smaller than the first pixel value, the target pixel value and the superposition transparency form positive correlation; in the case where the second pixel value is equal to the first pixel value, the target pixel value is equal to the first pixel value.
In some embodiments, calculating a difference between the second pixel value and the first pixel value of each pixel point; calculating the ratio of the difference value to the superposition transparency; and calculating the target pixel value of each pixel point according to the sum of the ratio and the first pixel value. For example, for a pixel with coordinates (x, y), the first pixel value is P1, the second pixel value is P2, the target pixel value is P, and the transparency is T. P ═ P2-P1)/T + P1.
Fig. 2C is a schematic diagram illustrating a composite image according to some embodiments of the present disclosure.
The image shown in fig. 2C is a composite image after enhancement processing. The enhancement processing of the composite image is to enhance the watermark image embedded in the positioning image.
And then, overlapping the enhanced composite image into the watermark carrier by overlapping transparency.
In the above embodiment, the difficulty of watermark extraction can be further reduced and the accuracy of watermark extraction can be further improved by performing enhancement processing on the composite image according to the superposition transparency.
In some embodiments, superimposing the composite image into the watermark carrier may also be achieved as follows.
Firstly, modifying the pixel value of the pixel point of which the pixel value is smaller than the truncation threshold value in the composite image into the truncation threshold value so as to perform pixel value truncation on the composite image. The truncation threshold is a pixel value threshold, for example 216.
And then, superposing the composite image subjected to pixel value truncation into a watermark carrier.
In the embodiment, the denoising is realized by performing pixel value truncation on the composite image, so that the user browsing experience can be improved.
In some embodiments, superimposing the composite image into the watermark carrier may also be achieved as follows.
First, a first pixel value of a positioning texture in a positioning image is obtained.
Then, the second pixel value of the localization texture in the composite image is restored to the first pixel value.
Finally, the second pixel value of the superposed positioning texture is restored into a composite image of the first pixel value to the watermark carrier.
In the above embodiment, by restoring the pixel values of the positioning texture, the definition of the positioning texture can be increased, the difficulty of extracting the watermark is further reduced, and the accuracy of extracting the watermark is further improved.
In some embodiments, the composite image may be further superimposed on the watermark carrier after the enhancement processing, the pixel value truncation, and the pixel value restoration are sequentially performed on the composite image.
FIG. 2D is a schematic diagram illustrating a composite image according to further embodiments of the present disclosure.
The image shown in fig. 2D is a composite image in which enhancement processing, pixel value truncation, and pixel value restoration are sequentially performed. Compared to fig. 2B, it can be seen that the localization texture is still clear, but other parts than the localization texture are enhanced, but the noise is less than that of fig. 2C.
In some embodiments, the composite image may be superimposed onto the watermark carrier in a tiled manner. For example, the composite image may be transparently superimposed into the watermark carrier in a user-preset superimposition.
Fig. 3A is a schematic diagram illustrating the superimposition of a composite image onto a watermark carrier, according to some embodiments of the present disclosure. Fig. 3A shows a diagram of the overlay effect of a composite image tile onto a watermark carrier with a transparency of 0.2. "test" is the text of the watermark carrier.
Fig. 3B is a schematic diagram illustrating the superimposition of a composite image onto a watermark carrier according to further embodiments of the present disclosure. Fig. 3B shows a diagram of the overlay effect of a composite image tile onto a watermark carrier with a transparency that may make the user imperceptible. The transparency imperceptible to the user is a transparency in which the gray value of the localization texture is adjusted to a value that differs from the gray value of the background of the composite image by less than or equal to 2, so that the composite image is not visible to the user. "test" is the text of the watermark carrier.
Fig. 4 is a flow chart illustrating a watermarking method according to some embodiments of the present disclosure.
As shown in fig. 4, the watermarking method for a watermark carrier includes steps S410 to S430. The watermark carrier is superimposed with a composite image in which the watermark image is embedded in the positioning image. The watermark image is generated according to the identification of the user browsing the watermark carrier and reflects the identification of the user. The positioning image and the composite image both comprise positioning textures for positioning the position of the watermark image in the watermark carrier during the watermark extraction process. For example, the watermarking method is performed by a watermarking apparatus.
In step S410, an image of at least a portion of the watermark carrier is acquired as an image to be processed. For example, the watermark carrier is a web page, and the image to be processed is a web page screenshot.
In step S420, the position of the composite image in the watermark carrier is located by using the location texture in the location image and the location texture in the image to be processed, so as to locate the position of the watermark image in the watermark carrier.
In some embodiments, the image to be processed may be pre-processed first. The preprocessing includes at least one of histogram equalization and local binarization. And then, positioning the position of the composite image in the watermark carrier by using the positioning texture in the positioning image and the positioning texture in the preprocessed image to be processed. For example, the size of the sliding window for local binarization is 50 × 50 mm, the step size is 50 mm, and the local binarization algorithm is OTSU (maximum inter-class variance) algorithm. Through the preprocessing, the difficulty of watermark extraction can be further reduced, and the accuracy of watermark extraction is further improved.
Fig. 5A is a schematic diagram illustrating an image to be processed according to some embodiments of the present disclosure. Fig. 5A is a to-be-processed image obtained by using the watermark carrier of fig. 3A as the to-be-processed image and performing histogram equalization on the to-be-processed image. It can be seen that FIG. 5A is texture enhanced relative to FIG. 3A.
FIG. 5B is a schematic diagram illustrating an image to be processed according to further embodiments of the present disclosure. Fig. 5B is a to-be-processed image in which the to-be-processed image of fig. 5A is subjected to picture binarization. It can be seen that the positioning texture becomes clearer in fig. 5B relative to fig. 5A.
In some embodiments, image feature point matching operation is performed on the positioning image and the image to be processed to obtain a plurality of groups of feature point pairs. And each group of characteristic point pairs is the corresponding relation between the pixel position coordinates of the pixel points matched with the characteristics in the positioning image and the pixel position coordinates in the image to be processed. And positioning the position of the composite image in the watermark carrier according to the plurality of groups of characteristic point pairs.
For example, image feature point matching operation can be performed on the positioning image and the to-be-processed image sequentially subjected to histogram equalization and local binarization to obtain a plurality of groups of feature point pairs. The image feature point matching may adopt a Scale-invariant feature transform (SIFT) algorithm, a FAST from obtained segment test (FAST) algorithm, an AKAZE algorithm, and the like.
Returning to fig. 4, in step S430, a watermark image is extracted from the image to be processed according to the position of the composite image in the watermark carrier.
In some embodiments, extracting the watermark image from the image to be processed may be achieved as follows.
Firstly, an affine matrix is calculated according to a plurality of groups of characteristic point pairs obtained by image characteristic point matching operation.
Next, an alignment operation (affine transformation) is performed on the image to be processed according to the affine matrix.
And then, intercepting a sub-image to be processed, on which a composite image is superimposed, from the aligned image to be processed according to the position of the composite image in the watermark carrier. For example, fig. 5C shows a sub-image to be processed, cut from the watermark carrier of fig. 3A.
And finally, extracting the watermark image from the subimage to be processed. For example, a watermark image may be extracted from the sub-image to be processed using a digital watermark extraction algorithm as opposed to a digital watermark embedding algorithm.
In some embodiments, a pixel value range representing a background of the sub-image to be processed may be determined for each image channel of the sub-image to be processed according to a pixel value of each pixel point in each image channel; according to the pixel value range, performing enhancement processing on the composite image superposed in the sub-image to be processed; and further extracting a watermark image from the sub-image to be processed after the enhancement processing. By means of enhancement processing, the difficulty of watermark extraction can be further reduced, and the accuracy of watermark extraction is further improved.
For example, fig. 5D shows the sub-image to be processed after the enhancement processing is performed on the composite image superimposed in the sub-image to be processed of fig. 5C. It can be seen that the texture of the sub-image to be processed shown in fig. 5D is stronger relative to fig. 5C. As another example, fig. 5E shows a watermark image extracted from the sub-image to be processed in fig. 5D.
For example, the composite image superimposed in the sub-images to be processed may be subjected to enhancement processing in the following manner.
First, a maximum pixel value and a minimum pixel value in a pixel value range characterizing the background of the sub-image to be processed are determined.
And then, aiming at each image channel of the sub-image to be processed, updating the pixel value of each pixel point according to the size relation between the pixel value of each pixel point and the maximum pixel value and the minimum pixel value so as to increase the contrast ratio between the background of the sub-image to be processed and the composite image.
For example, the composite image and the sub-image to be processed are both gray-scale images, and updating the pixel value of each pixel point includes: for each pixel point in each image channel of the sub-image to be processed, under the condition that the pixel value of each pixel point is smaller than the minimum pixel value, updating the pixel value of each pixel point to be 0; under the condition that the pixel value of each pixel point is larger than the maximum pixel value, updating the pixel value of each pixel point to be 255; and under the condition that the pixel value of each pixel point is greater than or equal to the minimum pixel value and less than or equal to the maximum pixel value, updating the pixel value of each pixel point according to the difference value between the maximum pixel value and the minimum pixel value and the pixel value of each pixel point, so that the updated pixel value is greater than the pixel value before updating.
For example, for each pixel point in each image channel of the sub-image to be processed, when the pixel value of each pixel point is greater than or equal to the minimum pixel value and less than or equal to the maximum pixel value, the updated pixel value is in negative correlation with the difference value and in positive correlation with the pixel value before updating. For example, the updated pixel value P _ new is (P-P _ new) × 255/(P _ max-P _ min), P is the pixel value before updating, P _ max is the maximum pixel value, and P _ min is the minimum pixel value.
In some embodiments, after extracting the watermark image, calculating an average value of pixel values of each pixel point in each pixel block in the extracted watermark image as a pixel block average value; determining the position of a pixel block where each digit of the digital code corresponding to the user identification is located according to the pixel block average value; determining digital codes according to the positions of the pixel blocks where the determined digits are located; the identity of the user is determined from the digital code. For example, the user identifier can be determined by the correspondence between the digital code and the user identifier, thereby achieving leakage tracing.
For example, the number is encoded as N bits, N being a positive integer. Determining the position of the pixel block where each digit of the numeric code corresponding to the user's identification is located comprises: calculating an average value of the average values of the pixel blocks corresponding to the pixel blocks as a reference average value; and determining the positions of the N pixel blocks with the largest difference value with the reference average value from the pixel block average values corresponding to the pixel blocks as the positions of the pixel blocks where the digit numbers of the digit codes are positioned.
Taking the example of generating the watermark image of fig. 2A as an example, for the watermark image of fig. 5E, the watermark image of fig. 5E is divided into 5 × 5 pixel blocks, and the pixel values of the pixel points in each pixel block are averaged to obtain a pixel block average value. And for each column after the pixel blocks are divided, selecting the number of the corresponding digital coding position with the largest difference between the average value of the pixel blocks and the average value of the pixel block average values of all the pixel blocks in the column.
In the above embodiment, the position of the watermark image in the watermark carrier can be located by the locating texture of the image to be processed and the locating texture in the locating image, so that the watermark image can be extracted, the difficulty of extracting the watermark can be reduced, and the accuracy of extracting the watermark can be improved.
Fig. 6 is a block diagram illustrating a watermarking apparatus according to some embodiments of the present disclosure.
As shown in fig. 6, the watermark processing apparatus 6 for watermark carriers includes a generating module 61, an obtaining module 62, an embedding module 63, and an superimposing module 64.
The generating module 61 is configured to generate a watermark image reflecting the identity of the user browsing the watermark carrier, for example, performing step S110 shown in fig. 1, according to the identity of the user.
The acquisition module 62 is configured to acquire a positioning image, for example, to perform step S120 as shown in fig. 1. The positioning image comprises a positioning texture for positioning the position of the watermark image in the watermark carrier in the watermark extraction process.
The embedding module 63 is configured to embed the watermark image into the positioning image, resulting in a composite image, for example, performing step S130 as shown in fig. 1. The composite image includes the localization texture.
The superimposing module 64 is configured to superimpose the composite image into the watermark carrier, for example performing step S140 as shown in fig. 1.
Fig. 7 is a block diagram illustrating a watermarking apparatus according to further embodiments of the present disclosure. The watermark carrier is superposed with a composite image in which a watermark image is embedded in a positioning image, the watermark image is generated according to the identification of a user browsing the watermark carrier and reflects the identification of the user, and both the positioning image and the composite image comprise positioning textures used for positioning the position of the watermark image in the watermark carrier in the watermark extraction process.
As shown in fig. 7, the watermark processing apparatus 7 for watermark carriers includes an obtaining module 71, a positioning module 72, and an extracting module 73.
The obtaining module 71 is configured to obtain an image of at least a part of the watermark carrier as an image to be processed, for example, to perform step S410 as shown in fig. 4.
The positioning module 72 is configured to position the position of the composite image in the watermark carrier by using the positioning texture in the positioning image and the positioning texture in the image to be processed, so as to position the position of the watermark image in the watermark carrier, for example, execute step S420 shown in fig. 4.
The extraction module 73 is configured to extract the watermark image from the image to be processed according to the position of the composite image in the watermark carrier, for example, to execute step S430 shown in fig. 4.
Fig. 8 is a block diagram illustrating a watermarking apparatus according to some embodiments of the present disclosure.
As shown in fig. 8, the watermark processing apparatus 8 for watermark carrier includes a memory 81; and a processor 82 coupled to the memory 81. The memory 81 is used for storing instructions for executing the corresponding embodiments of the watermarking method. The processor 82 is configured to perform the watermarking method in any of the embodiments of the present disclosure based on instructions stored in the memory 81. The watermarking means 8 may have the same or similar functionality as at least one of the watermarking means 6 and the watermarking means 7.
FIG. 9 is a block diagram illustrating a computer system for implementing some embodiments of the present disclosure.
As shown in FIG. 9, the computer system 90 may be embodied in the form of a general purpose computing device. The computer system 90 includes a memory 910, a processor 920, and a bus 900 that connects the various system components.
The memory 910 may include, for example, system memory, non-volatile storage media, and the like. The system memory stores, for example, an operating system, an application program, a Boot Loader (Boot Loader), and other programs. The system memory may include volatile storage media such as Random Access Memory (RAM) and/or cache memory. The non-volatile storage medium stores, for instance, instructions to perform corresponding embodiments of at least one of the watermarking methods. Non-volatile storage media include, but are not limited to, magnetic disk storage, optical storage, flash memory, and the like.
The processor 920 may be implemented as discrete hardware components, such as a general purpose processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other programmable logic device, discrete gates or transistors, or the like. Accordingly, each of the modules, such as the judging module and the determining module, may be implemented by a Central Processing Unit (CPU) executing instructions in a memory for performing the corresponding step, or may be implemented by a dedicated circuit for performing the corresponding step.
Bus 900 may use any of a variety of bus architectures. For example, bus structures include, but are not limited to, Industry Standard Architecture (ISA) bus, Micro Channel Architecture (MCA) bus, and Peripheral Component Interconnect (PCI) bus.
The computer system 90 may also include an input-output interface 930, a network interface 940, a storage interface 950, and so forth. These interfaces 930, 940, 950 and the memory 910 and the processor 920 may be connected by a bus 900. The input/output interface 930 may provide a connection interface for an input/output device such as a display, a mouse, a keyboard, and the like. The network interface 940 provides a connection interface for various networking devices. The storage interface 950 provides a connection interface for external storage devices such as a floppy disk, a usb disk, and an SD card.
Various aspects of the present disclosure are described herein with reference to flowchart illustrations and/or block diagrams of methods, apparatus and computer program products according to embodiments of the disclosure. It will be understood that each block of the flowchart illustrations and/or block diagrams, and combinations of blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer-readable program instructions.
These computer-readable program instructions may be provided to a processor of a general purpose computer, special purpose computer, or other programmable apparatus to produce a machine, such that the execution of the instructions by the processor results in an apparatus that implements the functions specified in the flowchart and/or block diagram block or blocks.
These computer-readable program instructions may also be stored in a computer-readable memory that can direct a computer to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instructions which implement the function specified in the flowchart and/or block diagram block or blocks.
The present disclosure may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects.
By the watermark processing method and device for the watermark carrier and the computer storage medium in the embodiment, the difficulty of adding and extracting the watermark can be reduced, and the accuracy of extracting the watermark can be improved.
So far, the watermarking method and apparatus for watermark carrier, computer-readable storage medium according to the present disclosure have been described in detail. Some details that are well known in the art have not been described in order to avoid obscuring the concepts of the present disclosure. It will be fully apparent to those skilled in the art from the foregoing description how to practice the presently disclosed embodiments.
- 上一篇:石墨接头机器人自动装卡簧、装栓机
- 下一篇:图像处理装置