Blind watermark adding and extracting method based on discrete selection of image pixels

By randomly generating pixel coordinates of watermark information in the image and discretely distributed storage, the existing blind watermark technology has solved the problem of complex and inefficient calculations, and efficient and secure watermark addition and extraction are achieved.

CN120259065BActive Publication Date: 2025-08-26HANGZHOU HIKVISION DIGITAL TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510732629.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-06-03
Publication Date
2025-08-26
Estimated Expiration
2045-06-03

AI Technical Summary

Technical Problem

The existing blind watermarking technology has complex calculations in the image and takes a long time. It is especially inefficient when processing large-size images or videos. The plain text watermarks are easily removed or tampered with, and cannot effectively ensure data security.

Method used

The blind watermark addition method based on discrete selection of image pixels is adopted. By randomly generating pixel coordinates of watermark information, the watermark information is stored discretely in the carrier image, and the watermark information and coordinates are stored using different pixel channels to reduce occlusion of the image and improve security.

Benefits of technology

It improves the security of the image, reduces the probability of watermark being discovered, reduces the difficulty of modifying and removing watermark information, and improves the efficiency of watermark addition and extraction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120259065B_ABST
    Figure CN120259065B_ABST
Patent Text Reader

Abstract

The embodiment of the present application provides a blind watermark adding and extracting method and storage medium based on discrete selection of image pixels. When adding a watermark to a carrier image, the starting pixel of the watermark information to be written can be determined from the carrier image as the current pixel, the first watermark information in the watermark information queue is obtained as the current watermark information, the coordinates of the next pixel are randomly generated, the coordinates of the next pixel and the current watermark information are written into the pixel value of the current pixel, if the watermark information is not written, the next watermark information in the watermark information queue is obtained as the current watermark information, the next pixel is used as the current pixel, and then the step of executing the watermark information writing is returned until the watermark is added. The watermark adding scheme provided by the embodiment of the present application greatly improves the security of the image, and because the watermark information is discretely distributed in the carrier image, only the pixel value of a single pixel is modified in a small area, which can reduce screen occlusion.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing technology, and in particular to a blind watermark adding and extracting method based on discrete selection of image pixels and a storage medium. Background Art

[0002] Current digital watermarking technologies include plaintext watermarking and blind watermarking. Plaintext watermarks are visible to the human eye and can effectively deter unauthorized copying. However, plaintext watermarks can obscure images and are easily removed or tampered with, ultimately rendering them inaccessible or losing their intended protective function, making it difficult to effectively ensure data security. Blind watermarking, on the other hand, proactively adds invisible, transparent, and other imperceptible marks to images, enabling traceability and tracking. Current blind watermarking technologies include those based on frequency domain transforms and deep learning. These technologies are computationally complex, and the process of embedding and extracting watermarks from images is time-consuming, making them particularly inefficient when processing large images or videos. Therefore, there is a need for a watermarking solution that can minimize image obstruction and enhance image security. Summary of the Invention

[0003] In view of this, the present application provides a blind watermark adding and extraction method and storage medium based on discrete selection of image pixels.

[0004] According to a first aspect of the present application, a blind watermarking method based on discrete selection of image pixels is provided, the method comprising:

[0005] Obtain the first watermark information in the watermark information queue as the current watermark information according to the set order;

[0006] Determine the starting pixel to be written with watermark information from the carrier image as the current pixel;

[0007] randomly determining coordinate information of a next pixel in the carrier image based at least on coordinate information of a current pixel, the current pixel and the next pixel being discretely distributed in the carrier image;

[0008] Adjusting the pixel value of the current pixel based on the coordinate information of the next pixel and the current watermark information as follows: replacing a pixel value of a first pixel channel of the current pixel with the current watermark information, and replacing a pixel value of a second pixel channel of the current pixel with the coordinate information of the next pixel, the first pixel channel being different from the second pixel channel, so that the pixel values ​​of at least two pixel channels of the current pixel represent the coordinate information of the next pixel and the current watermark information;

[0009] If the current watermark information is not the last watermark information, then according to the set order, the next watermark information of the current watermark information in the watermark information queue is used as the current watermark information, the next pixel is used as the current pixel, and the coordinate information based on the current pixel is returned, and the coordinate information of the next pixel is randomly determined in the carrier image.

[0010] According to a second aspect of the present application, a blind watermark extraction method based on discrete selection of image pixels is provided, the method comprising:

[0011] Acquire the target image;

[0012] In the case where it is determined that the target image is added with a watermark, determining a starting current pixel to be extracted from the target image based on a preset pixel determination rule;

[0013] Executing a watermark information extraction step: for a current pixel to be extracted, extracting the watermark information in the watermark information queue representing the watermark and the coordinates of the next pixel to be extracted from the pixel value of the current pixel to be extracted;

[0014] Determine whether all watermark information in the watermark information queue has been extracted;

[0015] If not, obtaining the next pixel to be extracted from the target image based on the coordinates of the next pixel to be extracted, taking the next pixel to be extracted as the current pixel to be extracted, and returning to the step of performing watermark information extraction;

[0016] If yes, it is determined that the watermark extraction is completed.

[0017] According to a third aspect of the present application, an electronic device is provided, comprising a processor, a memory, and a computer program stored in the memory for execution by the processor, wherein the processor implements the method mentioned in the first aspect and / or the second aspect when executing the computer program.

[0018] According to a fourth aspect of the present application, a computer program product is provided, which includes a computer program, and when the computer program is executed, it implements the method mentioned in the first aspect and / or the second aspect.

[0019] According to a fifth aspect of the present application, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed, the method mentioned in the first aspect and / or the second aspect is implemented.

[0020] By applying the solution provided in the present application, when adding a watermark to a carrier image, the first watermark information in the watermark information queue can be obtained as the current watermark information in a set order, and the starting pixel of the watermark information to be written can be determined from the carrier image as the current pixel; based on at least the coordinate information of the current pixel, the coordinate information of the next pixel can be randomly determined in the carrier image, wherein the current pixel and the next pixel are discretely distributed in the carrier image, and then the pixel value of the first pixel channel of the current pixel can be replaced by the current watermark information, and the pixel value of the second pixel channel of the current pixel can be replaced by the coordinate information of the next pixel, the first pixel channel is different from the second pixel channel, so that the pixel values ​​of at least two pixel channels of the current pixel represent the coordinate information of the next pixel and the current watermark information; if the current watermark information is not the last watermark information, the watermark information next to the current watermark information in the watermark information queue is used as the current watermark information in a set order, the next pixel is used as the current pixel, and the step of randomly determining the coordinate information of the next pixel in the carrier image based on the coordinate information of the current pixel is returned. Similarly, when extracting watermark information from an image, it is similar, that is, continuously extracting a watermark information in the watermark queue from the current pixel and the coordinates of the next pixel until the watermark is completely extracted.

