Image pixel watermark embedding method, tracing method, system and electronic device
By adjusting pixel values in the image to embed watermark information and using dynamic embedding strategies and password hashing algorithms, the problem that existing watermarks are prone to tampering is solved, and higher data security and traceability are achieved.
Patent Information
- Application Number
- CN202411314327.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-19
- Publication Date
- 2025-01-07
- Estimated Expiration
- 2044-09-19
AI Technical Summary
Existing digital watermarks are easily tampered with or erased, making it difficult to ensure data security, and plain text watermarks are easily perceived and destroyed by users.
By adjusting the pixel value of the image pixels to embed the watermark information, a dynamic adaptive watermark embedding strategy and password hashing algorithm are used to generate pixel embedding rules to characterize the watermark information, and does not rely on the original image data during traceability.
It enhances the hiddenness and security of watermarks, prevents watermarks from being blocked, is suitable for different scenario needs, and improves the traceability accuracy and robustness of watermarks.
Smart Images

Figure CN118840246B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data security, and in particular to an image pixel watermark embedding method, a tracing method, a system and an electronic device. Background Art
[0002] At present, most commonly used digital watermarks are plaintext watermarks. When users obtain a picture with a plaintext watermark, they can use existing image editing technologies such as PS to erase or tamper with the plaintext watermark on the picture. At this time, the plaintext watermark on the picture is destroyed and key data will be leaked.
[0003] It can be seen that the plain text watermark can easily make users aware of the existence of the watermark and the watermark can be easily tampered with or erased, so that the addition of the watermark does not play a substantial preventive role and it is difficult to effectively ensure the security of the data. Summary of the invention
[0004] The embodiments of the present application provide an image pixel watermark embedding method, a tracing method, a system and an electronic device to embed a watermark by adjusting the pixel values of image pixels to ensure data security.
[0005] The embodiment of the present application provides an image pixel watermark embedding method, which is applied to an electronic device and includes:
[0006] Each single frame of the original image to be embedded with the watermark is divided into blocks to obtain N image blocks; N is greater than 1; any image block has corresponding block information for identifying the image block;
[0007] For each image block, a watermark embedding strategy corresponding to the block information of the image block is determined; the watermark embedding strategy of the image block indicates that the watermark information is represented by adjusting the pixel values of multiple pixels in the image block; the watermark information includes at least one watermark ciphertext; the watermark ciphertext is a ciphertext obtained by encrypting the watermark original text; the watermark embedding strategies corresponding to at least two image blocks in the same single-frame original image are different;
[0008] The pixel values of a plurality of pixels in the image block are adjusted according to the watermark embedding strategy of the image block, so that the watermark information is represented by each pixel with the adjusted pixel value.
[0009] The present application provides an image pixel watermark tracing method, which is applied to an electronic device and includes:
[0010] Each single frame of the original image embedded with the watermark information according to the above method is divided into blocks to obtain N image blocks; N is greater than 1;
[0011] Determine a reference embedding rule for at least one pixel in each image block according to the pixel embedding rule generation method described in the above method, so as to identify the watermark information embedded in the image block based on the reference embedding rule for at least one pixel in the image block; the reference embedding rule for any pixel is used to indicate a value of the pixel value of the pixel that is adjusted when the watermark information is embedded;
[0012] For each image block, based on the reference embedding rule of each reference image block other than the image block and the shape and proportion of each reference image block, determine the confidence of the image block; the confidence of the image block is used to indicate the similarity between the watermark information identified by the image block and the watermark information actually embedded in the image block; the reference image block refers to each image block other than the image block;
[0013] A target image block is determined from each image block based on the confidence level of each image block; and the watermark information in the target image block is decrypted to obtain the watermark original text.
[0014] An embodiment of the present application provides an electronic device, the electronic device comprising: a processor and a machine-readable storage medium;
[0015] The machine-readable storage medium stores machine-executable instructions that can be executed by the processor;
[0016] The processor is used to execute machine executable instructions to implement the steps of the above disclosed method.
[0017] An embodiment of the present application provides a computer program product, in which a computer program is stored. When the computer program is executed by a processor, the steps of the above-disclosed method are implemented.
[0018] It can be seen from the above technical solution that in this embodiment, the watermark information in the image block is displayed by adjusting the pixel value of each pixel in the image, rather than the existing conventional watermark plaintext, which enhances the concealment and security of the watermark, and can also effectively prevent the watermark from obstructing the image data, and can be better adapted to various different scene requirements.
[0019] Furthermore, this embodiment dynamically and adaptively determines a watermark embedding strategy for embedding a watermark in each image block into which a single frame original image to be embedded with a watermark is divided, combined with the block information of the image block, and adjusts the pixel values of multiple pixels in the image block according to the watermark embedding strategy of the image block to display the watermark information in the image block. Compared with the prior art that embeds watermark information in an image uniformly according to a fixed preset strategy, it effectively discretizes the expression of the watermark information in the image and enhances the security of the watermark.
[0020] Furthermore, this embodiment does not need to rely on the original image data embedded with the watermark information when tracing the source of the watermark, but instead uses the currently received single-frame original image to perform tracing, thereby enhancing the concealment and security of the watermark. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0022] Figure 1 A flow chart of a watermark embedding method provided in an embodiment of the present application;
[0023] Figure 2 A flowchart for implementing step 102 provided in an embodiment of the present application;
[0024] Figure 3 A flowchart for determining pixel embedding rules provided in an embodiment of the present application;
[0025] Figure 4 A flowchart for implementing step 303 provided in an embodiment of the present application;
[0026] Figure 5 A flow chart of the image watermark tracing method provided in the embodiment of the present application;
[0027] Figure 6 An image schematic diagram provided for an embodiment of the present application;
[0028] Figure 7 A flowchart for implementing step 503 provided in an embodiment of the present application;
[0029] Figure 8 A schematic diagram of an image involved in watermark traceability provided in an embodiment of the present application;
[0030] Fig. 9 A structural diagram of a device provided in an embodiment of the present application;
[0031] Fig.10 Another device structure diagram provided for an embodiment of the present application;
[0032] Fig.11 A structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0033] In order to enable those skilled in the art to better understand the technical solutions provided by the embodiments of the present application and to make the above-mentioned purposes, features and advantages of the embodiments of the present application more obvious and understandable, the technical solutions in the embodiments of the present application are further described in detail below in conjunction with the accompanying drawings.
[0034] See also Figure 1 , Figure 1 This is a flow chart of the watermark embedding method provided in the embodiment of the present application. The process can be applied to electronic devices such as terminals, and this embodiment is not specifically limited.
[0035] like Figure 1 As shown, the process may include the following steps:
[0036] Step 101, divide each single frame of the original image to be embedded with a watermark into blocks to obtain N image blocks; N is greater than 1.
[0037] In this embodiment, ffmpeg or other technologies may be used to process streaming media data such as video streams to obtain multiple single-frame original images (the format of which may be in YUV format). Here, the multiple single-frame original images are the above-mentioned single-frame original images to be embedded with watermarks.
[0038] As an embodiment, for each single frame of original image to be embedded with a watermark, this embodiment can divide the single frame of original image into blocks based on the set watermark redundancy to obtain N image blocks. N is greater than 1. Optionally, the watermark redundancy here is used to indicate the number N of watermarks embedded in the single frame of original image. For example, if the watermark redundancy indicates that the number N of watermarks embedded in the single frame of original image is 9, the single frame of original image can be divided into 9 image blocks.
[0039] In this embodiment, each of the N image blocks has corresponding block information such as a block number and other identification information for uniquely identifying the image block, which is not specifically limited in this embodiment.
[0040] Step 102: for each image block, determine a watermark embedding strategy corresponding to the block information of the image block.
[0041] In this embodiment, the watermark embedding strategy corresponding to the block information of any image block indicates that the watermark information is represented by adjusting the pixel values of multiple pixels in the image block. The watermark information here includes at least one watermark ciphertext.
[0042] In this embodiment, the watermark ciphertext is the ciphertext obtained by encrypting the watermark original text. As an embodiment, the watermark original text here may include at least one of the information such as user ID, device universal unique identifier (UUID: Universally Unique Identifier), timestamp and location. As another embodiment, the watermark original text here may also be custom information such as any string, etc., which is not specifically limited in this embodiment.
[0043] As an embodiment, this embodiment can use a preset encryption algorithm such as a symmetric encryption algorithm or an asymmetric encryption algorithm to encrypt the watermark original text to obtain the watermark ciphertext. Taking the symmetric encryption algorithm as an example, as an embodiment, this embodiment can use the watermark original text as plain text and the above-mentioned watermark encryption key to pass through the advanced encryption standard (AES: Advanced Encryption Standard), data encryption standard (DES: Data Encryption Standard), triple data encryption algorithm (3DES: Triple DES) and other processing in the symmetric encryption algorithm to generate the watermark ciphertext.
[0044] It should be noted that the watermark ciphertext obtained according to the above short hair is generally in hexadecimal format data. In this embodiment, the hexadecimal watermark ciphertext needs to be converted into a binary sequence, that is, one hexadecimal number is converted into four binary numbers. After obtaining the binary sequence of the watermark ciphertext, the subsequent watermark embedding process of this embodiment can be carried out. See the following description for details, which will not be repeated here.
[0045] As can be seen from the above, this embodiment determines the corresponding watermark embedding strategy for each image block based on the block information corresponding to each image block in the same single-frame original image. Since different image blocks have different block information such as block sequence numbers, the watermark embedding strategies corresponding to at least two image blocks in the same single-frame original image are different. The following will give examples to describe the watermark embedding strategies of each image block, which will not be described here.
[0046] Step 103: adjusting pixel values of a plurality of pixels in the image block according to the watermark embedding strategy of the image block, so that the watermark information in the image block is represented by each pixel with the adjusted pixel value.
[0047] As described above, the watermark embedding strategy of the image block, this step 103 can adjust the pixel values of multiple pixels in the image block according to the watermark embedding strategy of the image block. After the pixel values of each pixel are adjusted, it means that the watermark information in the image block is completely embedded, and the image block at this time is equivalent to the presence of the above watermark information. That is, it is finally achieved that the watermark information in the image block is represented by each pixel whose pixel value is adjusted.
[0048] So far, completed Figure 1 The process shown.
[0049] pass Figure 1 It can be seen from the process shown that in this embodiment, the watermark information in the image block is represented by adjusting the pixel value of each pixel in the image, rather than the existing conventional watermark plaintext, which enhances the concealment and security of the watermark, and can also effectively prevent the watermark from obstructing the image data, and can be better adapted to various different scene requirements.
[0050] Furthermore, this embodiment adaptively and dynamically determines a watermark embedding strategy for embedding a watermark in each image block into which a single-frame original image to be embedded with a watermark is divided, and adjusts the pixel values of multiple pixels in the image block according to the watermark embedding strategy of the image block to display the watermark information in the image block. Compared with the prior art that embeds watermark information uniformly in the entire image according to a fixed preset strategy, it effectively discretizes the expression of the watermark information in the image and enhances the security of the watermark.
[0051] The above step 102 is described below by way of example:
[0052] See also Figure 2 , Figure 2 The step 102 provided in the embodiment of the present application is implemented as a flowchart. Figure 2 As shown, the process may include the following steps:
[0053] Step 201, obtaining the length L of the watermark information to be embedded in the image block; the length L of the watermark information includes the lengths of M watermark ciphertexts.
[0054] In this embodiment, the watermark repetition redundancy set for the image block may be multiplied by the binary sequence length of the watermark ciphertext to obtain the information length that needs to be embedded in the image block.
[0055] Step 202: Based on the watermark information length L, a watermark embedding strategy corresponding to the block information of the image block is generated, so that the pixel value of each pixel in the image block is adjusted based on the watermark embedding strategy, so that the watermark information with the watermark information length of the above L in the image block is represented by each pixel with adjusted pixel value.
[0056] As an embodiment, the watermark embedding strategy of the image block includes a pixel embedding rule for at least one pixel in the image block; the pixel embedding rule of any pixel is used to indicate whether the value of each bit in the pixel value of the pixel needs to be adjusted, and to indicate the adjusted value of the bit when it is determined that the value of any bit needs to be adjusted, so that the watermark information with a watermark information length of L in the image block is displayed by adjusting the pixel values of each pixel in the image block.
[0057] Optionally, in this embodiment, there are many implementation methods for the pixel embedding rule of at least one pixel in the image block in specific implementation. Figure 3 One of the implementation methods will be described with an example, which will not be described here.
[0058] So far, completed Figure 2 The process shown.
[0059] pass Figure 2 The process shown implements how to determine the watermark embedding strategy corresponding to the block information of each image block.
[0060] Below Figure 3 The process shown is described as follows:
[0061] See also Figure 3 , Figure 3 The flowchart for determining pixel embedding rules provided in the embodiment of the present application is as follows. Figure 3 As shown, the process may include the following steps:
[0062] Step 301, performing mixing processing on the key encoding data and the block information corresponding to the image block to obtain mixed data.
[0063] In this embodiment, the key encoding data is the data obtained after the watermark encryption key is encoded. As an embodiment, electronic devices of different device types (whose security requirements are also different) may have different corresponding watermark encryption keys. As an embodiment, the watermark encryption key here may be a watermark encryption key generated for the device and obtained by the above-mentioned electronic device from an external source such as a server. As another embodiment, the watermark encryption key here may also be a watermark encryption key locally recorded by the above-mentioned electronic device (which is a watermark encryption key generated for the device and obtained by the electronic device from an external source such as a server).
[0064] As an embodiment, the encoding method for encoding the watermark encryption key may be fixed-length encoding such as ASCII. Optionally, using fixed-length encoding can facilitate encoding of common watermark encryption keys composed of letters and / or numbers. As another embodiment, the encoding method for encoding the watermark encryption key may be variable-length encoding such as Huffman encoding. Using variable-length encoding can facilitate encoding of watermark encryption keys composed of any characters (including but not limited to Chinese characters and special symbols). This embodiment does not specifically limit the encoding method for encoding the watermark encryption key.
[0065] Optionally, the key encoding data mentioned above may be represented in binary.
[0066] Optionally, the above-mentioned block information may be a block number such as 1, indicating the first image block in the above-mentioned single-frame original image. Based on this, in the present embodiment, in the above-mentioned step 301, the key coded data and the block information corresponding to the image block are mixed to obtain mixed data, which may include: performing a specified operation on the binary representation of the key coded data and the block number, and using the obtained result as the mixed data. For example, the binary representation of the key coded data and the block number such as [m, n] are directly subjected to a specified operation such as multiplication, and the obtained result is used as the mixed data.
[0067] Step 302: Process the mixed data using a cryptographic hash algorithm to obtain hash information.
[0068] For example, the mixed data is hashed using a cryptographic hash algorithm, and the obtained hash result is used as the hash information.
[0069] Step 303: assign a corresponding watermark embedding mask to at least one pixel in the image block based on the hash information, and determine a pixel embedding rule for each pixel in the image block according to the watermark embedding mask assigned to each pixel in the image block.
[0070] As an embodiment, for ease of management, the above-mentioned password hash algorithm may be a fixed-length password hash algorithm such as a fixed-length password hash function such as MD5, etc., which is not specifically limited in this embodiment. Correspondingly, the above-mentioned hash information may be fixed-length hash information.
[0071] Based on this, as an embodiment, there are multiple implementation methods for the specific implementation of step 303, for example, converting the above-mentioned fixed-length hash information into a binary sequence, grouping the binary sequence or the values of a specified number of binary bits in the binary sequence, such as the first 32 bits, to obtain multiple binary arrays; any binary array includes P adjacent binary numbers, P is greater than 1; and each binary array is assigned to each pixel in the image block in sequence as a watermark embedding mask for each pixel. It should be noted that if the number of binary arrays K1 is less than the number of pixels K2 in the image block to be assigned watermark embedding masks, then K1 binary arrays can be assigned to K1 pixels in the image block in sequence, and then the K1 binary arrays can be assigned to other pixels in the image block in sequence, and so on.
[0072] As an embodiment, the watermark embedding mask assigned to any pixel indicates the watermark embedding rule of the pixel. Among them, each binary bit in the watermark embedding mask assigned to any pixel corresponds to each bit in the pixel value of the pixel (recorded as pixel bit); the pixel value of any pixel is composed of the value on the Q bit (that is, the above-mentioned pixel bit). For example, the first binary bit in the watermark embedding mask assigned to any pixel corresponds to the first bit in the pixel value of the pixel (recorded as pixel bit), and so on, until the last binary bit in the watermark embedding mask assigned to the pixel corresponds to the G1th bit in the pixel value of the pixel (recorded as pixel bit), and then the first binary bit in the watermark embedding mask assigned to the pixel corresponds to the G1+1th bit in the pixel value of the pixel (recorded as pixel bit), and so on, until the last bit in the pixel value of the pixel.
[0073] In this embodiment, each binary bit in the binary sequence of the watermark ciphertext corresponds to each pixel bit in the pixel value of any pixel. For example, the first binary bit in the binary sequence of the watermark ciphertext corresponds to the first bit in the pixel value of the pixel (recorded as pixel bit), and so on, until the last binary bit in the binary sequence of the watermark ciphertext corresponds to the G2th bit (recorded as pixel bit) in the pixel value of the pixel, and then the first binary bit in the binary sequence of the watermark ciphertext corresponds to the G2+1th bit (recorded as pixel bit) in the pixel value of the pixel, and so on, until the last bit in the pixel value of the pixel.
[0074] Based on this, in this embodiment, when a watermark is assigned to any pixel and embedded in the mask, if the value on a binary bit is the first value, such as 1, it means that the value on the pixel bit corresponding to the binary bit in the pixel value of the pixel needs to be adjusted, and the adjusted value is the value on the binary bit corresponding to the pixel bit in the binary sequence of the watermark ciphertext.
[0075] For example, the watermark embedding mask assigned to any pixel is represented by a four-bit binary number, such as 0110. If the above-mentioned first value is 1, it indicates that the value of the second bit and the value of the third bit in the pixel value of the pixel need to be adjusted, wherein the value of the second bit is adjusted to the value of the second binary bit in the binary sequence of the watermark ciphertext, and the value of the third bit is adjusted to the value of the third binary bit in the binary sequence of the watermark ciphertext.
[0076] As another example, Figure 4 Step 303 is shown as an example and will not be described in detail here.
[0077] Since the hash information of the mixed data is different due to different block information such as numbers of different image blocks, the pixel embedding rules of each pixel generated by the above method also show different states in each image block, which greatly reduces the perception of the watermark information.
[0078] So far, completed Figure 3 The process shown.
[0079] pass Figure 3 The process shown finally realizes how to determine the pixel embedding rule of at least one pixel in the image block.
[0080] pass Figure 3 As shown in the process, this embodiment can realize discrete watermark embedding by using a cryptographic hash function according to the block number of the image block and key encoding data and other information, thereby realizing the discretization and unidirectionality of watermark embedding, so that the same watermark information shows different states in different image blocks.
[0081] Below Figure 4The process shown is described as follows:
[0082] See also Figure 4 , Figure 4 The step 303 provided in the embodiment of the present application is implemented as a flowchart. The process may include the following steps:
[0083] Step 401, traverse the pixels in the image block in order, and determine the traversed pixel as the current pixel.
[0084] For example, the pixels in the image block are traversed in order from front to back and from left to right.
[0085] Step 402, traverse each binary array in order, and use the traversed binary array as the current binary array.
[0086] The binary arrays here are as described above, and are specifically obtained by converting the above-mentioned hash information, such as fixed-length hash information, into a binary sequence and grouping the binary sequence or a specified number of binary numbers in the binary sequence in order; any binary array includes P adjacent binary numbers, and P is greater than 1.
[0087] Step 403: assign the current binary array to the current pixel as a watermark embedding mask for the current pixel; and generate a pixel embedding rule for the current pixel according to the watermark embedding mask for the current pixel.
[0088] As an embodiment, each binary bit in the watermark embedding mask assigned to any pixel has a corresponding relationship with each pixel bit in the pixel value of the pixel; the pixel value of any pixel is composed of values on Q pixel bits;
[0089] Likewise, each binary bit in the binary sequence of the watermark ciphertext has a corresponding relationship with each pixel bit in the pixel value of the pixel;
[0090] Based on this, in step 403, the pixel embedding rule of the current pixel is generated according to the watermark embedding mask of the current pixel, including: for each binary bit in the watermark embedding mask assigned to any pixel, if the value on the binary bit is a first value, such as 1, it is determined that the value on the pixel bit corresponding to the binary bit in the pixel value of the pixel needs to be adjusted, and the adjusted value is the value on the binary bit corresponding to the pixel bit in the binary sequence of the watermark ciphertext, and if the value on the binary bit is a second value different from the first value, such as 0, it is determined that the value on the pixel bit corresponding to the binary bit in the pixel value of the pixel does not need to be adjusted. That is, the pixel embedding rule of the current pixel is determined.
[0091] Step 404, when the current pixel is not the last pixel, if it is determined based on the pixel embedding rules of the traversed pixels including the current pixel that the watermark information of the image block is less than the above L, then return to the step of traversing the pixels in the image block in sequence, and if it is equal to or greater than the above L, then end the current process.
[0092] pass Figure 4 As can be seen from the process shown in the figure, this embodiment only repeatedly determines the pixel embedding rule of pixels in the image block based on L. Once it is determined based on the pixel embedding rule of each pixel that the watermark information that can be embedded in the image block reaches the above L, the current process is directly terminated, and no further execution is performed on other pixels in the image block. Figure 4 The process shown saves resources and improves efficiency.
[0093] So far, completed Figure 4 The process shown.
[0094] pass Figure 4 The process shown implements the above step 303 .
[0095] It should be noted that, in this embodiment, if it is found that the watermark information embedded in the image block based on the pixel embedding rule of all pixels in the image block is less than the above L, the above hash information can be adjusted according to the preset flip density requirement. Then, the process returns to step 303.
[0096] As an embodiment, here, adjusting the above hash information according to the preset flip density requirement may be, for example, adjusting at least one second value whose density in the above hash information, such as the fixed-length hash information, meets the preset flip density requirement to a first value. For example, taking the second value as 0, if the values of three consecutive binary bits in the fixed-length hash information are all 0 (meeting the preset flip density requirement, such as the values of three consecutive binary bits are all 0), then one of the values may be adjusted from 0 to 1. Then, the above step 303 is returned to meet the requirement of embedding watermark information of length L in the image block.
[0097] In addition, in this embodiment, in order to ensure that the length of the watermark information embedded in each image block does not need to be known during tracing, a watermark end mark of a certain length can be embedded after each watermark ciphertext is embedded, thereby expressing the completion of the embedding of a single watermark ciphertext.
[0098] Optionally, this embodiment may also add a check information bit to the embedded watermark information to ensure the integrity of the watermark information.
[0099] The above describes the embedding of image watermarks. The following describes the image watermark tracing method provided by the embodiment of the present application:
[0100] See also Figure 5 , Figure 5This is a flow chart of the image watermark tracing method provided in the embodiment of the present application. The method is applied to electronic devices and may include:
[0101] Step 501, divide each single frame of the original image embedded with watermark information according to the above method into blocks to obtain N image blocks; N is greater than 1; any image block has corresponding block information for identifying the image block.
[0102] This step 501 is similar to the above step 101 and will not be described again here.
[0103] Step 502, determine the reference embedding rule of at least one pixel in each image block according to the pixel embedding rule generation method described in the above method, so as to identify the target watermark information embedded in the image block based on the reference embedding rule of at least one pixel in each image block; the reference embedding rule of any pixel is used to indicate the numerical value of the pixel value of the pixel that is adjusted when the watermark information is embedded.
[0104] For example, for each image block, the key encoding data and the block information corresponding to the image block are mixed to obtain mixed data; the above mixed data is processed using a cryptographic hash algorithm to obtain hash information; based on the hash information, a corresponding watermark embedding mask is assigned to at least one pixel in the image block, and the reference pixel embedding rule of each pixel in the image block is determined according to the watermark embedding mask assigned to each pixel in the image block. For example, if the watermark embedding mask of a pixel is 1001, it means that the values on the first pixel bit and the fourth pixel bit of the pixel have been adjusted, which is the watermark ciphertext data, and so on, and the watermark ciphertext data will eventually be read from each image block. As described above, due to the watermark redundancy, a single image block will be embedded with multiple watermark ciphertexts, so according to the number of times k read by the above watermark end mark (for example, when the watermark redundancy is 5, it means that a single image block is embedded with 5 watermark ciphertexts, then when the 5 watermark end marks are read, the tracing of the watermark ciphertext in the image block can be ended). Then, the complete watermark ciphertext of each segment embedded in a single image block is obtained according to the number of times k.
[0105] As an embodiment, this embodiment can arbitrarily select a segment of watermark ciphertext from the above watermark information as the watermark information identified in the above step 502, or can select a segment of watermark ciphertext embedded the most times in the image block as the watermark information identified in the above step 502, or can use all segments of watermark ciphertext embedded in the image block as the watermark information identified in the above step 502, and this embodiment is not specifically limited.
[0106] Step 503, for each image block, based on the reference embedding rule of each reference image block other than the image block and the shape and proportion of the reference image block, determine the confidence of the image block; the confidence of the image block is used to indicate the similarity between the watermark information identified by the image block and the watermark information actually embedded in the image block.
[0107] As an embodiment, the reference image block here refers to image blocks other than the image block.
[0108] It should be noted that the original single-frame image with watermark information embedded is Figure 6 6A in FIG. 6A, which is obtained by subsequent reception, such as by photographing or deforming. Figure 6 The single frame original image shown in 6B is different. To improve the accuracy of tracing, this embodiment calculates the confidence of each image block in the currently received single frame original image so that an image block for tracing can be selected based on the confidence later, as shown in step 504.
[0109] As for how to determine the confidence of an image block, there are many ways to implement it. Figure 7 An example is given to illustrate one implementation method, which will not be described in detail here.
[0110] Step 504: determine a target image block from each image block based on the confidence level of each image block; and decrypt the watermark information in the target image block to obtain the original watermark text.
[0111] For example, selecting the image block with the highest confidence as the target image block makes the watermark information traceability more accurate and more robust.
[0112] Based on the description of step 502, the watermark information in each image block is identified. Based on this, the watermark information in the target image block can be directly decrypted, for example, using the decryption key corresponding to the watermark encryption key to obtain the original watermark.
[0113] So far, completed Figure 5 The process shown.
[0114] pass Figure 5 The process shown realizes the image watermark traceability.
[0115] Below Figure 7 The process shown is described as follows:
[0116] See also Figure 7 , Figure 7 The specific implementation flow chart of step 503 provided in the embodiment of the present application. Figure 7 As shown, the process may include the following steps:
[0117] Step 701: for each image block, based on the watermark information embedded in the image block and the reference pixel embedding rule of each pixel in each reference image block except the image block, generate reference watermark information in each reference image block.
[0118] In this embodiment, the watermark information embedded in different image blocks is the same. Based on this, this embodiment can generate the reference watermark information in each reference image block based on the watermark information embedded in the image block and the reference pixel embedding rule of each pixel in each reference image block except the image block, as described in step 502 above.
[0119] Step 702, display the reference watermark information in each reference image block in the image block template and adjust the image block template to obtain a matching block corresponding to each reference image block; the shape and proportion of each reference image block and the matching block corresponding to the reference image block meet the similarity requirement.
[0120] like Figure 8 The above-mentioned Figure 6 For the image block a in the image shown in FIG6B , based on the watermark information embedded in the image block a and the reference pixel embedding rule of each pixel in the image block b other than the image block, the reference watermark information in the image block b is generated. The reference watermark information in the image block b is displayed in the image block template and the image block template is adjusted to obtain the matching block corresponding to each reference image block, as shown in FIG6B . Figure 8 The adjustment here, such as stretching, scaling, etc., is almost the transformation required by anisotropic filtering, and this embodiment does not specifically limit it, as long as the shape and ratio of each reference image block and the matching block corresponding to the reference image block can finally meet the similarity requirement.
[0121] Step 703: Determine the confidence of the image block according to the matching degree between each reference image block and the matching block corresponding to each reference image block.
[0122] For example, for each reference image block, determine the degree of match between the reference image block and the pixels at the same position in the matching block corresponding to the reference image block; and determine the confidence of the image block based on the degree of match between each reference image block and the pixels at the same position in the matching block corresponding to the reference image block.
[0123] Still like Figure 8 The above-mentioned Figure 6For example, for the image block a in the image shown in FIG6B , as described in step 702, based on the watermark information embedded in the image block a and the reference pixel embedding rule of each pixel in the image block b other than the image block a, the reference watermark information in the image block b is generated. The reference watermark information in the image block b is displayed in the image block template (specifically, as shown in FIG6B ). Figure 8 As shown in 8B of FIG. Figure 8 The image block template shown in 8B is adjusted to obtain a matching block corresponding to each reference image block, as shown in FIG. Figure 8 8C in . Then, the calculation is as follows Figure 8 The matching block shown in 8C is Figure 6 The image block b shown in 6B (i.e. Figure 8 8D in FIG. 8D ) (for example, if the pixel values of the pixels at the same position are the same, the matching degree between the pixels at the same position is considered to be 100%, and the matching degree between the pixels at the same position is reduced accordingly in other cases), and then the confidence of the image block can be determined according to the matching degree between the pixels at the same position in each reference image block and the matching block corresponding to each reference image block. For example, the confidence of the image block is determined according to the number of pixels at the same position in each reference image block and the matching block corresponding to each reference image block whose matching degree is 100%, such as directly determining the number as the confidence.
[0124] So far, completed Figure 7 The process shown.
[0125] pass Figure 7 The process shown finally implements the above step 503.
[0126] The method provided in the embodiment of the present application is described above. The system and device provided in the embodiment of the present application are described below:
[0127] The present application embodiment provides an image watermarking system, the system comprising: a system for executing Figure 1 The device of the process shown in Figure 5 The device of the process shown.
[0128] Correspondingly, the embodiment of the present application also provides corresponding Figure 1 The structural diagram of the device for the process shown. Fig. 9 , Fig. 9 This is a diagram of the device structure provided in the embodiment of the present application. Fig. 9 As shown, the device may include:
[0129] A determination unit is used to divide each single frame of the original image to be embedded with the watermark into blocks to obtain N image blocks; N is greater than 1; any image block has corresponding block information for identifying the image block; and
[0130] For each image block, a watermark embedding strategy corresponding to the block information of the image block is determined; the watermark embedding strategy of the image block indicates that the watermark information is represented by adjusting the pixel values of multiple pixels in the image block; the watermark information includes at least one watermark ciphertext; the watermark ciphertext is a ciphertext obtained by encrypting the watermark original text; the watermark embedding strategies corresponding to at least two image blocks in the same single-frame original image are different;
[0131] The watermark embedding unit is used to adjust the pixel values of multiple pixels in the image block according to the watermark embedding strategy of the image block, so as to represent the watermark information in the image block through each pixel with adjusted pixel value.
[0132] Optionally, determining a watermark embedding strategy corresponding to the block information of the image block includes:
[0133] Obtaining the watermark information length L to be embedded in the image block; the watermark information length L includes the lengths of M watermark ciphertexts;
[0134] Based on the watermark information length L, a watermark embedding strategy corresponding to the block information of the image block is generated, so that the pixel value of each pixel in the image block is adjusted based on the watermark embedding strategy, so that the watermark information with a watermark information length of L in the image block is represented by each pixel with adjusted pixel value.
[0135] Optionally, the watermark embedding strategy of the image block includes a pixel embedding rule of at least one pixel in the image block;
[0136] The pixel embedding rule of any pixel is used to indicate whether the value of each bit in the pixel value of the pixel needs to be adjusted, and to indicate the adjusted value of the bit when it is determined that the value of any bit needs to be adjusted, so that the watermark information with a watermark information length of L in the image block is displayed by adjusting the pixel values of each pixel in the image block.
[0137] Optionally, the pixel embedding rule of at least one pixel in the image block is determined by the following steps:
[0138] The key-encoded data and the block information corresponding to the image block are mixed to obtain mixed data; the key-encoded data is data obtained after the watermark encryption key is encoded;
[0139] Processing the mixed data using a cryptographic hash algorithm to obtain hash information;
[0140] A corresponding watermark embedding mask is allocated to at least one pixel in the image block based on the hash information, and a pixel embedding rule for each pixel in the image block is determined according to the watermark embedding mask allocated to each pixel in the image block.
[0141] Optionally, the block information is a block number, and the key encoding data is represented by binary;
[0142] The mixing process of the key coded data and the block information corresponding to the image block to obtain the mixed data includes:
[0143] A specified operation is performed on the binary representation of the key-encoded data and the block number, and the obtained result is used as the mixed data.
[0144] Optionally, assigning a corresponding watermark embedding mask to at least one pixel in the image block based on the hash information, and determining a pixel embedding rule for each pixel in the image block according to the watermark embedding mask assigned to each pixel in the image block comprises:
[0145] Traversing pixels in the image block in order, and determining the traversed pixel as the current pixel; traversing each binary array in order, and determining the traversed binary array as the current binary array; each binary array is obtained by converting the hash information into a binary sequence and grouping the binary sequence or a specified number of binary numbers in the binary sequence in order; any binary array includes P adjacent binary numbers, and P is greater than 1;
[0146] The current binary array is assigned to the current pixel as the watermark embedding mask of the current pixel; a pixel embedding rule of the current pixel is generated according to the watermark embedding mask of the current pixel; when the current pixel is not the last pixel, if it is determined based on the pixel embedding rules of the traversed pixels including the current pixel that the watermark information of the image block is less than the L, then return to the step of traversing the pixels in the image block in sequence, and if it is equal to or greater than the L, then end the current process.
[0147] Optionally, each binary bit in the watermark embedding mask assigned to any pixel has a corresponding relationship with each pixel bit in the pixel value of the pixel; the pixel value of any pixel is composed of values on Q pixel bits;
[0148] Each binary bit in the binary sequence of the watermark ciphertext has a corresponding relationship with each pixel bit in the pixel value of the pixel;
[0149] The pixel embedding rule for generating the current pixel according to the watermark embedding mask of the current pixel includes:
[0150] For each binary bit in the watermark embedding mask assigned to any pixel, if the value on the binary bit is a first value, it is determined that the value on the pixel bit corresponding to the binary bit in the pixel value of the pixel needs to be adjusted, and the adjusted value is the value on the binary bit corresponding to the pixel bit in the binary sequence of the watermark ciphertext; if the value on the binary bit is a second value different from the first value, it is determined that the value on the pixel bit corresponding to the binary bit in the pixel value of the pixel does not need to be adjusted.
[0151] Optionally, the determining unit further includes:
[0152] If the current pixel is the last pixel, when it is determined based on the pixel embedding rule of each pixel in the image block that the watermark information of the image block is less than the L, the hash information is adjusted according to the preset flip density requirement, and the step of assigning a corresponding watermark embedding mask to at least one pixel in the image block based on the hash information and determining the pixel embedding rule of each pixel in the image block according to the watermark embedding mask assigned to each pixel in the image block is returned;
[0153] The step of adjusting the hash information according to the preset flip density includes adjusting the second value whose density in the hash information meets the preset flip density requirement, so as to adjust at least one second value whose density meets the preset flip density requirement to the first value.
[0154] Optionally, the image block is also embedded with a watermark end mark;
[0155] A watermark end mark is set after each watermark ciphertext in the image block, so as to trace the watermark information based on the watermark end mark.
[0156] So far, completed Fig. 9 Structural description of the device shown.
[0157] See also Fig.10 , Fig.10 Another device structure diagram provided in the embodiment of the present application. The device corresponds to Figure 5 The process shown may include:
[0158] A processing unit, configured to divide each single frame of the original image into blocks in which the watermark information is embedded according to the above method, to obtain N image blocks; N is greater than 1; and
[0159] Determine a reference embedding rule for at least one pixel in each image block according to the pixel embedding rule generation method described in the above method, so as to identify the watermark information embedded in the image block based on the reference embedding rule for at least one pixel in the image block; the reference embedding rule for any pixel is used to indicate the value of the pixel value of the pixel that is adjusted when the watermark information is embedded; and,
[0160] For each image block, based on the reference embedding rule of each reference image block other than the image block and the shape and proportion of each reference image block, determine the confidence of the image block; the confidence of the image block is used to indicate the similarity between the watermark information identified by the image block and the watermark information actually embedded in the image block; the reference image block refers to each image block other than the image block;
[0161] The source tracing unit is used to determine a target image block from each image block based on the confidence of each image block; and decrypt the watermark information in the target image block to obtain the watermark original text.
[0162] Optionally, for each image block, determining the confidence of the image block based on reference embedding rules of other image blocks except the image block and shapes and proportions of the other image blocks includes:
[0163] For each image block, based on the watermark information embedded in the image block and the reference pixel embedding rule of each pixel in each reference image block except the image block, generate reference watermark information in each reference image block;
[0164] The reference watermark information in each reference image block is displayed in the image block template and the image block template is adjusted to obtain a matching block corresponding to each reference image block; the shape and ratio of each reference image block and the matching block corresponding to the reference image block meet the similarity requirements;
[0165] The confidence of the image block is determined according to the matching degree between each reference image block and the matching block corresponding to each reference image block.
[0166] Optionally, determining the confidence of the image block according to the matching degree between each reference image block and the matching block corresponding to each reference image block includes:
[0167] For each reference image block, determining a matching degree between the reference image block and pixels at the same position in a matching block corresponding to the reference image block;
[0168] The confidence of the image block is determined according to the matching degree between each reference image block and the pixels at the same position in the matching block corresponding to each reference image block.
[0169] So far, completed Fig.10 Structural description of the device shown.
[0170] The present application also provides Fig. 9 or the hardware structure of the device shown in 10. Fig.11 , Fig.11 This is a structural diagram of an electronic device provided in an embodiment of the present application. Fig.11As shown, the hardware structure may include: a processor and a machine-readable storage medium, the machine-readable storage medium storing machine-executable instructions that can be executed by the processor; the processor is used to execute the machine-executable instructions to implement the method disclosed in the above example of this application.
[0171] Based on the same application concept as the above method, an embodiment of the present application also provides a machine-readable storage medium, on which a number of computer instructions are stored. When the computer instructions are executed by a processor, the method disclosed in the above example of the present application can be implemented.
[0172] Based on the same application concept as the above method, an embodiment of the present application further provides a computer program product, wherein the computer program product stores a computer program, and when the computer program is executed by a processor, the method disclosed in the above example of the present application is implemented.
[0173] Exemplarily, the above-mentioned machine-readable storage medium can be any electronic, magnetic, optical or other physical storage device, which can contain or store information, such as executable instructions, data, etc. For example, the machine-readable storage medium can be: RAM (Radom Access Memory), volatile memory, non-volatile memory, flash memory, storage drive (such as hard disk drive), solid state drive, any type of storage disk (such as optical disk, DVD, etc.), or similar storage medium, or a combination thereof.
[0174] The above is only an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.
Claims
1. A method for embedding pixel watermark in an image, characterized in that: The method is applied to an electronic device, comprising: Each single frame of the original image to be embedded with the watermark is divided into blocks to obtain N image blocks; N is greater than 1; any image block has corresponding block information for identifying the image block; For each image block, a watermark embedding strategy corresponding to the block information of the image block is determined; the watermark embedding strategy of the image block indicates that the watermark information is characterized by adjusting the pixel values of multiple pixels in the image block; the watermark information includes at least one watermark ciphertext; the watermark ciphertext is a ciphertext obtained by encrypting the watermark original text; the watermark embedding strategies corresponding to at least two image blocks in the same single-frame original image are different; wherein the watermark embedding strategy of the image block includes a pixel embedding rule of at least one pixel in the image block; the pixel embedding rule of any pixel is used to indicate whether the value of each bit in the pixel value of the pixel needs to be adjusted, and to indicate that when it is determined that the value of any bit needs to be adjusted, the bit is adjusted The watermark information of the watermark information length L in the image block is displayed by adjusting the pixel value of each pixel in the image block; wherein the pixel embedding rule of at least one pixel in the image block is determined by the following steps: mixing the key encoding data and the block information corresponding to the image block to obtain mixed data; the key encoding data is the data obtained after the watermark encryption key is encoded; the mixed data is processed by a cryptographic hash algorithm to obtain hash information; based on the hash information, a corresponding watermark embedding mask is assigned to at least one pixel in the image block, and the pixel embedding rule of each pixel in the image block is determined according to the watermark embedding mask assigned to each pixel in the image block; The pixel values of a plurality of pixels in the image block are adjusted according to the watermark embedding strategy of the image block, so that the watermark information is represented by each pixel with the adjusted pixel value.
2. The method according to claim 1, characterized in that The step of determining a watermark embedding strategy corresponding to the block information of the image block comprises: Obtaining the watermark information length L to be embedded in the image block; the watermark information length L includes the lengths of M watermark ciphertexts; Based on the watermark information length L, a watermark embedding strategy corresponding to the block information of the image block is generated, so that the pixel value of each pixel in the image block is adjusted based on the watermark embedding strategy, so that the watermark information with a watermark information length of L in the image block is represented by each pixel with adjusted pixel value.
3. The method according to claim 1, characterized in that The block information is a block number, and the key encoding data is represented by binary; The mixing process of the key coded data and the block information corresponding to the image block to obtain the mixed data includes: A specified operation is performed on the binary representation of the key-encoded data and the block number, and the obtained result is used as the mixed data.
4. The method according to claim 1, characterized in that: The step of assigning a corresponding watermark embedding mask to at least one pixel in the image block based on the hash information, and determining a pixel embedding rule for each pixel in the image block according to the watermark embedding mask assigned to each pixel in the image block comprises: Traversing pixels in the image block in order, and determining the traversed pixel as the current pixel; traversing each binary array in order, and determining the traversed binary array as the current binary array; each binary array is obtained by converting the hash information into a binary sequence and grouping the binary sequence or a specified number of binary numbers in the binary sequence in order; any binary array includes P adjacent binary numbers, and P is greater than 1; The current binary array is assigned to the current pixel as the watermark embedding mask of the current pixel; a pixel embedding rule of the current pixel is generated according to the watermark embedding mask of the current pixel; when the current pixel is not the last pixel, if it is determined based on the pixel embedding rules of the traversed pixels including the current pixel that the watermark information of the image block is less than the L, then return to the step of traversing the pixels in the image block in sequence, and if it is equal to or greater than the L, then end the current process.
5. The method according to claim 4, characterized in that Each binary bit in the watermark embedding mask assigned to any pixel has a corresponding relationship with each pixel bit in the pixel value of the pixel; the pixel value of any pixel is composed of the values on Q pixel bits; Each binary bit in the binary sequence of the watermark ciphertext has a corresponding relationship with each pixel bit in the pixel value of the pixel; The pixel embedding rule for generating the current pixel according to the watermark embedding mask of the current pixel includes: For each binary bit in the watermark embedding mask assigned to any pixel, if the value on the binary bit is a first value, it is determined that the value on the pixel bit corresponding to the binary bit in the pixel value of the pixel needs to be adjusted, and the adjusted value is the value on the binary bit corresponding to the pixel bit in the binary sequence of the watermark ciphertext; if the value on the binary bit is a second value different from the first value, it is determined that the value on the pixel bit corresponding to the binary bit in the pixel value of the pixel does not need to be adjusted.
6. The method according to claim 4, characterized in that The method further comprises: If the current pixel is the last pixel, when it is determined based on the pixel embedding rule of each pixel in the image block that the watermark information of the image block is less than the L, the hash information is adjusted according to the preset flip density requirement, and the step of assigning a corresponding watermark embedding mask to at least one pixel in the image block based on the hash information and determining the pixel embedding rule of each pixel in the image block according to the watermark embedding mask assigned to each pixel in the image block is returned; The step of adjusting the hash information according to the preset flip density includes adjusting the second value whose density in the hash information meets the preset flip density requirement, so as to adjust at least one second value whose density meets the preset flip density requirement to the first value.
7. The method according to claim 1, characterized in that The image block is also embedded with a watermark end mark; A watermark end mark is set after each watermark ciphertext in the image block, so as to trace the watermark information based on the watermark end mark.
8. An image watermark tracing method, characterized in that: The method is applied to an electronic device, comprising: Divide each single frame of the original image into blocks in which the watermark information is embedded according to any one of the methods of claims 1 to 7 to obtain N image blocks; N is greater than 1; Determine a reference embedding rule for at least one pixel in each image block according to the pixel embedding rule generation method described in any one of claims 1 to 7, so as to identify the watermark information embedded in the image block based on the reference embedding rule for at least one pixel in the image block; the reference embedding rule for any pixel is used to indicate a value in the pixel value of the pixel that is adjusted when the watermark information is embedded; For each image block, based on the reference embedding rule of each reference image block other than the image block and the shape and proportion of each reference image block, determine the confidence of the image block; the confidence of the image block is used to indicate the similarity between the watermark information identified by the image block and the watermark information actually embedded in the image block; the reference image block refers to each image block other than the image block; A target image block is determined from each image block based on the confidence level of each image block; and the watermark information in the target image block is decrypted to obtain the watermark original text.
9. The method according to claim 8, characterized in that The step of determining the confidence of each image block based on reference embedding rules of other image blocks except the image block and shapes and proportions of the other image blocks includes: For each image block, based on the watermark information embedded in the image block and the reference pixel embedding rule of each pixel in each reference image block except the image block, generate reference watermark information in each reference image block; The reference watermark information in each reference image block is displayed in the image block template and the image block template is adjusted to obtain a matching block corresponding to each reference image block; the shape and ratio of each reference image block and the matching block corresponding to the reference image block meet the similarity requirements; The confidence of the image block is determined according to the matching degree between each reference image block and the matching block corresponding to each reference image block.
10. The method according to claim 9, characterized in that Determining the confidence of the image block according to the matching degree between each reference image block and the matching block corresponding to each reference image block includes: For each reference image block, determining a matching degree between the reference image block and pixels at the same position in a matching block corresponding to the reference image block; The confidence of the image block is determined according to the matching degree between each reference image block and the pixels at the same position in the matching block corresponding to each reference image block.
11. An image watermarking system, characterized in that: The system includes: An apparatus for executing any one of the methods of claims 1 to 7, and an apparatus for executing any one of the methods of claims 8 to 10.
12. An electronic device, comprising: processor and machine-readable storage medium; The machine-readable storage medium stores machine-executable instructions that can be executed by the processor; The processor is used to execute machine executable instructions to implement the steps in any method of claims 1 to 7 or any method of claims 8 to 10.
Citation Information
Patent Citations
Watermark processing method, watermark extracting method and corresponding devices
CN105992072A
Watermark embedding method, watermark extracting method and watermark embedding device
CN111915472A