Image digital watermark processing method and device, electronic equipment and storage medium
The method disperses digital watermarks across image blocks using color space conversion, wavelet transforms, and singular value decomposition to enhance robustness and invisibility, addressing the challenges of traditional watermarking algorithms.
Patent Information
- Application Number
- CN202510393769.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-31
- Publication Date
- 2025-07-15
AI Technical Summary
Existing digital watermark algorithms are difficult to ensure the integrity and robustness of watermarks under image attacks, and are easily tampered by non-related personnel. Traditional methods will affect image quality or reduce robustness when embedding watermarks in high-frequency or low-frequency areas of the image.
The watermark information is discretely embedded in different image blocks of the image, and the watermark area detection and correction are carried out through multi-level discrete wavelet transformation, singular value decomposition and encryption processing, and the watermark area detection and correction are performed in combination with the segmentation model, the watermark information sequence is extracted and similarity matched to generate the final watermark information.
Improves the robustness and invisibility of images under various attacks, ensuring the integrity and security of watermark information.
Smart Images

Figure CN120318054A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing technologies, and in particular to a method, apparatus, electronic device, and storage medium for processing image digital watermarks. Background Art
[0002] The three properties of digital watermarks are inappreciability, capacity, and robustness. The more information (bits) is embedded in an image, the greater the impact on the image quality. Therefore, digital watermark algorithms generally need to balance between inappreciability and capacity. The following drawbacks exist in the digital watermark processing of traditional methods: Selecting the entire image for embedding makes it difficult to ensure the integrity of the watermark under image attacks (such as cropping, adding noise, compression, rotation, etc.); Selecting to embed the watermark in the high-frequency or low-frequency region of the picture. Embedding the watermark in the low-frequency region increases the robustness of the watermark but results in a decrease in image quality, while embedding in the high-frequency region leads to a reduction in robustness; Directly embedding and extracting the watermark information without being able to verify the integrity of the original information; Embedding the watermark one by one in order for each image block from top to bottom and from left to right, which easily allows unauthorized personnel to extract and tamper with the watermark information. After wavelet transformation and block division, by calculating the number of watermarks divided by the number of blocks to determine the number of watermark positions embedded in each block, it is easy to cause multiple watermark information to be embedded in one block or no watermark bits to be embedded in the subsequent blocks. During the confrontation against attacks, it is easy to lose watermark bits, resulting in poor robustness of the algorithm. Therefore, how to process image digital watermarks has become a technical problem that cannot be underestimated. Summary of the Invention
[0003] In view of this, the purpose of this application is to provide a method, apparatus, electronic device, and storage medium for processing image digital watermarks, which can discretely embed watermark information into different image blocks of an image, significantly improving the robustness of the image under various attacks. After wavelet transformation and block division of the image blocks, watermark bits are placed in each block, ensuring that the image stores watermark information multiple times, which can enhance the inappreciability and robustness of the image.
[0004] The embodiment of this application provides a method for processing image digital watermarks, and the processing method includes:
[0005] Traverse each image block in the list of center coordinates of image blocks of the original image, perform color space conversion processing on each image block, and perform multi-level discrete wavelet transform processing and frequency band block division processing on each color channel of the converted image block to determine multiple first sub-blocks to be encoded of the image block;
[0006] Perform discrete cosine transform processing, singular value decomposition processing, and encrypted digital watermark embedding processing on each of the first sub-blocks to be encoded, generate the first sub-blocks to be encoded with the watermark embedded, and recombine the multiple first sub-blocks to be encoded with the watermark embedded in each of the image blocks to generate the original image with the watermark embedded;
[0007] Based on the segmentation model, perform watermark area detection processing and correction processing on the original image with the watermark embedded, determine the corrected watermark embedded area, and perform watermark information extraction processing on each of the second sub-blocks in the corrected watermark embedded area to extract the watermark information sequence;
[0008] Perform similarity matching processing on the watermark information in the watermark information sequence to generate the final watermark information.
[0009] In a possible implementation manner, the performing multi-level discrete wavelet transform processing and band partitioning processing on each color channel of the transformed image block to determine multiple first sub-blocks to be encoded of the image block includes:
[0010] Perform the first discrete wavelet transform processing on the transformed image block to generate a first low-frequency sub-band and three high-frequency sub-bands;
[0011] Perform the second discrete wavelet transform processing on the first low-frequency sub-band to generate a second high-frequency sub-band, a third high-frequency sub-band, a fourth high-frequency sub-band, and a second low-frequency sub-band;
[0012] Perform band partitioning processing on the second high-frequency sub-band according to the preset number of sub-blocks to be encoded to generate multiple first sub-blocks to be encoded of the second high-frequency sub-band.
[0013] In a possible implementation manner, the performing discrete cosine transform processing, singular value decomposition processing, and encrypted watermark embedding processing on each of the first sub-blocks to be encoded to generate the first sub-blocks to be encoded with the watermark embedded includes:
[0014] Perform the discrete cosine transform processing on the first sub-block to be encoded to generate the transformed first sub-block to be encoded;
[0015] Perform the singular value decomposition processing on the transformed first sub-block to be encoded to determine a singular value group;
[0016] Modify the first singular value in the singular value group based on the preset embedding strength and the encrypted watermark to determine the modified singular value;
[0017] Perform inverse singular value decomposition processing and inverse discrete cosine transform processing on the modified singular value to generate the first sub-block to be encoded with the watermark embedded.
[0018] In a possible implementation, the process of recombining multiple first sub-blocks to be encoded with embedded watermarks in each of the image blocks to generate the original image with the embedded watermark includes:
[0019] Performing an inverse discrete wavelet transform on the first sub-blocks to be encoded with the embedded watermark, the three high-frequency sub-bands, the third high-frequency sub-band, the fourth high-frequency sub-band, and the second low-frequency sub-band to generate the reconstructed first sub-blocks to be encoded;
[0020] Recombining each of the reconstructed first sub-blocks to be encoded to generate the original image with the embedded watermark.
[0021] In a possible implementation, the process of performing watermark region detection and correction on the original image with the embedded watermark based on the segmentation model to determine the corrected embedded watermark region includes:
[0022] Performing watermark region detection on the original image with the embedded watermark based on the segmentation model to determine at least one watermark region mask information;
[0023] Calculating the average value of the angular deflection amount of the minimum bounding rectangle of the watermark region mask information to determine the global deflection amount of the original image with the embedded watermark;
[0024] Performing correction processing on the position information of each minimum bounding rectangle based on the global deflection amount to determine the corrected embedded watermark region.
[0025] In a possible implementation, the process of extracting watermark information from each second sub-block to be encoded in the corrected embedded watermark region to extract a watermark information sequence includes:
[0026] Performing a discrete cosine transform and a singular value decomposition on each second sub-block to be encoded in the corrected embedded watermark region to determine a singular value group;
[0027] Detecting changes in the first singular value in the singular value group based on the embedding strength to determine the watermark information of the second sub-block to be encoded;
[0028] Decrypting and rearranging the watermark information of multiple second sub-blocks to be encoded based on the key to generate the watermark information sequence.
[0029] In a possible implementation, the process of performing similarity matching on the watermark information in the watermark information sequence to generate the final watermark information includes:
[0030] Performing similarity matching on any two pieces of watermark information to determine similarity information;
[0031] If the similarity information is greater than or equal to a preset threshold, calculate the average value of the position information corresponding to the two watermark information corresponding to the similarity information to determine the fused watermark information;
[0032] If the similarity information is less than the preset threshold, no fusion processing is performed on the two watermark information corresponding to the similarity information;
[0033] Perform redundancy check processing on the fused watermark information and the watermark information to determine the final watermark information.
[0034] The embodiment of the present application also provides an image digital watermark processing device, and the processing device includes:
[0035] A conversion processing module, configured to traverse each image block in the image block center coordinate list of the original image, perform color space conversion processing on each image block, and perform multi-level discrete wavelet transform processing and frequency band partitioning processing on each color channel of the converted image block to determine multiple first sub-blocks to be encoded of the image block;
[0036] A watermark embedding module, configured to perform discrete cosine transform processing, singular value decomposition processing, and encrypted digital watermark embedding processing on each of the first sub-blocks to be encoded to generate the first sub-blocks to be encoded after watermark embedding, and perform recombination processing on the multiple first sub-blocks to be encoded after watermark embedding in each image block to generate the original image after watermark embedding;
[0037] A watermark extraction module, configured to perform watermark region detection processing and correction processing on the original image after watermark embedding based on a segmentation model to determine a corrected watermark embedding region, and perform watermark information extraction processing on each second sub-block to be encoded in the corrected watermark embedding region to extract a watermark information sequence;
[0038] A matching module, configured to perform similarity matching processing on the watermark information in the watermark information sequence to generate the final watermark information.
[0039] The embodiment of the present application also provides an electronic device, including: a processor, a memory, and a bus, where the memory stores machine-readable instructions executable by the processor. When the electronic device runs, the processor communicates with the memory through the bus. When the machine-readable instructions are executed by the processor, the steps of the above image digital watermark processing method are executed.
[0040] The embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is run by a processor, the steps of the above image digital watermark processing method are executed.
[0041] The image digital watermark processing method, device, electronic device and storage medium provided by the embodiments of the present application, the processing method includes: traversing each image block in the list of central coordinates of image blocks of the original image, performing color space conversion processing on each image block, and performing multi-level discrete wavelet transform processing and frequency band partitioning processing on each color channel of the converted image block to determine multiple first sub-blocks to be encoded of the image block; performing discrete cosine transform processing, singular value decomposition processing and encrypted digital watermark embedding processing on each of the first sub-blocks to be encoded to generate a first sub-block to be encoded after embedding the watermark, and reorganizing the multiple first sub-blocks to be encoded after embedding the watermark in each image block to generate the original image after embedding the watermark; performing watermark area detection processing and correction processing on the original image after embedding the watermark based on a segmentation model to determine a corrected watermark embedding area, and performing watermark information extraction processing on each second sub-block to be encoded in the corrected watermark embedding area to extract a watermark information sequence; performing similarity matching processing on the watermark information in the watermark information sequence to generate final watermark information. Discretely embedding watermark information into different image blocks of an image can significantly improve the robustness of the image under various attacks. After wavelet transforming the image blocks and partitioning them, watermark bits are placed in each block, ensuring that the watermark information is stored multiple times in the image, which can enhance the imperceptibility and robustness of the image.
[0042] To make the above objects, features and advantages of the present application more obvious and understandable, the following specific embodiments are given and described in detail in conjunction with the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] To more clearly illustrate the technical solutions of the embodiments of the present application, the following briefly introduces the drawings required to be used in the embodiments. It should be understood that the following drawings only show some embodiments of the present application, and therefore should not be regarded as limiting the scope. For those of ordinary skill in the art, other related drawings can be obtained based on these drawings without creative efforts.
[0044] Figure 1 It is a flowchart of a method for processing an image digital watermark provided by an embodiment of the present application;
[0045] Figure 2 It is a schematic diagram of watermark embedding provided by an embodiment of the present application;
[0046] Figure 3 It is a schematic diagram of watermark extraction provided by an embodiment of the present application;
[0047] Figure 4 It is a schematic structural diagram of an image digital watermark processing device provided by an embodiment of the present application;
[0048] Figure 5 It is a schematic structural diagram of an electronic device provided by an embodiment of the present application. Specific implementation manners
[0049] To make the objectives, technical solutions, and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. Apparently, the described embodiments are only some of the embodiments of the present application, rather than all the embodiments. Components of the embodiments of the present application generally described and illustrated in the accompanying drawings here can be arranged and designed in various different configurations. Therefore, the detailed description of the embodiments of the present application provided in the accompanying drawings is not intended to limit the scope of the present application to be protected, but merely represents selected embodiments of the present application. Based on the embodiments of the present application, every other embodiment obtained by those skilled in the art without creative efforts belongs to the scope of protection of the present application.
[0050] First, the applicable application scenarios of the present application are introduced. The present application can be applied to the field of xx image processing technology.
[0051] Through research, it is found that the three properties of digital watermark are imperceptibility, capacity, and robustness. The more information (bits) is embedded in an image, the greater the impact on the image quality. Therefore, digital watermark algorithms generally need to make a balance between imperceptibility and capacity. The following disadvantages exist in the digital watermark processing process of traditional methods: Selecting the whole image for embedding, it is difficult to ensure the integrity of the watermark under image attacks (such as cropping, adding noise, compression, rotation, etc.); Selecting to embed the watermark in the high-frequency or low-frequency area of the picture, embedding the watermark in the low-frequency area increases the robustness of the watermark but results in a decrease in image quality, while embedding in the high-frequency area leads to a decrease in robustness; Directly embedding and extracting the watermark information without being able to verify the integrity of the original information; Embedding the watermark one by one in order for each image block from top to bottom and from left to right, which is easy for unauthorized personnel to extract and tamper with the watermark information. After wavelet transform and block division, determining the number of watermark positions embedded in each block by calculating the number of watermarks divided by the number of blocks is likely to result in multiple watermark information being embedded in one block or no watermark bits being embedded in the subsequent blocks. When dealing with attacks, watermark bits are likely to be lost, making the algorithm less robust. Therefore, how to process image digital watermarks has become a technical problem that cannot be underestimated.
[0052] Based on this, the embodiments of the present application provide a method for processing image digital watermarks, which discretely embeds watermark information into different image blocks of an image, can significantly improve the robustness of the image under various attacks, divides the image blocks after wavelet transformation into blocks, and places watermark bits in each block to ensure that the watermark information is stored multiple times in the image, which can enhance the imperceptibility and robustness of the image.
[0053] Please refer to Figure 1 , Figure 1 which is a flowchart of a method for processing image digital watermarks provided by the embodiments of the present application. As Figure 1 shown in
[0054] S101: Traverse each image block in the list of center coordinates of image blocks of the original image, perform color space conversion processing on each image block, perform multi-level discrete wavelet transform processing and frequency band division processing on each color channel of the converted image block, and determine multiple first sub-blocks to be encoded of the image block.
[0055] In this step, traverse each image block in the list of center coordinates of image blocks of the original image, perform color space conversion processing on each image block, perform multi-level discrete wavelet transform processing and frequency band division processing on each color channel of the converted image block, and determine multiple first sub-blocks to be encoded of the image block.
[0056] Here, the list of center coordinates of image blocks is determined in the following way: 1. Calculate the capacity and initialization parameters: ① Determine the effective range within 25% of the area according to the size of the carrier image. ② Calculate the maximum number block_num of non-overlapping image blocks that can be accommodated in this area to prevent the image blocks from exceeding the boundary. ③ Initialize an empty list to store the effective center coordinates of the image blocks. 2. Random coordinate generation and verification: ① For each image block to be generated (a total of block_num), randomly select a center coordinate within the effective range of the image. ② Check whether the newly generated center coordinate will cause the image block to exceed the boundary or overlap with other existing image blocks. ③ If the coordinate is valid, add it to the result list; otherwise, repeat this step until a suitable coordinate is found. 3. Final verification: Confirm that all selected center coordinates are within the effective range of the image and do not overlap with each other.
[0057] Among them, for each image block, first convert the color space from RGB to YUV format for subsequent processing. To ensure that the image size is suitable for wavelet transformation, white borders need to be added around the image to make the image size even, which helps to improve the transformation efficiency and simplify the boundary condition processing.
[0058] In a possible implementation manner, performing multi-level discrete wavelet transform processing and frequency band block processing on each color channel of the converted image block to determine a plurality of first sub-blocks to be encoded of the image block, including:
[0059] A: Performing a first discrete wavelet transform processing on the converted image block to generate a first low-frequency sub-band and three high-frequency sub-bands.
[0060] Performing a first discrete wavelet transform processing on the converted image block to generate a first low-frequency sub-band (LL1) and three high-frequency sub-bands (HH1, HL1, LH1).
[0061] B: Performing a second discrete wavelet transform processing on the first low-frequency sub-band to generate a second high-frequency sub-band, a third high-frequency sub-band, a fourth high-frequency sub-band, and a second low-frequency sub-band.
[0062] Here, performing a second discrete wavelet transform processing on the first low-frequency sub-band (LL1) to generate a second high-frequency sub-band (HH2), a third high-frequency sub-band (HL2), a fourth high-frequency sub-band (LH2), and a second low-frequency sub-band (LL2).
[0063] C: Performing frequency band block processing on the second high-frequency sub-band according to the preset number of sub-blocks to be encoded to generate a plurality of first sub-blocks to be encoded of the second high-frequency sub-band.
[0064] Here, performing frequency band block processing on the second high-frequency sub-band (HH2) according to the preset number of sub-blocks to be encoded to generate a plurality of first sub-blocks to be encoded of the second high-frequency sub-band.
[0065] S102: Performing discrete cosine transform processing, singular value decomposition processing, and encrypted digital watermark embedding processing on each of the first sub-blocks to be encoded to generate a first sub-block to be encoded with an embedded watermark, and performing recombination processing on the plurality of first sub-blocks to be encoded with an embedded watermark in each image block to generate the original image with an embedded watermark.
[0066] In this step, performing discrete cosine transform processing, singular value decomposition processing, and encrypted watermark embedding processing on each of the first sub-blocks to be encoded to generate a first sub-block to be encoded with an embedded watermark, and performing recombination processing on the plurality of first sub-blocks to be encoded with an embedded watermark in each image block to generate the original image with an embedded watermark.
[0067] In a possible implementation manner, performing discrete cosine transform processing, singular value decomposition processing, and encrypted watermark embedding processing on each of the first sub-blocks to be encoded to generate a first sub-block to be encoded with an embedded watermark, including:
[0068] a: Perform the discrete cosine transform processing on the first sub-block to be encoded, and generate the transformed first sub-block to be encoded.
[0069] Here, perform the discrete cosine transform processing on the first sub-block to be encoded, and generate the transformed first sub-block to be encoded.
[0070] b: Perform the singular value decomposition processing on the transformed first sub-block to be encoded, and determine a group of singular values.
[0071] Here, perform the singular value decomposition processing on the transformed first sub-block to be encoded, and determine a group of singular values.
[0072] c: Modify the first singular value in the group of singular values based on a preset embedding strength and the encrypted watermark, and determine the modified singular value.
[0073] Here, modify the first singular value in the group of singular values according to a preset embedding strength and the encrypted watermark, and determine the modified singular value.
[0074] Wherein, one bit of watermark information to be embedded is 0 or 1.
[0075] Wherein, the watermark sequence is shuffled using a password and then embedded into the image blocks, wm_index = [0, 1, 2,..., wm_size - 1] wm_index ← shuffle(wm_index, seed = password). wm_index represents the position index of the watermark bit, and wm_size is the total length of the watermark. shuffle means to initialize the random number generator with a given seed and then shuffle the array, and passwor is the seed used to initialize the random number generator to ensure that the shuffling result is repeatable each time.
[0076] Here, the formula for embedding the watermark is: Wherein, s[0] is the first singular value after embedding the watermark information, d1 is the embedding strength, which is used to control the degree of watermark embedding, and wm is one bit of watermark information (0 or 1) to be embedded.
[0077] d: Perform the inverse singular value decomposition processing and the inverse discrete cosine transform processing on the modified singular value, and generate the first sub-block to be encoded with the watermark embedded.
[0078] Here, perform the inverse singular value decomposition processing and the inverse discrete cosine transform processing on the modified singular value, and generate the first sub-block to be encoded with the watermark embedded.
[0079] In a possible implementation manner, the recombining the multiple first sub-blocks to be encoded with the watermark embedded in each image block to generate the original image with the watermark embedded includes:
[0080] (1): Perform inverse discrete wavelet transform processing on the first sub-block to be encoded after embedding the watermark, the three high-frequency sub-bands, the third high-frequency sub-band, the fourth high-frequency sub-band, and the second low-frequency sub-band to generate the reconstructed first sub-block to be encoded.
[0081] Here, perform inverse discrete wavelet transform processing on the first sub-block to be encoded after embedding the watermark, the three high-frequency sub-bands, the third high-frequency sub-band, the fourth high-frequency sub-band, and the second low-frequency sub-band to generate the reconstructed first sub-block to be encoded.
[0082] (2): Recombine each reconstructed first sub-block to be encoded to generate the original image after embedding the watermark.
[0083] Here, recombine each reconstructed first sub-block to be encoded to generate the original image after embedding the watermark.
[0084] Among them, perform visual quality evaluation on the image block after embedding the watermark to ensure that the watermark embedding does not significantly affect the visual effect of the image. Adjust the embedding strength or other parameters if necessary. Continue to execute the above steps for the remaining image blocks until all image blocks have successfully embedded the watermark information. After all image blocks are processed, recombine them into a complete image to obtain the final original image after embedding the watermark.
[0085] In this application, 1) After performing one-level DWT decomposition on the watermark information to obtain the low-frequency domain (LL1) and the high-frequency domain (HL1, LH1, and HH1), continue to decompose the low-frequency domain (LL1) to obtain the second-level decomposition domain (LL2, HL2, LH2, and HH2). Embedding in the high-frequency domain (HH2) of the second-level decomposition can balance robustness and image quality. 2) Add a check code (8bit) to the embedded watermark to verify the integrity of the extracted watermark. 3) Shuffle the embedded block index information and use a specific seed to restore the coding sequence. Improve the security of the watermark information and prevent tampering. 4) After wavelet-transforming the image and dividing it into blocks, put 1bit of watermark bit in each block, and cyclically store each watermark bit in each block in turn, ensuring that the watermark information is stored multiple times in the image, which can enhance the imperceptibility and robustness of the image.
[0086] Further, please refer to Figure 2 , Figure 2 which is a schematic diagram of watermark embedding provided by the embodiment of the present application. As Figure 2As shown in the figure, the original image is segmented to determine a list of the central coordinates of the image blocks. Each image block is subjected to color space conversion processing from RGB to YUV. The converted image block is then subjected to discrete wavelet transform (DWT) to obtain LL1, HH1, HL1, and LH1. LL1 is subjected to DWT to obtain HH2, LL2, HL2, and LH2. HH2 is subjected to frequency band segmentation processing to obtain a plurality of first sub-blocks to be encoded. Each first sub-block to be encoded is subjected to DCT transform and SVD decomposition processing to obtain a singular value group. The first singular value is modified according to the encrypted watermark to determine the modified singular value. The modified singular value is subjected to inverse SVD transform and inverse DCT transform to generate the first sub-block to be encoded after embedding the watermark. Then, inverse DWT is performed on each first sub-block to be encoded after embedding the watermark and the corresponding LL2, HL2, LH2, HH1, HL1, and LH1 to obtain the original image after embedding the watermark.
[0087] S103: Based on the segmentation model, perform watermark region detection processing and correction processing on the original image after embedding the watermark to determine the corrected watermark embedding region, and perform watermark information extraction processing on each second sub-block to be encoded in the corrected watermark embedding region to extract the watermark information sequence.
[0088] In this step, based on the segmentation model, perform watermark region detection processing and correction processing on the original image after embedding the watermark to determine the corrected watermark embedding region, and perform watermark information extraction processing on each second sub-block to be encoded in the corrected watermark embedding region to extract the watermark information sequence.
[0089] In a possible implementation manner, the performing watermark region detection processing and correction processing on the original image after embedding the watermark based on the segmentation model to determine the corrected watermark embedding region includes:
[0090] (1): Based on the segmentation model, perform watermark region detection processing on the original image after embedding the watermark to determine at least one watermark region mask information.
[0091] Here, the original image after embedding the watermark is analyzed using a pre-trained segmentation model to identify and extract specific regions that may contain watermark information. This process will generate one or more masks, each mask corresponding to a potential watermark region. These masks together form a list of watermark regions.
[0092] Among them, in order to achieve the detection of the imperceptible watermark module, the visual difference between the embedded and unembedded regions in the watermarked image is very small. However, the correlation between adjacent pixels in the embedded region is inevitably destroyed, which can be captured by deep neural networks (DNNs). The lightweight U2-Net, which can effectively capture rich local and global information, is adopted to help segment the encoded blocks, even the encoded blocks affected by noise. The widely adopted Binary Cross-Entropy (BCE) loss function is used, and the Intersection over Union (IoU) loss is also introduced. Therefore, the overall loss function L of the segmentation model total can be expressed as:
[0093] L total = α * L BCE + γ * L IOU
[0094] where α and γ are both coefficients, and L BCE is the Binary Cross-Entropy loss value, and L IOU is the Intersection over Union loss value.
[0095] (2): Calculate the mean value of the angular deflection of the minimum bounding rectangle of the watermark region mask information to determine the global deflection of the original image after embedding the watermark.
[0096] Here, for each watermark region mask, calculate its Minimum Bounding Rectangle (MBR). This step is to accurately define the actual range of the watermark region and provide a basis for subsequent angle correction. For all the obtained minimum bounding rectangles, calculate their deflection angles relative to the horizontal axis respectively. Then, find the average value of these angles as the global deflection of the entire image. This step aims to correct the image tilt problem caused by the shooting angle or other factors, thereby improving the accuracy of watermark extraction.
[0097] (3): Based on the global deflection, correct the position information of each minimum bounding rectangle to determine the corrected embedded watermark region.
[0098] Here, use the global deflection calculated in the previous step to correct the position information of each minimum bounding rectangle to determine the corrected embedded watermark region. The purpose of this is to ensure that no additional errors are introduced due to angle differences during the watermark extraction process.
[0099] In a possible implementation manner, the process of extracting watermark information from each second sub-block to be encoded in the corrected embedded watermark region and extracting a watermark information sequence includes:
[0100] I: Perform discrete cosine transform processing and singular value decomposition processing on each of the second sub-blocks to be encoded in the corrected watermark embedding region, and determine a singular value group.
[0101] Here, perform discrete cosine transform (DCT) on each of the second sub-blocks to be encoded in the corrected watermark embedding region, and then perform singular value decomposition (SVD) to obtain a group of singular values.
[0102] u, s, v = SVD(DCT(black))
[0103] Among them, traverse the list of image block center coordinates pre-processed and stored during the watermark embedding process, and prepare to perform watermark extraction operations on each image block. For each image block, first convert the color space from RGB to YUV format. If a white border was added previously to suit wavelet transform, ensure that the current image block also has the same size for correct reverse processing. Perform two discrete wavelet transform (DWT) operations on the Y channel of each image block to separate the low-frequency sub-band LL2 and three high-frequency sub-bands HL2, LH2, and HH2. Determine whether to perform the same transformation on the U and V channels according to the actual situation. Perform block division on the HH2 sub-band to obtain the second sub-blocks to be encoded.
[0104] II: Based on the embedding strength, perform change detection on the first singular value in the singular value group, and determine the watermark information of the second sub-block to be encoded.
[0105] Here, according to the previously set embedding strength d1, check the change of the first singular value s[0], and decode a bit of watermark information wm1 from it. The formula is as follows:
[0106]
[0107] III: Based on the key, decrypt and rearrange the watermark information of multiple second sub-blocks to be encoded to generate the watermark information sequence.
[0108] Here, until the watermark information in all second sub-blocks to be encoded is successfully extracted, decrypt and rearrange the watermark information of multiple second sub-blocks to be encoded according to the key to generate the watermark information sequence.
[0109] Among them, divide an image into several discrete small image blocks, and embed the complete watermark information into each image block respectively, so that after various cropping attacks, ensure that the remaining image information contains complete image blocks, thereby ensuring the integrity of the watermark information and enhancing the robustness of the image against cropping attacks.
[0110] S104: Perform similarity matching processing on the watermark information in the watermark information sequence to generate the final watermark information.
[0111] In this step, similarity matching processing is performed on the watermark information in the watermark information sequence to generate the final watermark information.
[0112] In a possible implementation manner, the performing similarity matching processing on the watermark information in the watermark information sequence to generate the final watermark information includes:
[0113] i: Performing similarity matching processing on any two pieces of the watermark information to determine similarity information.
[0114] Here, similarity matching processing is performed on any two pieces of watermark information to determine similarity information.
[0115] ii: If the similarity information is greater than or equal to a preset threshold, then perform mean value calculation on the position information corresponding to the two pieces of watermark information corresponding to the similarity information to determine the fused watermark information; if the similarity information is less than the preset threshold, then no fusion processing is performed on the two pieces of watermark information corresponding to the similarity information.
[0116] Here, if the similarity information is greater than or equal to the preset threshold, then perform mean value calculation on the position information corresponding to the two pieces of watermark information corresponding to the similarity information to determine the fused watermark information; if the similarity information is less than the preset threshold, then no fusion processing is performed on the two pieces of watermark information corresponding to the similarity information.
[0117] Among them, if the number of different bits does not exceed a set threshold (for example, 3), then the watermark information of these two blocks is considered to have high similarity.
[0118]
[0119] Among them, diff(i, j) represents the number of different bits between two pieces of watermark information. For watermarks with high similarity, the watermarks at the corresponding positions are averaged to obtain the fused watermark information.
[0120] iii: Performing redundancy check processing on the fused watermark information and the watermark information to determine the final watermark information.
[0121] Here, CRC redundancy checks are respectively performed on the watermark information extracted from all the second sub-blocks to be encoded and the fused watermark information. Those passing the check indicate successful extraction and are used as the finally extracted watermark.
[0122] Among them, there are multiple coding blocks in one picture. After an image attack, the watermark information extracted from each block will be lost to varying degrees. By comparing the similarity of the information in each block, the information extracted from the coding blocks with high similarity is fused. Briefly speaking, the calculation process is as follows: if the watermark information extracted from two image blocks has the same positions and the number of different positions does not exceed the set 3, it is determined that the watermark similarity of the two blocks is high. Finally, the position average value is directly taken for the watermarks extracted from all blocks with high similarity to improve the accuracy of watermark extraction.
[0123] Further, please refer to Figure 3 , Figure 3 which is a schematic diagram of watermark extraction provided by the embodiment of the present application. As Figure 3 shown, the original image after embedding the watermark is subjected to watermark region detection processing and then converted to the YUV format, and a white border is added to ensure that the image size is even, which is convenient for subsequent wavelet transform. Discrete wavelet transform (DWT) is performed on each color channel to separate the low-frequency sub-band (LL1) and high-frequency sub-bands (HH1, HL1, LH1). The low-frequency sub-band (LL1) is further subjected to wavelet transform to separate out (LL2, HH2, HL2, and LH2). The high-frequency sub-band HH2 in the low-frequency sub-band LL1 is divided into blocks to form a multi-dimensional array, and discrete cosine transform (DCT) and singular value decomposition (SVD) are performed on each block, and the first singular value is modified to solve the watermark bit to complete the extraction of the digital watermark.
[0124] A method for processing an image digital watermark provided by an embodiment of the present application, the processing method includes: traversing each image block in the list of central coordinates of the image blocks of the original image, performing color space conversion processing on each image block, and performing multi-level discrete wavelet transform processing and frequency band block processing on each color channel of the converted image block to determine multiple first sub-blocks to be encoded of the image block; performing discrete cosine transform processing, singular value decomposition processing, and encrypted digital watermark embedding processing on each of the first sub-blocks to be encoded to generate a first sub-block to be encoded after embedding the watermark, and performing recombination processing on multiple first sub-blocks to be encoded after embedding the watermark in each of the image blocks to generate the original image after embedding the watermark; performing watermark region detection processing and correction processing on the original image after embedding the watermark based on a segmentation model to determine a corrected embedded watermark region, and performing watermark information extraction processing on each second sub-block to be encoded in the corrected embedded watermark region to extract a watermark information sequence; performing similarity matching processing on the watermark information in the watermark information sequence to generate a final watermark information. Discretely embedding the watermark information into different image blocks of an image can significantly improve the robustness of the image under various attacks. After wavelet transform of the image blocks and dividing them into blocks, watermark bits are placed in each block, ensuring that multiple watermark information is stored in the image, which can enhance the imperceptibility and robustness of the image.
[0125] Please refer to Figure 4 , Figure 4 , which is a schematic structural diagram of a processing device for image digital watermark provided by an embodiment of the present application. As Figure 4 shown in
[0126] The conversion processing module 410 is configured to traverse each image block in the list of center coordinates of image blocks of the original image, perform color space conversion processing on each image block, and perform multi-level discrete wavelet transform processing and frequency band partitioning processing on each color channel of the converted image block to determine multiple first sub-blocks to be encoded of the image block;
[0127] The watermark embedding module 420 is configured to perform discrete cosine transform processing, singular value decomposition processing, and encrypted digital watermark embedding processing on each of the first sub-blocks to be encoded, generate the first sub-blocks to be encoded after watermark embedding, and perform recombination processing on multiple first sub-blocks to be encoded after watermark embedding in each image block to generate the original image after watermark embedding;
[0128] The watermark extraction module 430 is configured to perform watermark region detection processing and correction processing on the original image after watermark embedding based on a segmentation model to determine a corrected watermark embedding region, and perform watermark information extraction processing on each second sub-block to be encoded in the corrected watermark embedding region to extract a watermark information sequence;
[0129] The matching module 440 is configured to perform similarity matching processing on the watermark information in the watermark information sequence to generate final watermark information.
[0130] Further, when the conversion processing module 410 is used to perform multi-level discrete wavelet transform processing and frequency band partitioning processing on each color channel of the converted image block to determine multiple first sub-blocks to be encoded of the image block, the conversion processing module 410 is specifically configured to:
[0131] Perform the first discrete wavelet transform processing on the converted image block to generate a first low-frequency sub-band and three high-frequency sub-bands;
[0132] Perform the second discrete wavelet transform processing on the first low-frequency sub-band to generate a second high-frequency sub-band, a third high-frequency sub-band, a fourth high-frequency sub-band, and a second low-frequency sub-band;
[0133] Perform frequency band partitioning processing on the second high-frequency sub-band according to the preset number of sub-blocks to be encoded to generate multiple first sub-blocks to be encoded of the second high-frequency sub-band.
[0134] Further, when the watermark embedding module 420 is used to perform discrete cosine transform processing, singular value decomposition processing, and encrypted watermark embedding processing on each of the first sub-blocks to be encoded, and generate the first sub-block to be encoded with the watermark embedded, the watermark embedding module 420 is specifically configured to:
[0135] Perform the discrete cosine transform processing on the first sub-block to be encoded, and generate the transformed first sub-block to be encoded;
[0136] Perform the singular value decomposition processing on the transformed first sub-block to be encoded, and determine a singular value group;
[0137] Modify the first singular value in the singular value group based on a preset embedding strength and the encrypted watermark, and determine the modified singular value;
[0138] Perform inverse singular value decomposition processing and inverse discrete cosine transform processing on the modified singular value, and generate the first sub-block to be encoded with the watermark embedded.
[0139] Further, when the watermark embedding module 420 is used to perform recombination processing on multiple first sub-blocks to be encoded with the watermark embedded in each of the image blocks, and generate the original image with the watermark embedded, the watermark embedding module 420 is specifically configured to:
[0140] Perform inverse discrete wavelet transform processing on the first sub-block to be encoded with the watermark embedded and the three high-frequency sub-bands, the third high-frequency sub-band, the fourth high-frequency sub-band, and the second low-frequency sub-band, and generate the reconstructed first sub-block to be encoded;
[0141] Perform recombination processing on each of the reconstructed first sub-blocks to be encoded, and generate the original image with the watermark embedded.
[0142] Further, when the watermark extraction module 430 is used to perform watermark region detection processing and correction processing on the original image with the watermark embedded based on the segmentation model, and determine the corrected watermark embedding region, the watermark extraction module 430 is specifically configured to:
[0143] Perform watermark region detection processing on the original image with the watermark embedded based on the segmentation model, and determine at least one watermark region mask information;
[0144] Calculate the average value of the angular deflection amount of the minimum circumscribed rectangle of the watermark region mask information, and determine the global deflection amount of the original image with the watermark embedded;
[0145] Perform correction processing on the position information of each minimum circumscribed rectangle based on the global deflection amount, and determine the corrected watermark embedding region.
[0146] Further, when the watermark extraction module 430 is used to perform watermark information extraction processing on each second sub-block to be encoded in the corrected watermark embedding region and extract a watermark information sequence, the watermark extraction module 430 is specifically configured to:
[0147] Perform discrete cosine transform processing and singular value decomposition processing on each of the second sub-blocks to be encoded in the corrected watermark embedding region to determine a singular value group;
[0148] Based on the embedding strength, perform change detection on the first singular value in the singular value group to determine the watermark information of the second sub-block to be encoded;
[0149] Based on the key, decrypt and rearrange the watermark information of multiple second sub-blocks to be encoded to generate the watermark information sequence.
[0150] Further, when the matching module 440 is used to perform similarity matching processing on the watermark information in the watermark information sequence to generate final watermark information, the matching module 440 is specifically configured to:
[0151] Perform similarity matching processing on any two pieces of watermark information to determine similarity information;
[0152] If the similarity information is greater than or equal to a preset threshold, calculate the mean value of the position information corresponding to the two pieces of watermark information corresponding to the similarity information to determine the fused watermark information;
[0153] If the similarity information is less than the preset threshold, no fusion processing is performed on the two pieces of watermark information corresponding to the similarity information;
[0154] Perform redundancy check processing on the fused watermark information and the watermark information to determine the final watermark information.
[0155] A processing device for image digital watermark provided by an embodiment of the present application. The processing device includes: a conversion processing module, configured to traverse each image block in the image block center coordinate list of the original image, perform color space conversion processing on each image block, and perform multi-level discrete wavelet transform processing and frequency band segmentation processing on each color channel of the converted image block to determine a plurality of first sub-blocks to be encoded of the image block; a watermark embedding module, configured to perform discrete cosine transform processing, singular value decomposition processing, and encrypted digital watermark embedding processing on each of the first sub-blocks to be encoded to generate a first sub-block to be encoded after watermark embedding, and perform recombination processing on the plurality of first sub-blocks to be encoded after watermark embedding in each image block to generate the original image after watermark embedding; a watermark extraction module, configured to perform watermark region detection processing and correction processing on the original image after watermark embedding based on a segmentation model to determine a corrected watermark embedding region, and perform watermark information extraction processing on each second sub-block to be encoded in the corrected watermark embedding region to extract a watermark information sequence; a matching module, configured to perform similarity matching processing on the watermark information in the watermark information sequence to generate a final watermark information. Discretely embedding watermark information into different image blocks of an image can significantly improve the robustness of the image under various attacks. After wavelet transform of the image blocks and segmentation, watermark bits are placed in each block, ensuring that watermark information is stored multiple times in the image, which can enhance the imperceptibility and robustness of the image.
[0156] Please refer to Figure 5 , Figure 5 which is a schematic structural diagram of an electronic device provided by an embodiment of the present application. As Figure 5 shown in
[0157] The memory 520 stores machine-readable instructions executable by the processor 510. When the electronic device 500 runs, the processor 510 communicates with the memory 520 through the bus 530. When the machine-readable instructions are executed by the processor 510, the steps of the method for processing image digital watermark in the method embodiment as shown in Figure 1 above can be executed. The specific implementation manner can be referred to the method embodiment and will not be elaborated here.
[0158] An embodiment of the present application further provides a computer-readable storage medium. A computer program is stored on the computer-readable storage medium. When the computer program is run by a processor, the steps of the method for processing image digital watermark in the method embodiment as shown in Figure 1 above can be executed. The specific implementation manner can be referred to the method embodiment and will not be elaborated here.
[0159] Those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working processes of the systems, devices, and units described above can refer to the corresponding processes in the foregoing method embodiments and will not be elaborated herein.
[0160] In several embodiments provided in the present application, it should be understood that the disclosed systems, devices, and methods can be implemented in other ways. The device embodiments described above are merely illustrative. For example, the division of the units is only a logical function division, and there can be other division methods in actual implementation. For another example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed couplings or direct couplings or communication connections to each other can be through some communication interfaces. The indirect couplings or communication connections of the devices or units can be in electrical, mechanical, or other forms.
[0161] The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they can be located in one place or distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0162] In addition, in each embodiment of the present application, the functional units can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit.
[0163] If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a non-volatile computer-readable storage medium executable by a processor. Based on this understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art or part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in each embodiment of the present application. The foregoing storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memories (ROMs), random access memories (RAMs), magnetic disks, or optical discs that can store program codes.
[0164] Finally, it should be noted that the above-described embodiments are only specific embodiments of the present application, which are used to illustrate the technical solutions of the present application, rather than limiting them. The protection scope of the present application is not limited thereto. Although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that any person skilled in the technical field of the present application can still modify the technical solutions described in the foregoing embodiments or easily conceive of changes, or perform equivalent replacements on some of the technical features; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be covered by the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.
Claims
1. A method for processing digital watermark of an image, characterized in that, The processing method includes: Traverse each image patch in the list of center coordinates of image patches of the original image, perform color space conversion processing on each image patch, and perform multi-level discrete wavelet transform processing and frequency band partitioning processing on each color channel of the converted image patch to determine multiple first sub-blocks to be encoded of the image patch; Perform discrete cosine transform processing, singular value decomposition processing, and encrypted digital watermark embedding processing on each of the first sub-blocks to be encoded to generate the first sub-blocks to be encoded after watermark embedding. Recombine the multiple first sub-blocks to be encoded after watermark embedding in each image patch to generate the original image after watermark embedding; Based on the segmentation model, perform watermark area detection processing and correction processing on the original image after watermark embedding to determine the corrected watermark embedding area, and perform watermark information extraction processing on each second sub-block to be encoded in the corrected watermark embedding area to extract the watermark information sequence; Perform similarity matching processing on the watermark information in the watermark information sequence to generate the final watermark information.
2. The processing method according to claim 1, wherein The multi-level discrete wavelet transform processing and frequency band partitioning processing on each color channel of the converted image patch to determine multiple first sub-blocks to be encoded of the image patch includes: Perform the first discrete wavelet transform processing on the converted image patch to generate a first low-frequency sub-band and three high-frequency sub-bands; Perform the second discrete wavelet transform processing on the first low-frequency sub-band to generate a second high-frequency sub-band, a third high-frequency sub-band, a fourth high-frequency sub-band, and a second low-frequency sub-band; Perform frequency band partitioning processing on the second high-frequency sub-band according to the preset number of sub-blocks to be encoded to generate multiple first sub-blocks to be encoded of the second high-frequency sub-band.
3. The processing method according to claim 1, characterized in that The discrete cosine transform processing, singular value decomposition processing, and encrypted watermark embedding processing on each of the first sub-blocks to be encoded to generate the first sub-blocks to be encoded after watermark embedding includes: Perform the discrete cosine transform processing on the first sub-block to be encoded to generate the first sub-block to be encoded after transformation; Perform the singular value decomposition processing on the first sub-block to be encoded after transformation to determine the singular value group; Modify the first singular value in the singular value group based on the preset embedding strength and the encrypted watermark to determine the modified singular value; Perform inverse singular value decomposition processing and inverse discrete cosine transform processing on the modified singular value to generate the first sub-block to be encoded after watermark embedding.
4. The processing method according to claim 2, characterized in that, The recombination processing of the multiple first sub-blocks to be encoded after watermark embedding in each image patch to generate the original image after watermark embedding includes: Perform inverse discrete wavelet transform processing on the first sub-block to be encoded after watermark embedding, the three high-frequency sub-bands, the third high-frequency sub-band, the fourth high-frequency sub-band, and the second low-frequency sub-band to generate the first sub-block to be encoded after reconstruction; Recombine each first sub-block to be encoded after reconstruction to generate the original image after watermark embedding.
5. The processing method according to claim 1, characterized in that, Performing watermark region detection processing and correction processing on the original image after embedding the watermark based on the segmentation model to determine the corrected watermark embedding region, including: Performing watermark region detection processing on the original image after embedding the watermark based on the segmentation model to determine at least one watermark region mask information; Calculating the mean value of the angular deflection amount of the minimum circumscribed rectangle of the watermark region mask information to determine the global deflection amount of the original image after embedding the watermark; Performing correction processing on the position information of each minimum circumscribed rectangle based on the global deflection amount to determine the corrected watermark embedding region.
6. The processing method according to claim 1, wherein Performing watermark information extraction processing on each second sub-block to be encoded in the corrected watermark embedding region to extract the watermark information sequence, including: Performing discrete cosine transform processing and singular value decomposition processing on each second sub-block to be encoded in the corrected watermark embedding region to determine the singular value group; Performing change detection on the first singular value in the singular value group based on the embedding strength to determine the watermark information of the second sub-block to be encoded; Decrypting and rearranging the watermark information of multiple second sub-blocks to be encoded based on the key to generate the watermark information sequence.
7. The processing method according to claim 1, characterized in that, Performing similarity matching processing on the watermark information in the watermark information sequence to generate the final watermark information, including: Performing similarity matching processing on any two pieces of watermark information to determine the similarity information; If the similarity information is greater than or equal to the preset threshold, calculating the mean value of the position information corresponding to the two pieces of watermark information corresponding to the similarity information to determine the fused watermark information; If the similarity information is less than the preset threshold, no fusion processing is performed on the two pieces of watermark information corresponding to the similarity information; Performing redundancy check processing on the fused watermark information and the watermark information to determine the final watermark information.
8. An image digital watermark processing device, characterized in that, The processing device includes: A conversion processing module, configured to traverse each image block in the list of image block center coordinates of the original image, perform color space conversion processing on each image block, and perform multi-level discrete wavelet transform processing and frequency band block processing on each color channel of the converted image block to determine multiple first sub-blocks to be encoded of the image block; A watermark embedding module, configured to perform discrete cosine transform processing, singular value decomposition processing, and encrypted digital watermark embedding processing on each first sub-block to be encoded to generate a first sub-block to be encoded after embedding the watermark, and perform recombination processing on multiple first sub-blocks to be encoded after embedding the watermark in each image block to generate the original image after embedding the watermark; A watermark extraction module, configured to perform watermark region detection processing and correction processing on the original image after embedding the watermark based on the segmentation model to determine the corrected watermark embedding region, and perform watermark information extraction processing on each second sub-block to be encoded in the corrected watermark embedding region to extract the watermark information sequence; A matching module, configured to perform similarity matching processing on the watermark information in the watermark information sequence to generate the final watermark information.
9. An electronic device, characterized in that, Including: A processor, a memory, and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor communicates with the memory through the bus, and when the machine-readable instructions are run by the processor, the steps of the image digital watermark processing method according to any one of claims 1 to 7 are executed.
10. A computer-readable storage medium, characterized in that, A computer program is stored on the computer-readable storage medium, and when the computer program is run by a processor, the steps of the image digital watermark processing method according to any one of claims 1 to 7 are executed.