[0021] The watermarking scheme provided in the embodiment of the present application is designed so that the pixel coordinates of the pixels used to store each watermark information (e.g., watermark length, watermark character, etc.) in the watermark are randomly generated. That is, the pixels storing each character in the watermark are randomly distributed in the image, and the pixel coordinates of the pixels storing each character must be determined based on the pixels storing the previous character. Therefore, even if an attacker knows that there is watermark information in the image, they cannot obtain or modify the watermark information, and it is not easy for criminals to remove the watermark by intercepting the image in blocks, which greatly improves the security of the image. Furthermore, since the pixels storing the watermark information are discretely distributed in the carrier image, only the pixel value of a single pixel is modified in a small area, which can reduce image occlusion. Furthermore, since the watermark information is directly stored as the pixel value of the discretely distributed pixel points, rather than directly superimposed on the carrier image, the user cannot see the watermark information, that is, the added watermark information is a blind watermark.

[0022] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0024] Figure 1 This is a flow chart of a watermark adding method according to an embodiment of the present application.

[0025] Figure 2 This is a schematic diagram of determining a first pixel point from a carrier image according to an embodiment of the present application.

[0026] Figure 3 It is a schematic diagram of a watermark extraction method according to an embodiment of the present application.

[0027] Figure 4 This is a schematic diagram of writing pixel coordinates using a pixel GBA channel according to an embodiment of the present application.

[0028] Figure 5 This is a schematic diagram of the distribution of the characters of the watermark in the image after the watermark is added to the image using the watermark adding method of the present application.

[0029] Figure 6 It is a schematic diagram of the logical structure of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

[0030] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0031] As an important information carrier, images have been widely used in the internet, multimedia, and digital media. However, the digitization and networked dissemination of images also bring challenges such as copyright protection, content authentication, and information security. Digital watermarking technology has emerged as an effective means of protecting digital content. By embedding specific information into images, it achieves copyright protection, content authentication, and information hiding.

[0032] Current digital watermarking technologies include plaintext watermarking and blind watermarking. Plaintext watermarks are visible to the human eye and typically consist of text or images. They can effectively deter unauthorized copying. However, plaintext watermarks can obscure images and be easily removed or tampered with, ultimately making it impossible to trace the source or losing the watermark's intended protective function, making it difficult to effectively ensure data security. Blind watermarking, on the other hand, can be understood as proactively adding invisible, transparent, or other imperceptible marks to images, enabling traceability and tracking. Current blind watermarking technologies include those based on frequency domain transformation and deep learning. Frequency domain transformation-based blind watermarking embeds the watermark into the image's frequency domain coefficients, ensuring that the watermark is visually invisible and highly robust. Deep learning-based blind watermarking utilizes deep neural networks to automatically learn image features and embed the watermark within them, achieving high-quality watermark embedding and extraction. However, these blind watermarking technologies are computationally complex, and the watermark embedding and extraction process is time-consuming, making them particularly inefficient when processing large images or videos.

[0033] For ease of distinction, in the embodiment of the present application, during the watermark adding process, the current pixel to be written with the watermark information is referred to as the current pixel to be written, and the next pixel to be written with the watermark information is referred to as the next pixel to be written. During the watermark extraction process, the current pixel to be extracted with the watermark information is referred to as the current pixel to be extracted, and the next pixel to be extracted with the watermark information is referred to as the next pixel to be extracted.

[0034] Based on this, an embodiment of the present application provides a solution for adding watermarks to images and extracting watermarks from images (i.e., tracing the source). When adding a watermark to a carrier image, the starting current pixel to be written can be determined from the carrier image based on a preset pixel determination rule, and the first watermark information in the watermark information queue is obtained as the current watermark information, and then the watermark information writing step is executed: for the current pixel to be written, the coordinates of the next pixel to be written are randomly generated, and the coordinates of the next pixel to be written and the current watermark information are written into the pixel value of the current pixel to be written, and then it is determined whether all the watermark information in the watermark information queue has been written; if not, the next watermark information in the watermark information queue is obtained as the current watermark information, and the next pixel to be written is used as the current pixel to be written, and then the step of executing the watermark information writing is returned; if yes, it is determined that the watermark addition is completed.

[0035] Similarly, when extracting watermark information from the carrier image, it is similar, that is, continuously extracting a watermark information from the current pixel to be extracted in the watermark queue and the coordinates of the next pixel to be extracted until the watermark is completely extracted.

[0036] Since the pixel coordinates of each pixel of the watermark information used to write the watermark are randomly generated, that is, the pixels storing the watermark information are randomly distributed in the image, and the pixel coordinates of the pixels storing each watermark information must be determined based on the pixels storing the previous watermark information, even if the attacker knows that there is watermark information in the image, he cannot obtain or modify the watermark information, and since the watermark information of each watermark is discretely distributed in the image, it is not easy for criminals to remove the watermark by intercepting it in blocks, which greatly improves the security of the image. In this application, the watermark information is written into the image pixels. When the device actively takes a screenshot / records the screen / takes a photo or the criminals use third-party software to take a screenshot, since the watermark is written on the image that is finally rendered on the screen, the watermark information will also be intercepted when the screenshot is taken, ensuring that the watermark information is not lost due to the screenshot and ensuring the robustness of the watermark. Moreover, since the watermark information is discretely distributed in the image and only a single pixel is modified in a small area, the watermark information appears as RBGA color dots on the image, making it difficult for users to confirm the existence of the watermark with the naked eye. Compared with plaintext watermarks, this reduces image obstruction while achieving the purpose of hiding the watermark information to the greatest extent. Moreover, compared with blind watermark technology, the solution provided in the embodiment of the present application is relatively simple to calculate, which can improve the efficiency of watermark addition and extraction.

[0037] The watermark adding method and watermark extracting method provided in the embodiments of the present application can be executed by various electronic devices. For example, the electronic device can be a user's mobile phone, computer, tablet, cloud server, server cluster, etc. The specific configuration can be based on actual needs, and the embodiments of the present application do not impose any restrictions.

[0038] The following is combined first Figure 1 Introduce the watermark adding method in the embodiment of this application, such as Figure 1 As shown, the method may include the following steps:

[0039] S102, obtaining a watermark to be added and a carrier image to which the watermark is to be added, wherein the watermark includes a watermark information queue representing the watermark;

