Watermark processing method, device and equipment
By segmenting and transforming the image, the watermark information is encrypted and embedded in the coefficient matrix, solving the problem of watermarks being easily cracked and improving the watermark's anti-tampering and anti-interference capabilities.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- CHINA MOBILE ZIJIN INNOVATION INST CO LTD
- Filing Date
- 2025-12-30
- Publication Date
- 2026-04-10
AI Technical Summary
In existing technologies, watermarks are easily damaged, modified, or deleted by malicious attackers, and the risk of being cracked increases with the improvement of attack methods.
By segmenting and transforming the image to be processed, the positions of the embedding coefficients are determined. The watermark information is encrypted and split before being embedded in the coefficient matrix. The watermark image is generated by combining discrete wavelet transform, chaotic mapping transform algorithm and inverse transform processing.
It enhances the watermark's anti-tampering and anti-interference capabilities, strengthens its security and confidentiality, and effectively resists routine operations and attacks.
Smart Images

Figure CN121837005A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data watermarking technology, and in particular to a watermarking processing method, apparatus and equipment. Background Technology
[0002] In today's digital age, intellectual property protection is receiving widespread attention. Data watermarking technology, as a commonly used protection method, can identify and protect intellectual property rights and track piracy by embedding specific watermark information. However, it has significant limitations: watermarks are easily damaged, modified, or deleted by malicious attackers, and the risk of being cracked increases with the improvement of attack methods. Summary of the Invention
[0003] This application provides a watermark processing method, apparatus, and device to solve the problem that watermarks are easily cracked in related technologies.
[0004] In a first aspect, embodiments of this application provide a watermarking method, including: Obtain the image to be processed and the first watermark information; The image to be processed is divided into blocks to obtain N first image blocks, and a first transformation process is performed on each first image block to determine the position of the embedding coefficients in each first image block, where N is a positive integer; The first watermark information is encrypted using a key to obtain the encrypted first watermark information. The encrypted first watermark information is split into T parts and embedded into the embedding coefficient positions in each of the first image blocks to obtain an N*T coefficient matrix, where T is a positive integer. The N*T coefficient matrix is subjected to the inverse transformation corresponding to the first transformation process to obtain N second image blocks; The N second image blocks are merged to obtain the watermark image corresponding to the image to be processed.
[0005] Optionally, the step of performing a first transformation process on each of the first image blocks to determine the position of the embedding coefficients in each of the first image blocks includes: Based on the multi-level discrete wavelet transform of low-frequency subband iterative decomposition, each first image block is decomposed multiple times to obtain M low-frequency subband coefficient matrices corresponding to the first image block, where M is a positive integer. Based on the discrete cosine transform, the M low-frequency sub-band coefficient matrices are transformed to obtain the M first coefficient matrices corresponding to the M low-frequency sub-band coefficient matrices. Based on the chaotic mapping transformation algorithm, the row and column positions of each of the first coefficient matrices are scrambled to obtain M second coefficient matrices; The high-frequency coefficient region in the second coefficient matrix is determined as the embedding coefficient position of the first image block.
[0006] Optionally, the step of splitting the encrypted first watermark information into T embedding coefficient positions in each of the first image blocks to obtain an N*T coefficient matrix includes: The encrypted first watermark information is split into T strings; Convert each character in each of the aforementioned strings into its corresponding seven-bit binary ASCII code; Based on the character order in the watermark information, each ASCII code is concatenated according to the character order to obtain the corresponding binary string; Convert the binary string to decimal representation to obtain the decimal number corresponding to the binary string; The decimal number is used as the offset of the embedding coefficient position. The embedding coefficient position of the first image block is offset according to the offset to obtain the target embedding coefficient position. The watermark information is embedded into the target embedding coefficient position of each of the first image blocks to obtain N*T coefficient matrices.
[0007] Optionally, the method further includes: Obtain the download request of the first target user, and obtain the second watermark information based on the download request; The second watermark information is encrypted, and the encrypted second watermark information is embedded into the watermark image to obtain the target watermark image and the encrypted second watermark information; The target watermark image is sent to the first target user.
[0008] Optionally, the method further includes: Based on the encrypted first watermark information and the encrypted second watermark information, the first serial watermark information is obtained; The first hash value is obtained by calculating the first concatenated watermark information using a hash function; The first hash value is stored as the first watermark file code.
[0009] Optionally, the method further includes: Obtain the download request from the second target user, and obtain the third watermark information based on the download request; The third watermark information is encrypted to obtain encrypted third watermark information; Based on the first serial watermark information and the encrypted third watermark information, the second serial watermark information is obtained; The second hash value is obtained by calculating the second concatenated watermark information using a hash function. The second hash value is used as the second watermark file code, and the first watermark file code is replaced with the second watermark file code, and the second watermark file code is stored.
[0010] Optionally, the method further includes: Obtain an extraction request from a third target user, and obtain the permission information of the third target user based on the extraction request; Based on the permission information, determine whether the third target user has the necessary operating permissions; When the third target user has operation permissions, the watermark image is subjected to an inverse transformation process corresponding to the first transformation process to obtain the encrypted first watermark information in the watermark image. The encrypted first watermark information is decrypted to obtain the first watermark information, and then the first watermark information is sent to the third target user.
[0011] Secondly, embodiments of this application provide a watermark processing apparatus, including: The first acquisition module is used to acquire the image to be processed and the first watermark information; The first processing module is used to divide the image to be processed into N first image blocks, and to perform a first transformation process on each first image block to determine the position of the embedding coefficients in each first image block, where N is a positive integer; The second processing module is used to encrypt the first watermark information using a key to obtain the encrypted first watermark information. The third processing module is used to split the encrypted first watermark information into T embedding coefficient positions embedded in each of the first image blocks to obtain an N*T coefficient matrix, where T is a positive integer. The fourth processing module is used to perform the inverse transformation of the first transformation on the N*T coefficient matrix to obtain N second image blocks; The fifth processing module is used to merge the N second image blocks to obtain the watermark image corresponding to the image to be processed.
[0012] Thirdly, embodiments of this application provide an electronic device, including a processor, a memory, and a program or instructions stored in the memory and executable on the processor, wherein the program or instructions, when executed by the processor, implement the steps in the watermarking method described in the first aspect.
[0013] Fourthly, embodiments of this application provide a computer-readable storage medium storing a program or instructions that, when executed by a processor, implement the steps in the watermarking method described in the first aspect.
[0014] Fifthly, embodiments of this application provide a computer program product, including computer instructions, which, when executed by a processor, implement the steps in the watermarking method as described in the first aspect.
[0015] In this invention, after acquiring the image to be processed and the first watermark information, the image to be processed is divided into blocks to obtain N first image blocks. A first transformation is performed on each first image block to determine the embedding coefficient positions, where N is a positive integer. The first watermark information is then encrypted using a key to obtain encrypted first watermark information. The encrypted first watermark information is then split into T parts and embedded into the embedding coefficient positions in each first image block, resulting in an N*T coefficient matrix, where T is a positive integer. The N*T coefficient matrix is then subjected to an inverse transformation corresponding to the first transformation to obtain N second image blocks. Finally, the N second image blocks are merged to obtain the watermark image corresponding to the image to be processed. Thus, by dividing the image into blocks and transforming it into a coefficient matrix, simultaneously encrypting and splitting the watermark information, embedding it into the corresponding positions in the coefficient matrix, and then inversely transforming it back into an image, the anti-tampering and anti-interference capabilities of the watermark can be improved. Attached Figure Description
[0016] To more clearly illustrate the technical solutions of the embodiments of this application, the drawings used in the description of the embodiments of this application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0017] Figure 1 A flowchart of a watermarking method provided in this application embodiment; Figure 2 This is a flowchart of another watermarking method provided in the embodiments of this application; Figure 3 This is a flowchart of another watermarking method provided in the embodiments of this application; Figure 4 This is a flowchart of another watermarking method provided in the embodiments of this application; Figure 5 This is a block diagram of a watermarking method provided in an embodiment of this application; Figure 6 This is a schematic diagram of a blockchain-based distributed storage system applicable to embodiments of this application; Figure 7 This is a structural diagram of a watermark processing device provided in an embodiment of this application; Figure 8This is a structural diagram of an electronic device provided in an embodiment of this application. Detailed Implementation
[0018] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this application. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this invention.
[0019] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and are not used to describe a specific order or sequence. It should be understood that such terms can be used interchangeably where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first" and "second" are generally of the same class, and the number of objects is not limited; for example, the first object can be one or more.
[0020] In this application embodiment, a watermark processing method, apparatus and device are proposed to solve the problem that watermarks are easily cracked in related technologies.
[0021] See Figure 1 , Figure 1 This is a flowchart of a watermarking method provided in an embodiment of this application, such as... Figure 1 As shown, the method includes the following steps: Step 101: Obtain the image to be processed and the first watermark information.
[0022] This application embodiment can process files in both document and image formats. If it is a document, it is first converted into an image format, and then a single page from the document is converted into an image. If it is an image format, it can be processed directly.
[0023] See Figure 2 , Figure 2 This application provides a watermarking process for a blockchain public service platform. When a resource on the blockchain is downloaded and viewed, a new record can be added to the chain. The record includes operator information, operation time, and storage resource information, including file name and upload time. The watermark information is determined by the record content.
[0024] Step 102: Divide the image to be processed into N first image blocks, and perform a first transformation process on each first image block to determine the position of the embedding coefficients in each first image block, where N is a positive integer.
[0025] In this embodiment, the size of the image to be processed and the length of the watermark information are considered together to determine the size of the image blocks into which the image to be processed is divided, and a suitable transformation processing embedding algorithm is selected to improve the watermark embedding effect while improving the computational efficiency, and enhance the ability of the watermark file to maintain the correctness of the watermark after regular file operations or attacks.
[0026] In some implementations, the image Divide evenly into multiple A pixel-based image patch, i.e., a two-dimensional image. The size of the image patch is not fixed; its length and width vary. Based on watermark length and image The size is determined dynamically; a suitable function is defined. The size of the divided image blocks can be determined using the following formula: .in, Indicates to Perform a floor operation. Indicates the current image The smallest block size into which it can be divided. This indicates the maximum block size that the image block size cannot exceed. Indicates the length of the watermark. Representing an image Size. The smallest block size can be set to 8x8 pixels, i.e. The largest block size Images can be considered comprehensively. size and Watermark length Considering factors such as robustness requirements, a comprehensive formula can be expressed as follows: ;in, , , For three different constants, It is typically set to a value between 8 and 16 to control the number of image segments. and Ensure that the block size does not exceed a certain proportion of the image size; Used to control watermark length Relationship with block size Ensure that the block size is proportional to the watermark length; longer watermarks require larger blocks to embed. Used to balance the relationship between image size and watermark length. Ensure a balance is found between image size and watermark length; at the same time, boundary cases need to be considered, and a minimum limit should be set. If the maximum block size is calculated Less than Then take directly Understandably, , , Adjustments need to be made based on the specific application in practice, such as verifying the selected maximum block size through testing. Whether it is appropriate, especially when the image size and watermark length are different, can be determined by adjusting the constant value to achieve the best effect.
[0027] Optionally, the step of performing a first transformation process on each of the first image blocks to determine the position of the embedding coefficients in each of the first image blocks includes: Based on the multi-level discrete wavelet transform of low-frequency subband iterative decomposition, each first image block is decomposed multiple times to obtain M low-frequency subband coefficient matrices corresponding to the first image block, where M is a positive integer. Based on the discrete cosine transform, the M low-frequency sub-band coefficient matrices are transformed to obtain the M first coefficient matrices corresponding to the M low-frequency sub-band coefficient matrices. Based on the chaotic mapping transformation algorithm, the row and column positions of each of the first coefficient matrices are scrambled to obtain M second coefficient matrices; The high-frequency coefficient region in the second coefficient matrix is determined as the embedding coefficient position of the first image block.
[0028] As an alternative implementation, a combination of improved Discrete Cosine Transform (DCT) and Discrete Wavelet Transform (DWT) algorithms can be used to embed digital watermarks in documents. First, the DWT algorithm is improved by performing multi-level decomposition on the two-dimensional image P, followed by DCT transformation. This allows for embedding watermarks with greater capacity in finer-grained frequency components. Compared to embedding watermarks directly in the time or spatial domain, embedding watermarks using the frequency or transform domain method offers better robustness. Then, the invertible Arnold map (a two-dimensional piecewise linear chaotic map) transformation algorithm is used to further shuffle the coefficient matrix, thereby hiding the watermark embedding location and further improving the watermark's robustness. This enhances the watermark file's ability to maintain watermark accuracy under normal operation and after attacks. Finally, embedding the watermark at high-frequency coefficient positions in the coefficient matrix achieves the effect of maintaining watermark transparency while minimizing the impact on image quality. After embedding the watermark, the overall appearance of the image, such as contours, texture, and color, is not significantly altered.
[0029] In some optional implementations, the multi-level discrete wavelet transform based on low-frequency subband iterative decomposition can be applied to a two-dimensional image. DWT decomposition is performed using Haar wavelet transform. For two-dimensional images... This requires applying a one-dimensional Haar wavelet transform along the row direction first, and then along the column direction. Therefore, it's necessary to first define the Haar wavelet transform method for the one-dimensional signal, including convolution operations with low-pass and high-pass filters. ,Right now For two-dimensional images First, apply a one-dimensional Haar wavelet transform along the row direction to obtain the low-frequency component. High frequency section For each row ( (This is a row index), we have: , ,in, Representative image exist OK The pixel values of the image patch in the column. Low-frequency portion. By applying a low-pass filter This captures the average or trend information within a row by taking two adjacent pixel values each time and calculating their weighted average. For example, Depend on and The weighted average value is used for calculation. (High-frequency component) By applying a high-pass filter This captures changes or details within the row, similarly by taking two adjacent pixel values each time and calculating a weighted average of their differences, for example... Depend on and The weighted average of the differences is calculated. Next, [the following is done / does not occur]. and Apply the one-dimensional Haar wavelet transform again along the column direction: Obtained by applying one-dimensional Haar wavelet transform and For each column ( (This is a column index), we have: , ,right Obtained by applying one-dimensional Haar wavelet transform and For each column ( (This is a column index), we have: , Ultimately, through the image A single DWT decomposition can yield the low-frequency subband. High-frequency subband High-frequency subband High-frequency subband There are four sub-bands in total.
[0030] It is understandable that when the image size is large, multi-layer DWT decomposition can be performed to obtain more sub-bands. In this embodiment, low-frequency sub-bands are selected. Continuing with the DWT decomposition transformation, watermarks can be embedded in more fine-grained frequency components. The low-frequency sub-bands contain a larger amount of information, allowing for the embedding of more watermarks. Furthermore, since the low-frequency sub-bands contain key image structural information, the watermarks are less susceptible to the effects of common image processing operations such as compression and filtering. Let the DWT decomposition level be... The low-frequency subband obtained by one layer of DWT decomposition is ,right Continue The four subbands obtained after layer DWT decomposition are as follows: Low-frequency subband is easily obtained. Size is In the end, a total of Low-frequency subband .in, The maximum number of decomposition levels can be determined using the following formula: ,in, , and The meaning is the same as before, rounding down to ensure that after... Subband after layer decomposition size At least for Minimum number of layers Then it must satisfy Where S represents the total number of coefficient positions used to embed the watermark. This indicates the watermark information. The percentage of special numbers, This indicates the number of watermark bits that can be embedded at each coefficient position. It can be preset. The calculation method for the total number S of coefficient positions is as follows: the low-frequency sub-band obtained after one layer of DWT decomposition. The corresponding coefficient matrix Total Each coefficient position is used to embed the watermark, therefore, the coefficient matrix corresponding to each layer of DWT decomposition is... there will be , Each coefficient position is used to embed the watermark, after... After layer DWT decomposition, there are a total of Each coefficient position is used to embed the watermark; if the minimum number of layers is calculated... Then the decomposition level is directly taken as the maximum decomposition level. .
[0031] In some optional implementations, the transformation of the low-frequency subband coefficient matrix based on discrete cosine transform can be performed on the matrix obtained by the DWT transformation described above. The calculation formula for a low-frequency subband using Discrete Cosine Transform (DCT) can be expressed as follows: ,in, , It is a low-frequency subband The pixel side length. Calculate them separately. The value is Different combinations The value is used to obtain the low-frequency subband. The corresponding DCT coefficient matrix , can be represented as .
[0032] In some optional implementations, the scrambling of the row and column positions of each of the first coefficient matrices based on the chaotic mapping transformation algorithm can be a combination of the positions obtained by the above method. DCT coefficient matrix The invertible Arnold transform algorithm is applied to shuffle the coefficient matrix. The Arnold transform formula is defined for the coefficient matrix... For each coefficient position in the matrix The new position is obtained by applying the Arnold transform. The formula is: ,in To ensure that this Arnold transform is reversible, the parameters... A pseudo-random number generator can be used; a linear congruential generator is introduced, with the following formula: , The value is set by the system, where It is the modulus, usually chosen as a large integer. It is a multiplication factor, and you can choose a large prime number. It's an increment; select one less than... A non-negative integer; initialize the seed value. That is, the coefficient matrix The width and height are calculated according to the generator formula. The values are respectively used as parameters The value, The value is determined by The calculation is obtained. (Regarding the coefficient matrix) Applying the Arnold transformation formula above to each coefficient position yields a new coefficient matrix. Understandably, the coefficient used to embed the watermark is still located at this point. indivual.
[0033] Step 103: Encrypt the first watermark information using a key to obtain the encrypted first watermark information.
[0034] Since the watermark information includes user-related personal information, in this embodiment of the application, the relevant information is combined and then encrypted to generate the final watermark content, so that personal privacy information is not leaked and the effect of protecting user privacy is achieved.
[0035] Specifically, users upload the original file to which they want to embed a watermark to the blockchain public service platform. The platform then uses a smart contract to encrypt and generate the watermark content based on the watermark information. The watermark generation can employ the RSA asymmetric encryption algorithm. The formula is as follows: ,in These are connector symbols used to combine text information. For file name, The username for uploading files. For user identity information such as ID card number, The time when the user uploaded the file, In this scenario, the action performed on the user is called "embedding a watermark". The watermark content is encrypted using a private key and then embedded in a file. Simultaneously, the decrypted public key is stored on a blockchain public service platform for later watermark extraction.
[0036] Step 104: Divide the encrypted first watermark information into T parts and embed them into the embedding coefficient positions of each first image block to obtain an N*T coefficient matrix, where T is a positive integer.
[0037] In this embodiment, embedding the encrypted watermark information into the image further enhances the security and confidentiality of the watermark and strengthens its resistance to attacks. Even if some watermark information is damaged, there is still a chance to fully recover the watermark information. Specifically, assuming the watermark information is a string... This means splitting the string into its constituent parts in order. A portion, denoted as a string. Understandably, to ensure that the watermark is fully embedded, the size of T needs to be determined based on the total number of coefficient positions S, with a preset... Therefore, there may be empty positions. Consider selecting appropriate coefficient positions and embedding strengths, and embedding them sequentially into the coefficient matrix. to common In the position of each coefficient, that is, position Transition to after embedding And so on. .
[0038] Optionally, step 104 includes: The encrypted first watermark information is split into T strings; Convert each character in each of the aforementioned strings into its corresponding seven-bit binary ASCII code; Based on the character order in the watermark information, each ASCII code is concatenated according to the character order to obtain the corresponding binary string; Convert the binary string to decimal representation to obtain the decimal number corresponding to the binary string; The decimal number is used as the offset of the embedding coefficient position. The embedding coefficient position of the first image block is offset according to the offset to obtain the target embedding coefficient position. The watermark information is embedded into the target embedding coefficient position of each of the first image blocks to obtain N*T coefficient matrices.
[0039] As an optional implementation, before embedding the watermark, the offset can be calculated using the watermark embedding position offset algorithm provided in this application embodiment, and then the watermark content can be embedded into the file according to the offset. Based on the binary ASCII values represented by the characters in the watermark information, the watermark character content is converted into decimal values, and these decimal values are used as the offset of the embedding position. This balances the robustness and transparency of the watermark, and allows subsequent watermark extraction to quickly restore the encrypted watermark information by calculating the offset, i.e., the difference before and after the offset processing of the corresponding position in the coefficient matrix, using the relationship between decimal and binary numbers, and binary and ASCII codes, without the need for a more complex offset rollback operation. The watermark information can then be directly obtained through decryption.
[0040] Specifically, the string W is split into the following parts in sequence. A portion, denoted as a string. For strings Since the highest ASCII value for a character is 128, which can be covered by a seven-bit binary number, all characters in the string are converted to seven-bit binary ASCII values, and then these seven-bit binary ASCII values are concatenated in the original character order to obtain a binary string. . It can be viewed as a binary number, which can be converted to a decimal number. , which serves as the offset for the watermark embedding position. The specific process is as follows: Assume the string Depend on Composed of 10 characters, written as .Will Convert each value sequentially to a seven-bit binary ASCII value, and set it as follows: Then the binary string. It can be written as ,Will Treating it as a whole as a binary number, converting it to a decimal number yields... For each location where watermark information is to be embedded... The following formula can be used for adjustment: ,in Indicates the first The offset of each watermark position. ,in , Method represents a string The length to ensure the offset This ensures the transparency of the watermark information, as well as its numerical stability and reversibility. Assume the watermark string... Embedding coefficient matrix The first position ,but With offset The correspondence is shown in the matrix below: .
[0041] Step 105: Perform the inverse transformation process corresponding to the first transformation process on the N*T coefficient matrix to obtain N second image blocks.
[0042] In this embodiment of the application, after the aforementioned watermark embedding process is completed, a series of inverse transformations need to be performed on the obtained coefficient matrix to synthesize the watermarked image patch. Specifically, firstly, the coefficient matrix is transformed into a series of inverse transformations. Perform the Arnold inverse transformation formula. Arnold matrix. The Arnold transform formula is: ,calculate The corresponding inverse matrix Easy to obtain ,in Therefore, the Arnold inverse transform formula is: For the coefficient matrix Applying the Arnold inverse transform formula to each coefficient position in the matrix yields a new coefficient matrix, denoted as . . This is the obtained DCT coefficients including the watermark. For the DCT coefficient matrix including the watermark... The low-frequency subband containing the watermark can be obtained by applying the inverse DCT transform. The inverse DCT transform can be expressed as: ,in, The low-frequency subband containing the watermark will be... With high-frequency subband The inverse DWT transform is applied to the merged images. This is because the images are two-dimensional. Conducted in sequence Layer DWT transformation is required, therefore, watermark embedding also requires... Layer DWT inverse transform is used to form a two-dimensional image with embedded watermark. According to the DWT transformation formula, by analyzing the low-frequency portion... High frequency section The low-frequency subband is obtained by applying a one-dimensional Haar wavelet transform along the column direction. With high-frequency subband The formula can be simplified to obtain , , , Therefore, for the first Layer DWT transform, low-frequency subband with watermark With high-frequency subband The low-frequency component is obtained by applying a one-dimensional inverse Haar wavelet transform along the column direction. The formula is, ,in, Due to high-frequency subband and No change, therefore the high-frequency part There was no change. According to the DWT transform formula, by modifying the image... The low-frequency component is obtained by applying a one-dimensional Haar wavelet transform along the direction of travel. High frequency section The formula can be simplified to obtain , For the first Low-frequency component obtained by layer DWT transform High frequency section Applying a one-dimensional inverse Haar wavelet transform along the row direction yields the first... Low-frequency subband obtained by layer DWT transform , in, ,conduct After the layer DWT inverse transform, a two-dimensional image can be obtained. The correspondence is as follows: It is understandable that, due to the preset in step 104 above... Therefore, when T < S, in this step, it is necessary to perform inverse transformation on all S coefficient matrices to obtain the complete image patch.
[0043] Step 106: Merge the N second image blocks to obtain the watermark image corresponding to the image to be processed.
[0044] In this embodiment of the application, the N two-dimensional images are divided into blocks. The images are merged to obtain the final image with the watermark embedded. .
[0045] In this embodiment, considering both image size and watermark information length, the size of the image blocks into which the image is divided is determined to maximize the watermark embedding effect and effectively enhance the watermark file's ability to maintain watermark correctness after regular file operations and attacks. Simultaneously, the DWT transform algorithm is effectively improved by performing multi-level decomposition of the two-dimensional image, enabling the embedding of a larger capacity watermark in finer-grained frequency components, balancing the robustness and transparency of the watermark. Then, the Arnold transform algorithm is used to further shuffle the embedded watermark positions, encrypting and splitting the watermark information, and finally inversely transforming it back to the image, thereby improving the watermark's anti-tampering and anti-interference capabilities.
[0046] See Figure 2 ,exist Figure 2 In the illustrated embodiment, the watermarking method provided in this application is applied to a blockchain public service platform. The watermarking process is executed using a blockchain smart contract. After the watermark file is generated, it is directly stored on the blockchain public service platform. By leveraging the immutability and transparency of the blockchain, the robustness of the algorithm is enhanced, enabling the watermark information embedded in the file to resist various malicious or non-malicious operations on the file. That is, the correct watermark information can still be obtained after various attacks. The watermarking algorithm can also be effectively executed through the blockchain smart contract to prevent the watermark from being cracked and modified, while effectively improving the efficiency of the watermark embedding process.
[0047] Optionally, the method further includes: Obtain the download request of the first target user, and obtain the second watermark information based on the download request; The second watermark information is encrypted, and the encrypted second watermark information is embedded into the watermark image to obtain the target watermark image and the encrypted second watermark information; The target watermark image is sent to the first target user.
[0048] In this embodiment of the application, the second watermark information is the personal information and operation information of the target user. The target user includes the user who applied for download or the user who launched the attack and tampered with the file. By embedding the user information of the user who came into contact with the watermark file into the file, the relevant information of the downloader can be marked, which makes it easier for the author or other authorized users to track the subsequent dissemination of the file.
[0049] See Figure 3 , Figure 3 The flowchart illustrates a watermark processing method for user download requests provided in this application embodiment. The user selects the desired watermarked file on a blockchain public service platform and applies for download. The platform uses a smart contract to encrypt and generate watermark content based on the user's personal information, file name, download time, etc., embedding the new watermark content into the watermarked file. The file is then successfully downloaded and returned to the user.
[0050] Specifically, the relevant information of the user requesting the download is combined and encrypted to generate a new watermark. The generation of the new watermark can also employ the RSA asymmetric encryption algorithm. The formula is as follows: ,in These are connector symbols used to combine text information. For file name, The username for downloading the file. For user identity information such as ID card number, The time it takes for the user to download the file. The operation performed on the user in this scenario is "downloading a file," and the watermarked content is output after encryption with a private key. The watermark is embedded into the downloaded watermark file and returned to the user.
[0051] Optionally, the method further includes: Based on the encrypted first watermark information and the encrypted second watermark information, the first serial watermark information is obtained; The first hash value is obtained by calculating the first concatenated watermark information using a hash function; The first hash value is stored as the first watermark file code.
[0052] In this embodiment, a unique hash value is generated from the encrypted watermark information generated during the file propagation process and stored as a watermark file code on the blockchain public service platform. This records the process of the file resource from embedding the watermark to downloading, which is convenient for subsequent verification of whether the file has been attacked or tampered with. If a corresponding watermark file that is inconsistent with the stored watermark file code appears, and the owner of the corresponding watermark file does not have the permission to modify the file, it can be determined that the watermark file has been illegally attacked or tampered with.
[0053] See Figure 3When a user requests a download, the blockchain public service platform can embed the watermark into the relevant watermark content of subsequent downloads, encrypt it, and synthesize a watermark file code, which is then stored in a distributed system. Specifically, after the watermark file is downloaded, the blockchain public service platform links the embedded watermark content with the new watermark content generated during the download process, and uses a hash function to... Calculate the watermark file code It is stored in a distributed system; the calculation formula is as follows: ,in, The watermark content originally embedded in the file represents information about the copyright owner of the resource. The new watermark content generated for the first download of this resource represents the information of the user who requested the download.
[0054] Optionally, the method further includes: Obtain the download request from the second target user, and obtain the third watermark information based on the download request; The third watermark information is encrypted to obtain encrypted third watermark information; Based on the first serial watermark information and the encrypted third watermark information, the second serial watermark information is obtained; The second hash value is obtained by calculating the second concatenated watermark information using a hash function. The second hash value is used as the second watermark file code, and the first watermark file code is replaced with the second watermark file code, and the second watermark file code is stored.
[0055] In this embodiment, the watermark file code can record information about relevant users involved in the process of embedding the watermark in a file resource and subsequent downloads. Each time a resource is downloaded, a new watermark file code is generated to replace the original one and stored in a distributed system. This effectively improves the watermark information's traceability capabilities. When the watermark information is tampered with, the responsible party can be quickly traced through the information recorded in the watermark file code. If the tampering occurs after downloading, the watermark file and watermark file code have already been updated based on the downloader's information. The last downloader can be found by extracting the watermark, and this last downloader may be the infringer, or the infringer can be traced back through the last downloader. If the tampering occurs on a blockchain public service platform, the platform records the tamperer's information and updates the watermark file and watermark file code. The infringer can then be traced by extracting this information.
[0056] Specifically, to record the process of this file from embedding the watermark to multiple downloads, the blockchain public service platform links the embedded watermark content with the new watermark content generated during the multiple download processes, and uses a hash function. Calculate the watermark file code The calculation formula is as follows: ,in, The new watermark content generated for the first download of this resource up to the Nth download represents the information of the user who requested the download each time. A new watermark file code is generated every time the resource is downloaded a new time. Cover the original Therefore, if the embedded watermark content or the new watermark content generated from multiple downloads changes without the resource being downloaded again, a new watermark file code will be generated. The watermark file code represents information about the resource file from the initial watermark embedding to the last download by the relevant user. Simultaneously, leveraging the decentralized storage model of blockchain technology, a distributed storage system can be constructed. This system consists of a series of blockchain storage nodes, each storing all file resource data blocks, and each data block stores the watermark file code corresponding to that resource file. .like Figure 6 As shown, if the watermark of a system's stored resource file is attacked and tampered with, a new watermark file code will be generated, which will correspond to the watermark file code in the distributed storage system. Inconsistent. Also, through the watermark file code... It also allows tracking which users downloaded and used the resources sequentially, enabling effective tracing of responsible parties in the event of copyright infringement. Distributed storage effectively ensures data accuracy, resolving the issue of difficulty in tracing responsibility for resource leaks due to altered watermarks. Even if resources are subsequently stolen or tampered with, the blockchain information can be used to identify the copyright owner and the person responsible, thus facilitating accountability.
[0057] Optionally, the method further includes: Obtain an extraction request from a third target user, and obtain the permission information of the third target user based on the extraction request; Based on the permission information, determine whether the third target user has the necessary operating permissions; When the third target user has operation permissions, the watermark image is subjected to an inverse transformation process corresponding to the first transformation process to obtain the encrypted first watermark information in the watermark image. The encrypted first watermark information is decrypted to obtain the first watermark information, and then the first watermark information is sent to the third target user.
[0058] See Figure 4Users upload files with embedded watermarks to the blockchain public service platform and initiate a request to extract the watermark information from the uploaded file. The platform verifies the user's identity; only the copyright owner of the file resource or a platform administrator has the right to extract the watermark. After the user's identity is verified, the platform decrypts the watermark information in the file and sends the decrypted watermark content to the user. Otherwise, if the user's identity is not verified, the platform rejects the user's extraction request. By setting encryption and access control to manage the extraction of watermark information, the privacy of copyright owners and related operators is effectively protected from arbitrary disclosure.
[0059] Specifically, the platform performs inverse transform processing on the watermark image to extract watermark information in the following steps: Since the Arnold inverse transform and DCT inverse transform are performed sequentially after embedding the watermark, Layer DWT inverse transform, therefore the extraction process first repeats document preprocessing, The low-frequency subband is obtained by performing layer DWT transform, DCT transform, and Arnold transform. The corresponding DCT coefficient matrix Then, the watermark information is extracted based on the position of the embedded watermark coefficient. If the offset algorithm provided in this embodiment is also used during the embedding process, it is also necessary to calculate the coefficient matrix. and The offset is obtained from the difference between the corresponding positions. ,Right now And then Take its decimal part to get the decimal number ,Right now , for The number of decimal places, then the decimal number Convert to binary string ; due to the string Convert to binary string During the process, all characters are uniformly converted into seven-bit binary numbers, therefore... Divide the data into seven parts from tail to head to obtain... (where binary numbers) (Potentially less than seven bits), for each of the divided binary parts As ASCII values, we get binary ASCII values. Corresponding character The characters, arranged in order, form a string. This will give you the watermark string. Due to the watermark string Separate into Therefore, it also corresponds to offset ,from Begin by calculating sequentially. offset The watermark string is obtained. The original watermark string can be obtained by concatenating the strings in order. The corresponding relationships in the offset calculation formulas are as follows: ,in, .
[0060] See Figure 5 This application also provides a watermarking method for a blockchain public service platform. Based on platform function, it is divided into three main parts: watermark embedding, watermark extraction, and watermark file download. Combining blockchain technology with the watermarking technology provided in this application effectively alleviates problems such as the ease with which data watermarks can be cracked and modified, difficulty in tracing the responsible party for infringement, and leakage of copyright owner privacy due to watermark cracking. The entire process from watermark embedding to downloading is recorded on the blockchain, and a watermark file code is constructed to achieve full-length tracking of the resource's historical records, facilitating liability determination after infringement occurs. The use of blockchain smart contract technology during the watermark embedding process enhances the watermark file's ability to maintain watermark integrity after normal operations and attacks. All three parts can be partially or fully embedded into existing data watermark embedding and extraction processes, achieving the same effects as described in this application.
[0061] Specifically, the watermark embedding process involves users uploading their original files to the blockchain public service platform. The platform's smart contract encrypts the user's personal information to generate a watermark, which is then embedded into the original file using the aforementioned processing method. The generated watermark file is stored on the blockchain public service platform. The watermark extraction process involves users uploading the watermarked file to the blockchain public service platform and verifying their identity to determine if they have permission to extract the watermark. After successful verification, the platform returns the decrypted watermark information to the user. The watermark file download process involves users requesting to download the watermarked file from the blockchain public service platform. The platform also encrypts the requesting user's information to generate a watermark embedded file, indicating the file's distribution path. Furthermore, upon successful download, the platform encrypts and synthesizes all watermark information from the initial watermark embedding to multiple downloads into a single watermark file code, storing it in a distributed system to prevent the watermark information from being cracked or modified.
[0062] See Figure 7 This application provides a watermark processing device 70, comprising: The first acquisition module 701 is used to acquire the image to be processed and the first watermark information; The first processing module 702 is used to divide the image to be processed into N first image blocks, and to perform a first transformation process on each first image block to determine the position of the embedding coefficient in each first image block, where N is a positive integer; The second processing module 703 is used to encrypt the first watermark information using a key to obtain the encrypted first watermark information. The third processing module 704 is used to split the encrypted first watermark information into T embedding coefficient positions embedded in each of the first image blocks to obtain an N*T coefficient matrix, where T is a positive integer. The fourth processing module 705 is used to perform the inverse transformation of the first transformation on the N*T coefficient matrix to obtain N second image blocks; The fifth processing module 706 is used to merge the N second image blocks to obtain the watermark image corresponding to the image to be processed.
[0063] Optionally, the first processing module 702 includes: The first processing unit is used to perform multi-level discrete wavelet transform based on low-frequency subband iterative decomposition to decompose each first image block multiple times to obtain M low-frequency subband coefficient matrices corresponding to the first image block, where M is a positive integer. The second processing unit is used to perform a transformation process on the M low-frequency sub-band coefficient matrices based on discrete cosine transform to obtain M first coefficient matrices corresponding to the M low-frequency sub-band coefficient matrices. The third processing unit is used to scramble the row and column positions of each of the first coefficient matrices based on the chaotic mapping transformation algorithm to obtain M second coefficient matrices; The determining unit is used to determine the high-frequency coefficient region in the second coefficient matrix as the embedding coefficient position of the first image block.
[0064] Optionally, the third processing module 704 includes: The encrypted first watermark information is split into T strings; The fourth processing unit is used to convert each character in each of the strings into the corresponding seven-bit binary ASCII code; The fifth processing unit is used to concatenate each ASCII code according to the character order in the watermark information to obtain the corresponding binary string; The sixth processing unit is used to convert the binary string into a decimal representation to obtain the decimal number corresponding to the binary string; The seventh processing unit is used to take the value of the decimal number as the offset of the embedding coefficient position, and perform offset processing on the embedding coefficient position of the first image block according to the offset to obtain the target embedding coefficient position. The eighth processing unit is used to embed the watermark information into the target embedding coefficient position of each of the first image blocks to obtain N*T coefficient matrices.
[0065] Optionally, the watermark processing device 70 further includes: The first acquisition unit is used to acquire the download request of the first target user and acquire the second watermark information based on the download request. The ninth processing unit is used to encrypt the second watermark information and embed the encrypted second watermark information into the watermark image to obtain the target watermark image and the encrypted second watermark information. The first sending unit is used to send the target watermark image to the first target user.
[0066] Optionally, the watermark processing device 70 further includes: The tenth processing unit is used to obtain first serial watermark information based on the encrypted first watermark information and the encrypted second watermark information; The eleventh processing unit is used to calculate the first hash value from the first serialized watermark information using a hash function. The first storage unit is used to store the first hash value as the first watermark file code.
[0067] Optionally, the watermark processing device 70 further includes: The second acquisition unit is used to acquire the download request of the second target user and acquire the third watermark information based on the download request. The twelfth processing unit is used to encrypt the third watermark information to obtain encrypted third watermark information; The thirteenth processing unit is used to obtain the second serial watermark information based on the first serial watermark information and the encrypted third watermark information; The fourteenth processing unit is used to calculate the second hash value by using a hash function to obtain the second serialized watermark information; The second storage unit is used to use the second hash value as the second watermark file code, replace the first watermark file code with the second watermark file code, and store the second watermark file code.
[0068] Optionally, the watermark processing device 70 further includes: The third acquisition unit is used to acquire an extraction request from a third target user and acquire the permission information of the third target user based on the extraction request. The judgment unit is used to determine whether the third target user has operation permissions based on the permission information; The fifteenth processing unit is used to perform an inverse transformation process on the watermark image corresponding to the first transformation process when the third target user has operation permissions, so as to obtain the encrypted first watermark information in the watermark image. The second sending unit is used to decrypt the encrypted first watermark information to obtain the first watermark information, and then send the first watermark information to the third target user.
[0069] The watermark processing apparatus provided in this application embodiment can implement all the processes implemented in the above watermark processing method embodiment and achieve the same technical effect. To avoid repetition, it will not be described again here.
[0070] See Figure 8 This application provides an electronic device 80, including a processor 801, a memory 802, and a program or instructions stored in the memory 802 and executable on the processor 801. When the program or instructions are executed by the processor 801, they implement the various processes in the above-mentioned watermarking method and achieve the same technical effect. To avoid repetition, they will not be described again here.
[0071] This application also provides a computer-readable storage medium storing a program or instructions. When the program or instructions are executed by a processor, they implement the various processes in the above-described watermarking method and achieve the same technical effect. To avoid repetition, they will not be described again here.
[0072] This application also provides a computer program product, including computer instructions. When the computer instructions are executed by a processor, they implement the various processes in the above-described watermarking method embodiments and achieve the same technical effect. To avoid repetition, they will not be described again here.
Claims
1. A watermark processing method, characterized in that, The method includes: Obtain the image to be processed and the first watermark information; The image to be processed is divided into blocks to obtain N first image blocks, and a first transformation process is performed on each first image block to determine the position of the embedding coefficients in each first image block, where N is a positive integer; The first watermark information is encrypted using a key to obtain the encrypted first watermark information. The encrypted first watermark information is split into T parts and embedded into the embedding coefficient positions in each of the first image blocks to obtain an N*T coefficient matrix, where T is a positive integer. The N*T coefficient matrix is subjected to the inverse transformation corresponding to the first transformation process to obtain N second image blocks; The N second image blocks are merged to obtain the watermark image corresponding to the image to be processed.
2. The method according to claim 1, characterized in that, The step of performing a first transformation process on each of the first image blocks to determine the position of the embedding coefficients in each of the first image blocks includes: Based on the multi-level discrete wavelet transform of low-frequency subband iterative decomposition, each first image block is decomposed multiple times to obtain M low-frequency subband coefficient matrices corresponding to the first image block, where M is a positive integer. Based on the discrete cosine transform, the M low-frequency sub-band coefficient matrices are transformed to obtain the M first coefficient matrices corresponding to the M low-frequency sub-band coefficient matrices. Based on the chaotic mapping transformation algorithm, the row and column positions of each of the first coefficient matrices are scrambled to obtain M second coefficient matrices; The high-frequency coefficient region in the second coefficient matrix is determined as the embedding coefficient position of the first image block.
3. The method according to claim 1, characterized in that, The step of splitting the encrypted first watermark information into T parts and embedding them into the embedding coefficient positions of each of the first image blocks to obtain an N*T coefficient matrix includes: The encrypted first watermark information is split into T strings; Convert each character in each of the aforementioned strings into its corresponding seven-bit binary ASCII code; Based on the character order in the watermark information, each ASCII code is concatenated according to the character order to obtain the corresponding binary string; Convert the binary string to decimal representation to obtain the decimal number corresponding to the binary string; The decimal number is used as the offset of the embedding coefficient position. The embedding coefficient position of the first image block is offset according to the offset to obtain the target embedding coefficient position. The watermark information is embedded into the target embedding coefficient position of each of the first image blocks to obtain N*T coefficient matrices.
4. The method according to any one of claims 1 to 3, characterized in that, The method further includes: Obtain the download request of the first target user, and obtain the second watermark information based on the download request; The second watermark information is encrypted, and the encrypted second watermark information is embedded into the watermark image to obtain the target watermark image and the encrypted second watermark information; The target watermark image is sent to the first target user.
5. The method according to claim 4, characterized in that, The method further includes: Based on the encrypted first watermark information and the encrypted second watermark information, the first serial watermark information is obtained; The first hash value is obtained by calculating the first concatenated watermark information using a hash function; The first hash value is stored as the first watermark file code.
6. The method according to claim 5, characterized in that, The method further includes: Obtain the download request from the second target user, and obtain the third watermark information based on the download request; The third watermark information is encrypted to obtain encrypted third watermark information; Based on the first serial watermark information and the encrypted third watermark information, the second serial watermark information is obtained; The second hash value is obtained by calculating the second concatenated watermark information using a hash function. The second hash value is used as the second watermark file code, and the first watermark file code is replaced with the second watermark file code, and the second watermark file code is stored.
7. The method according to any one of claims 1 to 3, characterized in that, The method further includes: Obtain an extraction request from a third target user, and obtain the permission information of the third target user based on the extraction request; Based on the permission information, determine whether the third target user has the necessary operating permissions; When the third target user has operation permissions, the watermark image is subjected to an inverse transformation process corresponding to the first transformation process to obtain the encrypted first watermark information in the watermark image. The encrypted first watermark information is decrypted to obtain the first watermark information, and then the first watermark information is sent to the third target user.
8. A watermark processing device, characterized in that, The device includes: The first acquisition module is used to acquire the image to be processed and the first watermark information; The first processing module is used to divide the image to be processed into N first image blocks, and to perform a first transformation process on each first image block to determine the position of the embedding coefficients in each first image block, where N is a positive integer; The second processing module is used to encrypt the first watermark information using a key to obtain the encrypted first watermark information. The third processing module is used to split the encrypted first watermark information into T embedding coefficient positions embedded in each of the first image blocks to obtain an N*T coefficient matrix, where T is a positive integer. The fourth processing module is used to perform the inverse transformation of the first transformation on the N*T coefficient matrix to obtain N second image blocks; The fifth processing module is used to merge the N second image blocks to obtain the watermark image corresponding to the image to be processed.
9. An electronic device, characterized in that, It includes a processor, a memory, and a program or instructions stored in the memory and executable on the processor, wherein the program or instructions, when executed by the processor, implement the steps of the watermarking method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The readable storage medium stores a program or instructions that, when executed by a processor, implement the steps of the watermarking method as described in any one of claims 1 to 7.
11. A computer program product, characterized in that, It includes computer instructions that, when executed by a processor, implement the steps in the watermarking method as described in any one of claims 1 to 7.