[0040] In step S102, the watermark to be added and the carrier image to which the watermark is to be added can be obtained. The watermark information queue may include multiple watermark information, which may be one or more of watermark identification information, watermark length information, and various elements in the watermark (such as characters or pixel values ​​of pixels). For example, the watermark to be added may be a text watermark, and the text includes multiple characters, each of which may be a watermark information in the watermark queue. The characters may include words, numbers, or symbols, which are not limited in the embodiment of the present application. For another example, the watermark to be added may be an image watermark, and the pixel value of each pixel in the image may be a watermark information in the watermark queue.

[0041] In some scenarios, the multiple watermark information in the watermark information queue may be just the characters in the watermark. In some scenarios, the multiple watermark information in the watermark information queue also includes the characters in the watermark, as well as one or more of the watermark identification information and the watermark length information.

[0042] The carrier image may be a single frame of image or an image frame in a video. For example, the carrier image may be a live image of a live video.

[0043] In some embodiments, the watermark to be added may be stored in a one-dimensional array in the form of ASCII code values ​​so as to be written into the carrier image.

[0044] S104, determining a starting pixel to be written from the carrier image based on a preset pixel determination rule;

[0045] In step S104, the starting current pixel to be written can be determined in the carrier image based on a preset pixel determination rule. The preset pixel determination rule may be a rule for determining one or more pixels from the carrier image. In some scenarios, the preset pixel determination rule may be used to indicate the position of the starting current pixel to be written in the carrier image, such as being located in the upper left corner or upper right corner of the carrier image, or the starting current pixel to be written being located in the Mth row and Nth column in the carrier image, etc. In some scenarios, the preset pixel determination rule may be used to indicate a method for determining the starting current pixel to be written, such as Figure 2 As shown, the starting current pixel to be written can be determined by obtaining the resolution of the carrier image, dividing the width and height of the carrier image resolution into three equal parts, and obtaining the 1-point and 2-point points respectively, so that four pixels can be determined in the carrier image, for example, P1, P2, P3, and P4 in the figure, and then a pixel among the four pixels (for example, P4) can be selected as the starting current pixel to be written.

[0046] S106, obtaining the first watermark information in the watermark information queue as the current watermark information;

[0047] In step S106, the first watermark in the watermark queue may be obtained as the current watermark. In some scenarios, the watermark queue includes both watermark length information and watermark characters, and the first watermark may be the watermark length. In some scenarios, the watermark queue includes only watermark characters, and the first watermark may be the first character of the watermark.

[0048] S108, executing the watermark information writing step: for the current pixel to be written, randomly generating the coordinates of the next pixel to be written, and writing the coordinates of the next pixel to be written and the current watermark information into the pixel value of the current pixel to be written:

[0049] In step S108, after obtaining the current pixel to be written and the current watermark information, the coordinates of the next pixel to be written can be randomly generated for the current pixel to be written, and the coordinates of the next pixel to be written and the current watermark information are written into the pixel value of the current pixel to be written, that is, the pixel value of the current pixel to be written is replaced by the coordinates of the next pixel to be written and the current watermark information.

[0050] There are multiple ways to write the watermark information and the coordinates of the next pixel to be written into the current pixel to be written. For example, the watermark information can be written into a portion of the pixel channels of the current pixel to be written, and the coordinates of the next pixel to be written can be written into another portion of the pixel channels. Alternatively, the pixel value of the current pixel to be written can be recorded using multiple bits. For example, assuming that the pixel value of the current pixel to be written is represented by a 32-bit binary code, the 32 bits can also be divided. For example, the first 8 bits are used to record the binary code of the watermark information, and the last 24 bits are used to record the binary code of the coordinates of the next pixel to be written. Wherein, the coordinates of the next pixel to be written include X coordinates and Y coordinates, then the first 12 bits of the 24 bits can be used to record the X coordinate, and the last 12 bits can be used to record the Y coordinate. Alternatively, the first 16 bits can be used to record the binary code of the watermark information, and the last 16 bits can be used to record the binary code of the coordinates of the next pixel to be written. The specific writing method can be flexibly set based on actual needs. The overall principle is to change the storage space originally used to store the pixel value of the current pixel to be written to store the watermark information and the coordinates of the next pixel to be written.

[0051] S110, determining whether all watermark information in the watermark information queue has been written;

[0052] In step S110, after each watermark information writing step is completed, it can be determined whether all watermark information in the current watermark information queue has been written.

[0053] S112: If no, obtain the next watermark information in the watermark information queue as the current watermark information, set the next pixel to be written as the current pixel to be written, and then return to the step of executing the watermark information writing;

[0054] In step S112, if it is determined that the watermark information in the watermark information queue has not been written, the next watermark information in the watermark information queue is obtained as the current watermark information, the next pixel to be written is used as the current pixel to be written, and then the step of executing the watermark information writing is returned.

[0055] S114: If yes, determine that the watermark adding is completed.

[0056] In step S114, if it is determined that all watermark information in the watermark information queue has been written, it is determined that the watermark addition is completed.

[0057] For example, assuming the watermark to be added is SUISEN, the pixel with pixel coordinates P0 can be determined from the carrier image based on a preset pixel determination rule. The pixel with pixel coordinates P0 is the pixel in the upper left corner of the carrier image. A pixel coordinate P1 can then be randomly generated, and the watermark length information 5 and pixel coordinates P1 can be written into pixel P0. For example, the length information can be written into the R channel of P0 to replace the pixel value in the R channel, and pixel coordinates P1 can be written into the GBA channel of P0 to replace the pixel value in the GBA channel. The pixel with pixel coordinates P1 can then be determined from the carrier image, and pixel coordinates P2 can be randomly generated. The first character S of the watermark can be written into the R channel of the pixel with pixel coordinates P1, and pixel coordinates P2 can be written into the GBA channel of the pixel with pixel coordinates P1. Then, the pixel point with pixel coordinates P2 can be determined from the carrier image, and a pixel coordinate P3 can be randomly generated. The second character U of the watermark is written into the R channel of the pixel point with pixel coordinates P2, and the pixel coordinates P3 are written into the GBA channel of the pixel point with pixel coordinates P2. The above process is repeated until all the characters of the watermark are written into the carrier image.

[0058] In some embodiments, the watermark includes multiple characters, and each watermark information in the watermark information queue includes one or more of the characters in the watermark, watermark identification information, and watermark length information; wherein the watermark identification information is used to indicate that the carrier image carries a watermark.

[0059] For example, in some scenarios, the watermark information queue is as follows: (watermark identification information, watermark length, watermark character 1, watermark character 2...watermark character N), and the above watermark information can be randomly written into the pixels in the carrier image in sequence.

[0060] In some scenarios, the watermark queue may also include only the watermark length and watermark character. For example, the watermark information queue is as follows: (watermark length, watermark character 1, watermark character 2...watermark character N), and the above watermark information can be randomly written into the pixels in the carrier image in sequence.

[0061] In some scenarios, the watermark queue may also include only watermark characters. For example, the watermark information queue is as follows: (watermark character 1, watermark character 2...watermark character N), and the above watermark information can be randomly written into the pixels in the carrier image in sequence.

[0062] Among them, considering that when extracting watermarks from images, the watermark identification information can be used to determine whether the image carries the watermark, and the watermark length information can be used to determine whether the watermark has been extracted. Therefore, these two types of information are usually placed in front of the watermark information queue to facilitate the priority extraction of these two types of information.

[0063] In some embodiments, when the coordinates of the next pixel to be written and the current watermark information are written into the pixel value of the current pixel to be written, the current watermark information can be used to replace the pixel value of the first pixel channel of the current pixel to be written, and the coordinates of the next pixel to be written can be used to replace the pixel value of the second pixel channel of the current pixel to be written.

[0064] The first pixel channel and the second pixel channel are different channels of pixels in the carrier image, and both the first pixel channel and the second pixel channel can be one or more pixel channels.

[0065] The specific type and number of the first pixel channel and the second pixel channel can be flexibly set based on the format of the carrier image and the amount of data to be written, and are not limited in the implementation of this application.

[0066] For example, in some embodiments, the carrier image may be an image in RGBA format, in which case the first pixel channel may be the R channel, and the second pixel channel may be the G channel, the B channel, and the A channel. Alternatively, the first pixel channel may be the A channel, and the second pixel channel may be the R channel, the G channel, and the B channel. Alternatively, the first pixel channel may be the R channel and the G channel, and the second pixel channel may be the B channel and the A channel. The specific configuration may be flexibly adjusted based on actual needs and is not limited in the embodiments of the present application.

[0067] For example, in some embodiments, the carrier image may be an image in YUV format, in which case the first pixel channel may be a Y channel, and the second pixel channel may be a U channel or a V channel. Alternatively, the first pixel channel may be a Y channel or a U channel, and the second pixel channel may be a V channel. The specific configuration may be flexible based on actual needs and is not limited in the embodiments of the present application.

[0068] In some embodiments, the number of first pixel channels and second pixel channels is determined based on the amount of watermark information. That is, if the watermark information has a large amount of data, more pixel channels can be used to write the watermark information. Otherwise, fewer pixel channels can be used to write the watermark information to avoid significantly affecting the original content of the image. Considering that the R, G, and B channels are used to represent the color value of the pixel, and the A channel is used to represent the transparency of the pixel, replacing the pixel value of the A channel has a smaller impact on the overall display effect of the carrier image. If the carrier image is an image in RGBA format, the first pixel channel and the second pixel channel include at least the A channel.

[0069] In some embodiments, the first watermark in a watermark queue can be retrieved as the current watermark in a set order. This set order can be flexibly adjusted based on actual needs. For example, watermarks can be retrieved from the watermark queue from left to right, or from left to right. The starting pixel to be written to the watermark can then be determined from the carrier image as the current pixel (i.e., the current pixel to be written). Based at least on the coordinates of the current pixel, the coordinates of the next pixel (i.e., the next pixel to be written) are randomly determined in the carrier image. To avoid concentrating the watermark pixels in a small area, which would affect the image display, the current and next pixels are discretely distributed within the carrier image. Then, the pixel value of the current pixel can be adjusted as follows based on the coordinate information of the next pixel and the current watermark information: the pixel value of the first pixel channel of the current pixel is replaced by the current watermark information, and the pixel value of the second pixel channel of the current pixel is replaced by the coordinate information of the next pixel, the first pixel channel is different from the second pixel channel, so that the pixel values ​​of at least two pixel channels of the current pixel represent the coordinate information of the next pixel and the current watermark information; if the current watermark information is not the last watermark information, the watermark information next to the current watermark information in the watermark information queue is used as the current watermark information in the set order, the next pixel is used as the current pixel, and the step of randomly determining the coordinate information of the next pixel in the carrier image based on the coordinate information of the current pixel is returned.

[0070] Because watermark information is stored in discretely distributed pixels rather than continuous areas, this discrete distribution makes the watermark information more dispersed, further reducing the probability of the watermark being discovered. For example, watermark information may be stored at every few pixels in the image rather than concentrated in a specific area, making it difficult for attackers to find the pattern of the watermark through simple image analysis. By storing watermark information in discretely distributed pixels, the pixels in the image can be reused multiple times to store more watermark information. For example, a 1024×1024 image can store a large amount of watermark information by properly selecting discrete pixels without significantly affecting the visual effect of the image.

[0071] In some embodiments, when assigning pixel channels to the watermark information and the coordinates of the next pixel to be written, one or more channels can be flexibly allocated to each channel based on the amount of data. For example, considering that the numerical value corresponding to the watermark information is usually relatively small and can be represented by a small number of bits, only one pixel channel can be allocated to write the watermark information. Considering that when the image resolution is high, the numerical value corresponding to the pixel coordinate value is often large and requires more bits to represent, multiple pixel channels can be allocated to write the pixel coordinate information. Therefore, the number of first pixel channels can be less than the number of second pixel channels.

[0072] In some embodiments, the carrier image is an image in RGBA format, the first pixel channel is the R channel, and the second pixel channels are the G channel, the B channel, and the A channel.

[0073] In some embodiments, the current watermark information, the coordinates of the next pixel to be written, and the pixel value of the current pixel to be written are all represented by binary codes, and the binary code of the pixel value of the current pixel to be written is recorded through multiple bits. When the coordinates of the next pixel to be written and the current watermark information are written into the pixel value of the current pixel to be written, the binary code of the current watermark information can be written into the first bit of the multiple bits, and the coordinates of the next pixel to be written can be written into the second bit of the multiple bits, wherein the first bit is different from the second bit.

[0074] The first bit and the second bit are different bits in the plurality of bits. For example, the plurality of bits can be divided into two parts, with the first half being used to write the watermark information and the second half being used to write the coordinates of the next pixel to be written. Alternatively, the odd-numbered bits are used to write the watermark information and the even-numbered bits are used to write the coordinates of the next pixel to be written.

[0075] For example, considering that the pixel values ​​of image pixels are usually between 0 and 255, the pixel value of a pixel channel can be represented by one byte (i.e., 8 bits), and an image in RGBA format includes 4 pixel channels, which means a total of 32 bits. Considering that the numerical value corresponding to watermark information (for example, watermark length or watermark characters) is usually small, it can be represented by 8 bits, where the 8 bits can be freely set, for example, it can be the 8 bits corresponding to any one of the R channel, G channel, B channel, and A channel. When the image resolution is larger, the numerical value corresponding to the pixel coordinate is larger, so the remaining 24 bits can be used to represent it. Among them, the 24 bits can be 12 bits for the X coordinate and 12 bits for the Y coordinate value, so that it can cover images with a resolution of 4K.

[0076] In order to facilitate the extraction of watermarks from images, it is possible to know whether the current image carries a watermark, and watermark identification information can be written into the carrier image to indicate that the carrier image carries a watermark. In some embodiments, the watermark identification information can be used as watermark information in a watermark queue and written into the carrier image according to the above method. In some embodiments, considering that when extracting a watermark from an image, it is necessary to first determine whether the image carries a watermark, that is, it is necessary to preferentially extract the watermark identification information from the image, it is also possible to use a preset fixed pixel in the image to write the watermark identification information. For example, the target pixel can be determined from the carrier image based on a preset pixel determination rule; and the watermark identification information can be written into the designated pixel channel of the target pixel.

[0077] The preset pixel determination rule may be a rule for determining one or more pixels from the carrier image. For example, in some scenarios, the preset pixel determination rule may be used to indicate the position of the target pixel in the carrier image, such as being located at the upper left corner or upper right corner of the carrier image, or the target pixel being located at the Mth row and Nth column of the carrier image, etc. The number of target pixels may be one or more, and may be specifically determined based on the bit width occupied by the watermark identification information.

[0078] The designated pixel channel may be a pixel channel in the carrier image. For example, if the carrier image is an RGBA image, the designated pixel channel may be the R channel or the A channel. In some embodiments, considering that the R, G, and B channels are used to represent the color value of a pixel, and the A channel is used to represent the transparency of a pixel, replacing the pixel value of the A channel has little effect on the overall display effect of the carrier image. Therefore, the designated pixel channel may be the A channel.

[0079] In some embodiments, when randomly generating the coordinates of the next pixel to be written, in order to ensure that the randomly generated pixel coordinates do not exceed the pixel coordinate range of the carrier image, the coordinates of the next pixel to be written can be obtained based on the following method: the resolution of the carrier image can be obtained, and the X coordinate value of the above coordinate is randomly generated based on the resolution of the carrier image in the width direction, so that the X coordinate value does not exceed the value corresponding to the resolution in the width direction; the Y coordinate value of the above coordinate is randomly generated based on the resolution of the carrier image in the height direction, so that the Y coordinate value does not exceed the value corresponding to the resolution in the height direction.

[0080] For example, if the resolution of the carrier image is 1920×1680, a random number is used to generate the X coordinate in the Range (1, 1920), that is, the X coordinate is a random number between 1 and 1920, and the Y coordinate is generated in the Range (1, 1680), that is, the X coordinate is a random number between 1 and 1680, thereby randomly generating a pixel coordinate.

[0081] In some embodiments, in order to improve the security of the watermark, the watermark information in the watermark queue is encrypted to obtain encrypted information. For example, the watermark information can be encrypted with a public key and then Base64-encoded before being written into the carrier image.

[0082] Because watermark information is written into the carrier image as pixel values, the fewer characters in the watermark and the more dispersed they are within the carrier image, the less obstruction they cause to the original carrier image, and the more difficult it is for unscrupulous users to remove the watermark. Therefore, in some embodiments, the length of the watermark information can be controlled to be within a preset length. In some embodiments, the dispersion of the watermark characters within the carrier image can also be controlled to be greater than a preset dispersion level. For example, when randomly generating pixel coordinates, it can be determined whether the dispersion of the generated pixel coordinates exceeds the preset dispersion level. If not, the generated pixel coordinates can be regenerated.

[0083] For example, in some embodiments, when randomly determining the coordinate information of the next pixel in the carrier image based on at least the coordinate information of the current pixel, a pixel can be randomly determined in the carrier image, and then based on the coordinate information of the current pixel and the coordinate information of the pixel into which the watermark information is currently written, it is determined whether the degree of discreteness between the pixel and the current pixel, and between the pixel and the pixel into which the watermark information is currently written, is greater than a preset degree of discreteness. If so, the coordinate information of the pixel is used as the coordinate information of the next pixel. If not, a pixel is randomly determined again in the carrier image until the degree of discreteness between the pixel and the current pixel, and between the pixel and the pixel into which the watermark information is currently written, is greater than the preset degree of discreteness.

[0084] In some embodiments, considering that the R, G, and B channels are used to represent the color value of a pixel, while the A channel is used to represent the transparency of a pixel, replacing the pixel value of the A channel has a smaller impact on the overall display effect of the carrier image. Therefore, when using the watermark information and the coordinates of the next pixel to be written to replace the pixel value of the current pixel to be written, it is preferred to replace the pixel value of the A channel of the current pixel to be written. For example, if the bit width occupied by the watermark information and the coordinates of the next pixel to be written does not exceed the bit width of the pixel value of the A channel of the current pixel to be written, both can be written into the A channel of the current pixel to be written.

[0085] Based on the same inventive concept, the present application embodiment also provides a watermark extraction method, such as Figure 3 As shown, the method may include the following steps:

[0086] S302, acquiring a target image;

[0087] In step S302 , a target image may be acquired.

[0088] S304: When it is determined that the target image is watermarked, determine a starting pixel to be extracted from the target image based on a preset pixel determination rule;

[0089] In step S304, if it is determined that the target image has been watermarked, a starting pixel to be extracted can be determined from the target image based on a preset pixel determination rule. The preset pixel determination rule can be a rule for determining one or more pixels from an image. For example, the preset pixel determination rule can be used to indicate the position of the starting pixel to be extracted in the target image. The preset pixel determination rule is consistent with the pixel determination rule used in the watermarking process. For details, please refer to the description in the above embodiment and will not be repeated here.

[0090] S306, executing a watermark information extraction step: for a current pixel to be extracted, extracting the watermark information in the watermark information queue representing the watermark and the coordinates of the next pixel to be extracted from the pixel value of the current pixel to be extracted;

[0091] In step S306, after determining the starting current pixel to be extracted, the watermark information extraction step can be performed, that is, for the current pixel to be extracted, the watermark information in the watermark information queue representing the watermark and the coordinates of the next pixel to be extracted are extracted from the pixel value of the current pixel to be extracted.

[0092] The watermark information queue may include multiple watermark information, which may be one or more of watermark identification information, watermark length information, and various elements in the watermark (e.g., characters or pixel values ​​of pixels). For example, the watermark to be added may be a text watermark, and the text includes multiple characters, each of which may be a watermark information in the watermark queue. Characters may include words, numbers, or symbols, which are not limited in the embodiments of the present application. For another example, the watermark to be added may be an image watermark, and the pixel value of each pixel in the image may be a watermark information in the watermark queue.

[0093] When extracting the watermark information and the coordinates of the next pixel to be extracted from the pixel value of the current pixel to be extracted, the specific extraction method can be determined based on the method used during the watermarking process. For example, if the watermark information is written into the R channel of the current pixel to be extracted and the coordinates of the next pixel to be extracted are written into the G, B, and A channels of the current pixel to be extracted during the watermarking process, then during the extraction process, the watermark information can be obtained from the pixel value of the R channel of the current pixel to be extracted, and the coordinates of the next pixel to be extracted can be obtained from the pixel values ​​of the G, B, and A channels.

[0094] S308: Determine whether all watermark information in the watermark information queue has been extracted;

[0095] In step S308, each time the watermark information extraction step is completed, it can be determined whether all the watermark information in the current watermark information queue has been extracted. There are also many specific determination methods. For example, in some scenarios, if the length of the watermark is fixed, for example, it is 20 characters, then it can be determined whether the number of characters currently extracted is 20. If so, it is determined that the watermark extraction is complete. In some scenarios, considering that the last pixel to be written does not need to write the coordinates of the next pixel to be written, an end marker can also be written in the pixel where the last watermark information is written. The end marker is used to indicate that the watermark writing is complete. Therefore, during the extraction process, if the end marker is extracted, it can be determined that the watermark information extraction is complete.

[0096] S310: If no, then obtaining the next pixel to be extracted from the target image based on the coordinates of the next pixel to be extracted, taking the next pixel to be extracted as the current pixel to be extracted, and returning to the step of performing watermark information extraction;

[0097] In step S310, if it is determined that the watermark information has not been extracted, the next pixel to be extracted can be obtained from the target image based on the coordinates of the next pixel to be extracted, and the next pixel to be extracted is used as the current pixel to be extracted, and the step of performing watermark information extraction is returned.

[0098] S312: If yes, determine that the watermark extraction is completed.

[0099] In step S312, if it is determined that the watermark information has not been extracted, it is determined that the watermark extraction is completed.

[0100] In some embodiments, the watermark information queue includes watermark length information and each character in the watermark. The watermark information extracted from the starting pixel to be extracted is the watermark length information. When determining whether all watermark information in the watermark information queue has been extracted, it can be determined whether the watermark length composed of the currently extracted characters is consistent with the length indicated by the watermark length information. If they are consistent, it is considered that all watermark information in the watermark information queue has been extracted. If the watermark length composed of the currently extracted characters is less than the length indicated by the watermark length information, it is considered that all watermark information in the watermark information queue has not been extracted. That is, when writing watermark information, the watermark length information can be written to the starting pixel to be written, so that during the extraction process, the watermark length information can be extracted first, and whether the watermark extraction is complete can be determined based on the watermark length information.

[0101] In some embodiments, when determining whether a target image is watermarked, a target pixel can be determined from the target image based on a preset pixel determination rule, and then a specified watermark identifier is extracted from a specified pixel channel of the target pixel, and then it is determined that the target image is watermarked.

[0102] The designated pixel channel may be a pixel channel in the carrier image. For example, if the carrier image is an RGBA image, the designated pixel channel may be the R channel or the A channel. In some embodiments, considering that the R, G, and B channels are used to represent the color value of a pixel, and the A channel is used to represent the transparency of a pixel, replacing the pixel value of the A channel has little effect on the overall display effect of the carrier image. Therefore, the designated pixel channel may be the A channel.

[0103] In some embodiments, when extracting the watermark information in the watermark information queue representing the watermark and the coordinates of the next pixel to be extracted from the pixel value of the current pixel to be extracted, the pixel value of the first pixel channel of the current pixel to be extracted may be used as the watermark information, the pixel values ​​of a portion of the second pixel channel of the current pixel to be extracted may be used as the X coordinate of the next pixel to be extracted, and the pixel values ​​of another portion of the second pixel channel of the current pixel to be extracted may be used as the Y coordinate of the next pixel to be extracted, where the first pixel channel is different from the second pixel channel.

[0104] The first pixel channel and the second pixel channel are different channels of pixels in the target image, and both the first pixel channel and the second pixel channel can be one or more pixel channels.

[0105] The specific type and quantity of the first pixel channel and the second pixel channel can be flexibly set based on the format of the target image. For details, please refer to the description of the watermark adding process, which will not be repeated here.

[0106] For example, if the target image is an image in RGBA format, the first pixel channel can be R and G channels, and the second pixel channel can be B channel and A channel. The pixel values ​​of the R and G channels can be used as watermark information, the pixel value of the B channel in the B channel and A channel can be used as the X coordinate of the next pixel to be extracted, and the pixel value of the A channel in the B channel and A channel can be used as the Y coordinate of the next pixel to be extracted.

[0107] In some embodiments, the target image is an image in RGBA format, the first pixel channel is the R channel, and the second pixel channels are the G channel, the B channel, and the A channel. The first half of the pixel values ​​of the G channel, the B channel, and the A channel is the X coordinate of the next pixel to be extracted, and the second half is the Y coordinate of the next pixel to be extracted.

[0108] For example, in some embodiments, if it is determined that a watermark is added to the target image, the starting pixel of the watermark information in the queue of watermark information to be extracted can be determined from the target image as the current pixel (i.e., the current pixel to be extracted). Then, the watermark information extraction step is performed: the pixel value of the first pixel channel of the current pixel is used as the watermark information to be extracted, and the pixel value of the second pixel channel of the current pixel is used as the coordinate information of the next pixel (i.e., the next pixel to be extracted); wherein the first pixel channel is different from the second pixel channel, and the current pixel and the next pixel are discretely distributed in the target image. If all watermark information in the watermark information queue has not been extracted, the next pixel is obtained from the target image based on the coordinate information of the next pixel, and the next pixel is used as the current pixel, and the process returns to the watermark information extraction step.

[0109] In some embodiments, the watermark information, the coordinates of the next pixel to be extracted, and the pixel value of the current pixel to be extracted are represented by a binary code, and the binary code of the pixel value of the current pixel to be extracted is recorded by multiple bits; when extracting the watermark information in the watermark information queue representing the watermark and the coordinates of the next pixel to be extracted from the pixel value of the current pixel to be extracted, information recorded by a first bit of the multiple bits can be extracted as the watermark information, information recorded by a portion of a second bit of the multiple bits can be extracted as the X coordinate of the next pixel to be extracted, and information recorded by another portion of the second bit of the multiple bits can be extracted as the Y coordinate of the next pixel to be extracted, wherein the first bit is different from the second bit.

[0110] For example, taking the target image in RGBA format as an example, the first bit can be the bit representing the R channel pixel value (i.e. 8 bits), and the second bit can be the bit representing the G, B, and A channel pixel values, 24 bits. The information of the first bit can be used as watermark information, the first 12 bits of the second bit can be used as the X coordinate value of the next pixel to be extracted, and the last 12 bits can be used as the Y coordinate value of the next pixel to be extracted.

[0111] The watermark adding method and the watermark extracting method of the present application are introduced below with reference to a specific embodiment.

[0112] The process of adding a watermark is as follows:

[0113] (1) The text watermark is stored in a one-dimensional array in the form of ASCII code value, to be written into the carrier image.

[0114] (2) Obtain the resolution of the carrier image, such as Figure 2 As shown, the image resolution width and height can be divided into three equal parts, and the 1st and 2nd points are obtained respectively, forming four (X, Y) points, assuming that there are 4 pixel points P1, P2, P3, and P4 in total.

[0115] (3) Assuming the carrier image is an RGBA format image, the pixel values ​​of the four pixel channels R, G, B, and A are each represented by one byte (i.e., 8 bits). The pixel values ​​of the A channel of P1, P2, and P3, a total of 3 bytes, are replaced with watermark identification information. The watermark identification information can be freely customized, for example, adding "I" to P1, "H" to P2, and "K" to P3. The watermark identification information can be used to identify that the carrier image has been watermarked according to the watermarking method of this scheme.

[0116] (4) Replace the pixel value of the R channel of P4 with the watermark length, and replace the pixel values ​​of the G, B, and A channels with the (X, Y) coordinates of the first character of the watermark. Figure 4 The figure below shows a binary representation of the pixel values ​​of the G, B, and A channels, totaling three bytes. Since a byte can represent a maximum of 255 digits, coordinate points cannot cover common 1K and 2K resolutions. Therefore, the three bytes are represented in binary, totaling 24 bits, with 12 bits allocated for X and 12 bits for Y. This allows for images with at least 4K resolution, meeting common image resolutions.

[0117] Use random numbers to generate the X coordinate using Range (1, wide image resolution) and the Y coordinate using Range (1, high image resolution), completing the coordinate construction of the first character of the watermark. Since random numbers are discrete, the previous and next coordinates are guaranteed to be discrete, and the P4 point information is written.

[0118] (5) Take out the first character in the array storing the ASCII code of the watermark information in order, find the pixel corresponding to the (X, Y) point in the image according to the P4 coordinate, and replace the pixel value of the R channel with the first character. And continue to generate new coordinates according to the coordinate generation method in step (4) as the coordinates of the pixel for storing the next character after the first character. Repeat the above steps until all the watermark information is written into the image pixel space. Taking the watermark SUISEN as an example, the watermark information written in the carrier image is as follows Figure 5 shown.

[0119] (6) Watermark extraction (i.e., tracing the source) is the reverse process of the above-mentioned adding process. First, you can follow the above steps to obtain points P1, P2, and P3 in the image, check the watermark identification information, and after confirming that the image includes the watermark identification information, you can obtain point P4, obtain the watermark length, and the coordinates of the first character of the watermark. Based on the coordinates of the first character, find the coordinates for storing the first character of the watermark and the next character, and extract each character in turn until all characters are extracted.

[0120] Optionally, the security of the watermark information can be further enhanced by encrypting the watermark information with a public key and performing Base64 encoding before writing it into the image.

[0121] The watermark adding method and extraction method provided by the present application example have the following advantages:

[0122] (1) By randomly acquiring pixel points in the image and writing watermark information, the characters in the watermark are randomly distributed in the image, and the coordinates of the pixel storing the next watermark character can only be obtained after knowing the coordinates of the pixel storing the previous watermark character. Even if the attacker knows that there is watermark information in the image, he cannot obtain or modify the watermark information, which greatly improves the security of the image.

[0123] (2) The pixel points in the image are obtained by random selection and the watermark information is written. The location information of the watermark written in the same image is also different. Criminals cannot confirm the watermark writing logic and information through multiple images in an exhaustive manner, reducing the possibility of being identified and cracked.

[0124] (3) Compared with the common watermark writing method, which writes data sequentially in the area, it is easy for criminals to use the block interception test method to remove the watermark. This method innovatively uses the random point selection method to obtain the pixel points in the image and write the watermark information. The watermark information is located at different positions in the area, and criminals cannot completely remove it.

[0125] (4) Only a single pixel is modified in a small area. The watermark information appears as RBGA color dots on the image, making it difficult for the user to confirm the existence of the watermark with the naked eye. Compared with plain text watermarks, it reduces image obstruction while achieving the purpose of hiding the watermark information to the greatest extent.

[0126] (5) The watermark information is written into the image pixels. When the device actively takes screenshots / records the screen / takes photos, or when criminals use third-party software to take screenshots, the watermark information will be captured when the screenshot is taken, as the watermark is written onto the image that is finally rendered on the screen. This can counter the screenshot mechanism, ensure that the watermark information is not lost due to the screenshot, and ensure the robustness of the watermark.

[0127] Among them, the solutions of the above embodiments can be freely combined to obtain new solutions when there is no conflict. Due to space constraints, they will not be listed one by one here.

[0128] In addition, an embodiment of the present disclosure further provides a computer program product, which includes a computer program. When the computer program is executed, the method mentioned in any of the above embodiments is implemented.

[0129] In addition, the present disclosure also provides an electronic device, such as Figure 6 As shown, the electronic device 60 includes a processor 61, a memory 62, and computer instructions stored in the memory 62. When the processor 61 executes the computer instructions, the method mentioned in any of the above embodiments is implemented.

[0130] Accordingly, an embodiment of this specification further provides a computer storage medium, wherein the storage medium stores a program, and when the program is executed by a processor, the method in any of the above embodiments is implemented.

[0131] The embodiments of this specification may take the form of a computer program product implemented on one or more storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing program code. Computer-usable storage media include permanent and non-permanent, removable and non-removable media, and may be implemented using any method or technology to store information. Information may be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include but are not limited to: phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device.

[0132] For the device embodiments, since they basically correspond to the method embodiments, the relevant parts can be referred to the partial description of the method embodiments. The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. A person of ordinary skill in the art can understand and implement it without expending creative work.

[0133] The user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0134] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. The terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device that includes a series of elements includes not only those elements, but also other elements that are not explicitly listed, or also includes elements that are inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a..." does not exclude the presence of other identical elements in the process, method, article or device that includes the element.

[0135] The above is a detailed introduction to the methods and devices provided in the embodiments of the present invention. Specific examples are used herein to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the methods and core ideas of the present invention. At the same time, for those skilled in the art, according to the ideas of the present invention, there may be changes in the specific implementation methods and application scopes. In summary, the contents of this specification should not be understood as limiting the present invention.

Claims

1. A blind watermarking method based on discrete selection of image pixels, characterized in that: The method comprises: Obtain the first watermark information in the watermark information queue as the current watermark information according to the set order; Determine the starting pixel to be written with watermark information from the carrier image as the current pixel; randomly determining coordinate information of a next pixel in the carrier image based at least on coordinate information of a current pixel, the current pixel and the next pixel being discretely distributed in the carrier image; Adjusting the pixel value of the current pixel based on the coordinate information of the next pixel and the current watermark information as follows: replacing a pixel value of a first pixel channel of the current pixel with the current watermark information, and replacing a pixel value of a second pixel channel of the current pixel with the coordinate information of the next pixel, the first pixel channel being different from the second pixel channel, so that the pixel values ​​of at least two pixel channels of the current pixel represent the coordinate information of the next pixel and the current watermark information; If the current watermark information is not the last watermark information, then according to the set order, the next watermark information of the current watermark information in the watermark information queue is used as the current watermark information, the next pixel is used as the current pixel, and the coordinate information based on the current pixel is returned, and the coordinate information of the next pixel is randomly determined in the carrier image.

2. The method according to claim 1, characterized in that The current watermark information, the coordinate information of the next pixel, and the pixel value of the current pixel are represented by binary code; The replacing the pixel value of the first pixel channel of the current pixel with the current watermark information, and replacing the pixel value of the second pixel channel of the current pixel with the coordinate information of the next pixel, includes: The binary code of the pixel value of the first pixel channel is replaced by the binary code of the current watermark information, and the binary code of the pixel value of the second pixel channel of the current pixel is replaced by the binary code of the coordinate information of the next pixel.

3. The method according to claim 1, characterized in that The carrier image is an image in RGBA format, the first pixel channel is the R channel, and the second pixel channels are the G channel, the B channel, and the A channel; and / or The watermark includes multiple characters, and the type of each watermark information in the watermark information queue includes any one of the following: a character in the watermark, and watermark length information.

4. The method according to claim 3, characterized in that The method further includes: determining a target pixel from the carrier image based on a preset pixel determination rule; and writing watermark identification information into a designated pixel channel of the target pixel, wherein the watermark identification information is used to indicate that the carrier image carries a watermark.

5. The method according to claim 1, wherein The coordinate information of the next pixel is generated based on the following method: obtaining the resolution of the carrier image; randomly generating an X coordinate value of the coordinate of the next pixel based on the resolution of the carrier image in the width direction, so that the X coordinate value does not exceed the value corresponding to the resolution in the width direction; and randomly generating a Y coordinate value of the coordinate of the next pixel based on the resolution of the carrier image in the height direction, so that the Y coordinate value does not exceed the value corresponding to the resolution in the height direction. and / or The watermark information in the watermark information queue is watermark information obtained through encryption processing.

6. The method according to claim 1, characterized in that Randomly determining the coordinate information of a next pixel in the carrier image based at least on the coordinate information of a current pixel, including: randomly determining a pixel in the carrier image, and if it is determined, based on the coordinate information of the current pixel and the coordinate information of a pixel currently having watermark information written thereto, that a degree of discreteness between the pixel and the current pixel, and between the pixel and the pixel currently having watermark information written thereto, is greater than a preset degree of discreteness, using the coordinate information of the pixel as the coordinate information of the next pixel; and / or The number of the first pixel channels and the second pixel channels is determined based on the data volume of the watermark information, wherein, if the carrier image is an image in RGBA format, the first pixel channels and the second pixel channels include at least the A channel.

7. A blind watermark extraction method based on discrete selection of image pixels, characterized in that: The method comprises: When it is determined that the target image is watermarked, determining the starting pixel of the watermark information in the queue of watermark information to be extracted from the target image as the current pixel; wherein the watermark in the target image is added by the blind watermarking method based on discrete selection of image pixels according to any one of claims 1 to 6; executing a watermark information extraction step: using a pixel value of a first pixel channel of the current pixel as the watermark information, and using a pixel value of a second pixel channel of the current pixel as coordinate information of a next pixel; wherein the first pixel channel is different from the second pixel channel, and the current pixel and the next pixel are discretely distributed in the target image; If all watermark information in the watermark information queue has not been extracted, the next pixel is obtained from the target image based on the coordinate information of the next pixel, and the next pixel is used as the current pixel, and the process returns to the step of performing watermark information extraction.

8. The method according to claim 7, characterized in that The watermark information queue includes watermark length information and each character in the watermark, and the watermark information extracted from the starting pixel is the watermark length information. If the length of the watermark composed of the currently extracted characters is less than the length indicated by the watermark length information, it is determined that all watermark information in the watermark information queue has not been extracted; and / or The determining that the target image is watermarked includes: determining target pixels from the target image based on a preset pixel determination rule; In the case that a designated watermark identifier is extracted from the designated pixel channel of the target pixel, it is determined that the target image is added with a watermark.

9. The method according to claim 7, characterized in that The watermark information, the coordinate information of the next pixel, and the pixel value of the current pixel are represented by binary code; The step of using the pixel value of the first pixel channel of the current pixel as the watermark information and using the pixel value of the second pixel channel of the current pixel as the coordinate information of the next pixel includes: The binary code of the pixel value of the first pixel channel of the current pixel is used as the binary code of the watermark information, and the binary code of the pixel value of the second pixel channel of the current pixel is used as the binary code of the coordinate information of the next pixel.

10. A computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the method according to any one of claims 1 to 9 when executed.

Citation Information

Patent Citations

  • Method for adding and extracting screenshot blind watermark in memory

    CN117132442A

  • Image pixel watermark embedding method, image pixel watermark tracing method, image pixel watermark embedding system, image pixel watermark tracing system and electronic equipment

    CN118840246A