Method for embedding watermark in video, device, computer program product and storage medium
Patent Information
- Application Number
- PCT/IB2024/062388
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-03-07
- Filing Date
- 2024-12-09
- Publication Date
- 2025-10-02
AI Technical Summary
In existing video watermarking technologies, the way of embedding watermarks causes visually significant effects, affects user perception, and has insufficient embedding efficiency.
A random search method is used to find watermark embedding locations in video frames that meet the preset texture complexity requirements, and watermarks are embedded in these locations. By adjusting the pixel values to weaken the visual significant effect, the selection of watermark embedding locations is optimized by combining the continuity between video frames and the texture complexity of the background area.
The efficiency of watermark embedding is improved, the visual effect is weakened, the watermark is difficult to be detected during video playback, and the embedding efficiency and concealment of watermarks in videos are improved.
Smart Images

Figure IB2024062388_02102025_PF_FP_ABST
Abstract
Description
[0001]A Method, Apparatus, Computer Program Product, and Storage Medium for Embedding Watermarks in Videos. This disclosure claims priority to a Chinese patent application filed with the Patent Office of the People's Republic of China on March 7, 2024, with application number 202410263698.X, entitled "A Method, Apparatus, Computer Program Product, and Storage Medium for Embedding Watermarks in Videos," the entire contents of which are incorporated herein by reference. Technical Field: This disclosure relates to the field of video processing technology, and more particularly to a method, apparatus, computer program product, and storage medium for embedding watermarks in videos. Background: Video watermarking technology is a method for adding identification to videos, which can be used to protect videos from copyright, brand promotion, and anti-piracy perspectives. Currently, video watermarking typically embeds watermarks in the form of a dynamic floating window overlaid on the video. While this embedding method can achieve video identification, the floating window-like watermark creates an excessively prominent visual effect, affecting the user's perception of the video. Some watermark embedding methods have proposed solutions to reduce visual prominence, but these solutions generally require very complex processing logic and result in insufficient embedding efficiency. SUMMARY OF THE INVENTION Various aspects of the present disclosure provide a method, device, computer program product, and storage medium for embedding watermarks in videos, to improve the efficiency of video watermark embedding and / or reduce visual prominence. The present disclosure provides a method for embedding watermarks in videos, comprising: obtaining a target watermark to be embedded in a target video in response to a watermark embedding instruction; searching, in a random search manner, each video frame included in the target video for a watermark embedding location that meets a preset texture complexity requirement; and embedding the target watermark in the corresponding video frame based on the searched watermark embedding location. Furthermore, the method further comprises: determining not to embed the watermark in the video frame if, after performing the random search more than a preset threshold number of times in any video frame of the target video, no watermark embedding location that meets the preset texture complexity requirement has been found, determining not to embed the watermark in the video frame. Furthermore, the method further includes: for any non-first video frame in the target video, determining the watermark embedding position in the previous video frame as the starting search position for a random search in the non-first video frame. Furthermore, the method further includes: detecting whether the target watermark has remained at the watermark embedding position in the previous video frame of the non-first video frame for more than a preset number of frames; if not, determining the watermark embedding position in the previous video frame as the starting search position for the random search in the non-first video frame; if exceeded, randomly selecting a starting search position in the non-first video frame.Furthermore, the method further includes: for any search location determined in any video frame of the target video, dividing the search location into multiple blocks; calculating the texture complexity of each of the multiple blocks; and determining that the search location meets the preset texture complexity requirement if the texture complexity of each of the multiple blocks exceeds a preset complexity threshold. Furthermore, calculating the texture complexity of each of the multiple blocks includes: for any block, calculating a pixel variance value for the block to represent the texture complexity of the block; wherein the pixel variance value is equal to the sum of the squares of the differences between each pixel in the block and the pixel mean of the block. Furthermore, embedding the target watermark in the corresponding video frame according to the searched watermark embedding location includes: for any video frame in the target video, determining a pixel point to be processed for presenting the target watermark in the corresponding watermark embedding location; and adjusting the pixel value of each pixel point to be processed so that the adjusted pixel value of each pixel point to be processed approaches the same target pixel value, thereby completing the embedding of the target watermark. Furthermore, the pixel value of each pixel to be processed is adjusted so that the adjusted pixel value of each pixel to be processed approaches the same target pixel value, including: for any pixel to be processed, multiplying the difference between the original pixel value of the pixel to be processed and the target pixel value by a preset coefficient to obtain the watermark embedding strength corresponding to the pixel to be processed; and using the difference between the original pixel value and the watermark embedding strength, or the difference between the watermark embedding strength and the target pixel value, as the adjusted pixel value of the pixel to be processed, so that the adjusted pixel value approaches the target pixel value. Furthermore, determining the pixel point to be processed for presenting the target watermark in its corresponding watermark embedding position includes: pixel-aligning the target watermark with the watermark embedding position; if the binary code of the pixel point aligned with the target pixel point in the target watermark embedding position is 1, determining the target pixel point as the pixel point to be processed; wherein the binary code of the pixel point for presenting the watermark content in the target watermark is 1, and the binary code of other pixel points is Oo. Further, the method also includes: in the case where the target watermark needs to be added during the playback of the target video, searching for the watermark embedding position for each video frame in the target video in turn and completing the embedding of the target watermark before the corresponding video frame is played; if the watermark embedding position is not found in any video frame, skipping the video frame without embedding the watermark therein. The present disclosure also provides a method for embedding a watermark in an image, comprising: obtaining a target watermark to be embedded in a target image in response to a watermark embedding instruction; searching the target image for a watermark embedding position that meets a preset texture complexity requirement in a random search manner; and embedding the target watermark in the target image according to the searched watermark embedding position.Embodiments of the present disclosure also provide a computing device comprising a memory, a processor, and a communication component; the memory is configured to store one or more computer instructions; and the processor is coupled to the memory and the communication component and configured to execute the one or more computer instructions to perform the aforementioned method for embedding a watermark in a video or a method for embedding a watermark in an image. Embodiments of the present disclosure also provide a computer-readable storage medium storing a computer program. When the computer program is executed by one or more processors, it causes the one or more processors to perform the aforementioned method for embedding a watermark in a video or a method for embedding a watermark in an image. Embodiments of the present disclosure also provide a computer program product comprising the computer program. When the computer program is executed by one or more processors, it causes the one or more processors to perform the aforementioned method for embedding a watermark in a video or a method for embedding a watermark in an image. Embodiments of the present disclosure also provide a computer program, wherein the computer program is executed by one or more processors to perform the aforementioned method for embedding a watermark in a video or a method for embedding a watermark in an image. In embodiments of the present disclosure, a scheme for embedding a watermark in a video is proposed. A random search method is used to search for watermark embedding locations that meet preset texture complexity requirements in each frame of a target video. In this way, on the one hand, random search can more efficiently identify watermark embedding locations, eliminating the need for global position traversal of video frames. On the other hand, the identified watermark embedding locations have complex textures, making watermark embedding at such locations imperceptible to the human eye. Based on these two aspects, this embodiment can more efficiently search for watermark embedding locations in target video frames that are insensitive to the human eye, thereby improving the efficiency of watermark embedding in videos and effectively reducing visually noticeable effects. In particular, in video playback scenarios, it can support real-time embedding of watermarks that are imperceptible to the human eye in playing videos. BRIEF DESCRIPTION OF THE DRAWINGS The drawings described herein are provided to provide a further understanding of the present disclosure and constitute a part of this disclosure. The illustrative embodiments of this disclosure and their description are intended to explain the disclosure and are not intended to unduly limit the disclosure.In the accompanying drawings: Figure 1 is a flowchart of a method for embedding a watermark in a video, provided by an exemplary embodiment of the present disclosure; Figure 2 is a schematic diagram of a watermark embedding position, provided by an exemplary embodiment of the present disclosure; Figure 3 is a flowchart of an improved solution for determining a starting search position for a random search, provided by an exemplary embodiment of the present disclosure; Figure 4 is a flowchart of an exemplary implementation of evaluating whether a selected search position meets a preset texture complexity requirement, provided by an exemplary embodiment of the present disclosure; Figure 5 is a flowchart of a method for embedding a watermark in an image, provided by another exemplary embodiment of the present disclosure; and Figure 6 is a schematic diagram of the structure of a computing device, provided by yet another exemplary embodiment of the present disclosure. DETAILED DESCRIPTION To further clarify the objectives, technical solutions, and advantages of the present disclosure, the technical solutions of the present disclosure will be described clearly and completely below in conjunction with the specific embodiments of the present disclosure and the corresponding drawings. Obviously, the described embodiments are only some of the embodiments of the present disclosure, and are not exhaustive. All other embodiments derived by persons of ordinary skill in the art based on the embodiments of the present disclosure without inventive effort are within the scope of protection of the present disclosure. Before describing in detail the technical solutions provided by the various embodiments of the present disclosure, several technical concepts involved in the present disclosure are explained below. Video watermarking technology is a method for adding identifiers to videos. The identifiers added are called watermarks. Watermarks, also known as digital watermarks, are typically specific digital codes or information added to media files (such as videos or images). Their purpose is to provide an invisible protection mechanism for digital content without affecting the media content. As mentioned in the background, the current method for embedding watermarks in videos is to overlay the watermark on the video screen in the form of a dynamic floating window. Visually, users can see the watermark move according to a certain pattern on the video screen. For example, the watermark first floats in the upper left corner of the video screen for one minute, then moves to the lower right corner of the video screen and continues to float for another minute, then returns to the upper left corner of the video screen and repeats. This certainly achieves the goal of video identification. However, the human eye is highly sensitive to this dynamic floating window. Therefore, the watermark in the video is visually conspicuous to users, which can affect their perception of the video. During their research, the inventors discovered that several solutions have been proposed to address the visual conspicuity issue associated with embedding watermarks in videos. These include adjusting the watermark's transparency or integrating it with the full video frame using complex algorithms. However, these solutions require significant processing time, resulting in inefficient watermark embedding.To this end, this embodiment proposes a method for embedding a watermark in a video to improve the efficiency of watermark embedding and / or reduce the visually significant effect. The technical solutions provided by various embodiments of the present disclosure are described in detail below, in conjunction with the accompanying drawings. Figure 1 is a flow chart illustrating a method for embedding a watermark in a video, provided by an exemplary embodiment of the present disclosure. The method can be performed by a video processing device, which can be implemented as software, hardware, or a combination of software and hardware. The video processing device can be integrated into a computing device. Referring to Figure 1, the method may include: Step 100: Responding to a watermark embedding instruction, obtaining a target watermark to be embedded in a target video; Step 101: Searching, in a random search manner, for a watermark embedding location in each video frame included in the target video that meets a preset texture complexity requirement; Step 102: Embedding the target watermark in the corresponding video frame according to the searched watermark embedding location. In this embodiment, the target video can be any video in which a watermark is to be embedded. The target watermark can also be any watermark to be embedded. In step 100, the watermark embedding instruction may specify the target watermark to be embedded. Thus, in step 100, upon receiving the watermark embedding instruction for the target video, the target watermark to be embedded in the target video can be obtained. It should be understood that in step 100, both the target video and the target watermark are input into the video processing device provided in this embodiment for processing. Accordingly, the video processing device in this embodiment may output the target video after the watermark is embedded. In this embodiment, there are no restrictions on the content and specifications of the target watermark, nor on the file format of the target watermark. This embodiment supports converting watermarks in various file formats into a unified format for subsequent embedding. This unified format may be a binary encoding format, for example. In this exemplary format, the binary code for pixels representing the watermark content in the target watermark is 1, and the binary code for other pixels is 0. Continuing with Figure 1, in step 101, a random search can be performed within each video frame of the target video to search for a watermark embedding location that meets the preset texture complexity requirement. The process for searching for a watermark embedding location within each video frame is similar. For ease of description, the random search process will be described below using one video frame as an example. It should be understood that the video frame can be any frame in the target video. In step 101, a random search can be performed within the video frame, without performing a traversal search of the entire video frame. The random search can be understood as randomly selecting a search location within the video frame and evaluating whether the search location is suitable as a watermark embedding location.Figure 2 is a schematic diagram of a watermark embedding location provided by an exemplary embodiment of the present disclosure. Referring to Figure 2, the watermark embedding location in this embodiment essentially refers to an image region within the video frame that matches the specifications of the target watermark. For example, referring to Figure 2, if the target watermark has a size of 40*120, then the watermark embedding location searched within the video frame will also have a size of 40*120. In practical applications, an exemplary random search scheme may include: selecting a random pixel location (pixel coordinates are x, y) within the video frame; using this random pixel location as the origin, and selecting an image region within the video frame that matches the specifications of the target watermark as a search location. For example, the top left vertex of the image region may be set as the origin. In this way, the search location within the video frame is selected using this random pixel location as the top left vertex. Of course, this is merely an exemplary origin setting method, and the present embodiment is not limited to this. During their research, the inventors discovered that using a random search approach has a high probability of finding the watermark embedding location after just a few search operations. Therefore, compared to a traversal search, this approach can significantly reduce search time and effectively improve the efficiency of searching for watermark embedding locations. In step 101, the selected search location must be further evaluated to see if it meets the preset texture complexity requirement. Texture complexity describes the complexity of texture in an image. Texture can refer to elements in an image that are locally irregular but macroscopically regular. For example, elements with repetitive structures in an image, such as cloth patterns, grass, and brick walls, are typical examples of texture. Further explanation of technical concepts such as texture and texture complexity is omitted here. In step 101, if the current search location meets the preset texture complexity requirement, it can be determined as the watermark embedding location for the video frame. If the current search location does not meet the preset texture complexity requirement, the next search location can be selected and evaluated for its suitability as a watermark embedding location. This embodiment also proposes that, in practical applications, it is not necessary to determine a watermark embedding location for every frame in the target video. During research, the inventors discovered that video frames are continuous and their presentation time is very short. Therefore, not embedding the watermark in a small number of frames does not affect the watermark's ability to identify the target video. Therefore, this embodiment proposes a preferred implementation scheme: if the number of random searches in any frame of the target video exceeds a preset threshold and no watermark embedding location that meets the preset texture complexity requirement is found, then the watermark is not embedded in the video frame.This preferred implementation proposes limiting the number of random searches within video frames to a reasonable preset threshold. This threshold can be set based on actual needs. In practical applications, users can also modify this threshold as needed. For example, if a user desires higher watermark embedding efficiency, the threshold can be lowered; if a user desires to increase the proportion of watermark-embedded video frames, the threshold can be raised. Thus, in this preferred implementation, the watermark embedding location selection process for each target video frame does not consume excessive time, effectively ensuring the efficiency of the watermark embedding location selection process and, therefore, improving watermark embedding efficiency. Furthermore, using texture complexity as the basis for selecting the watermark embedding location ensures that the watermark embedding locations determined in step 101 all have complex textures. The inventors discovered during their research that, in practical applications, the watermark embedding locations determined based on the technical concept of step 101 are often located in the background area of the video frame. This is primarily due to the high texture complexity of background areas. This allows the watermark embedded in this embodiment to be hidden in the background area of the video frame. The human eye is relatively insensitive to texture details in background areas, making a watermark embedded in the background area difficult to detect. It can be seen that the two design concepts proposed in step 101 of this embodiment not only improve the efficiency of determining the watermark embedding location in the video frame, but also provide the advantage of making the determined watermark embedding location difficult to detect. Based on this, referring to Figure 1 , in step 102, the target watermark can be embedded in the corresponding video frame according to the searched watermark embedding location. It should be understood that, as mentioned above, this embodiment allows for some frames in the target video to not be watermarked. Therefore, in step 102, the target watermark may not be embedded in the video frames for which the watermark embedding location was not searched in step 101. In summary, this embodiment proposes a watermark embedding scheme for video. This scheme employs a random search approach to search for watermark embedding locations that meet preset texture complexity requirements within each frame of the target video. This approach not only more efficiently locates watermark embedding locations through random search, but also eliminates the need for a global position traversal of all video frames. Furthermore, the watermark embedding locations found have complex textures, making them imperceptible to the human eye. Based on these two aspects, this embodiment more efficiently locates watermark embedding locations within the target video frames that are insensitive to the human eye, thereby improving the efficiency of watermark embedding and effectively reducing visually significant effects.In particular, in video playback scenarios, it is possible to support real-time embedding of watermarks that are imperceptible to the human eye into the playing video. In the above and following embodiments, the inventors discovered during research that in some application scenarios, it may be necessary to sequentially embed watermarks in each frame of the target video, such as during video playback. To further improve the efficiency of watermark embedding in such application scenarios, this embodiment proposes a preferred implementation of step 101 as follows: For any non-first video frame in the target video, the watermark embedding position in the previous video frame is determined as the starting position for a random search among non-first video frames. Non-first video frames refer to video frames following the first video frame in the target video. It is understood that for the first video frame in the target video, its corresponding suggested search position can be randomly selected. This preferred implementation proposes that, for non-first video frames, a priority determination be made as to whether the watermark embedding position in the previous video frame can be inherited and used. During their research, the inventors discovered that video frames have content correlations, particularly in the background area, which may not show significant positional changes across multiple consecutive video frames. Therefore, by inheriting the watermark embedding position from the previous video frame in a non-first video frame as the starting search position, the watermark embedding position can be found with a high probability on the first search. This is because the inherited starting search position is likely to have complex textures and meet the preset texture complexity requirements. This effectively reduces the number of random searches performed in non-first video frames, further improving the efficiency of watermark embedding position selection. Furthermore, it should be understood that if the inherited starting search position in a non-first video frame does not meet the preset texture complexity requirements, the next search position can be randomly selected and evaluated for compliance with the preset texture complexity requirements until the number of random searches is exhausted or a watermark embedding position that meets the preset texture complexity requirements is found. During their research, the inventors discovered that a watermark that remains in a fixed position for too long may be noticeable to the human eye. This is because the video image constantly changes while the watermark remains in a fixed position, which can cause the human eye to focus on the watermark's position and perceive it. To address this issue, this embodiment also proposes a further improved solution. Figure 3 is a flow chart of an improved solution for determining the starting search position for a random search, provided in this embodiment.Referring to Figure 3, this improved solution may include: Step 300: Detecting whether the target watermark has remained at the watermark embedding position in the previous video frame of a non-first video frame for more than a preset number of consecutive frames; if not, executing Step 301; if so, executing Step 302; Step 301: Determining the watermark embedding position in the previous video frame as the starting position for a random search in the non-first video frame; Step 302: Randomly selecting a starting search position in the non-first video frame. Reference is made to the previous description of Step 301 and will not be repeated here. This improved solution can be understood as adding a step to determine whether a starting search position should be selected for the non-first video frame through inheritance. Referring to Figure 3, Step 300 proposes that, for non-first video frames, the number of consecutive frames used by the watermark embedding position in the previous video frame may be detected. In practical applications, a counter may be introduced to record the number of consecutive frames used by each watermark embedding position found in the target video. The number of consecutive frames refers to the number of frames during which the target watermark remains at the watermark embedding location, that is, the number of consecutive frames during which the same watermark embedding location is used. The preset number of frames in step 300 can be set as needed and supports user customization. For example, if a user desires higher embedding efficiency, the preset number of frames can be set to a larger value; if a user desires a less perceptible watermark, the preset number of frames can be set to a smaller value. Continuing with Figure 3, different detection results obtained in step 300 will trigger different logical branches. If step 300 detects that the target watermark has remained at the watermark embedding location in the video frame preceding the non-first video frame for more than the preset number of frames, step 301 is executed to obtain the starting search location through inheritance. If step 300 detects that the target watermark has remained at the watermark embedding location in the video frame preceding the non-first video frame for less than the preset number of frames, step 302 is executed to obtain the starting search location through random selection. For example, for the 8th frame in the target video, if it is detected that the number of consecutively used frames counted for the watermark embedding position in the 7th frame is 7, which does not exceed the preset number of frames 10, then it is determined that the watermark embedding position in the 8th frame can be used as the starting search position; if, after evaluation, the watermark embedding position in the 8th frame does not meet the preset texture complexity requirement, then the next search position will be selected in the 8th frame; if, after evaluation, the newly selected search position meets the preset texture complexity requirement, then the newly selected search position will be determined as the watermark embedding position in the 8th frame.The counter begins counting the number of consecutive frames used for the watermark embedding position in the eighth frame. It is understood that for the ninth frame of the target video, the number of consecutive frames used for the watermark embedding position in the eighth frame is detected to be 1, which does not exceed the preset number of frames (10). Therefore, the watermark embedding position in the eighth frame is used as the starting search position in the ninth frame. In summary, this embodiment proposes an improved solution for selecting watermark embedding positions for non-first video frames in the target video. For non-first video frames, the watermark embedding position in the previous video frame can be preferentially used as the starting search position. This increases the probability of finding the watermark embedding position at the starting search position, thereby improving the efficiency of the watermark embedding position selection process. Furthermore, a limit is proposed on the number of consecutive uses of the same watermark embedding position to prevent the target watermark from remaining at the same watermark embedding position for too long, potentially causing it to be perceived by the human eye. In the above or following embodiments, various implementations can be used to evaluate whether a search location selected in a video frame meets a preset texture complexity requirement. Figure 4 is a flowchart illustrating an exemplary implementation of evaluating whether a search location selected in a video frame meets a preset texture complexity requirement, provided in accordance with an exemplary embodiment of the present disclosure. Referring to Figure 4 , this exemplary implementation may include: Step 400: For any search location determined in any video frame of a target video, divide the search location into multiple blocks; Step 401: Calculate the texture complexity of each of the multiple blocks; Step 402: If the texture complexity of each of the multiple blocks exceeds a preset complexity threshold, determine that the search location meets the preset texture complexity requirement. In this exemplary implementation, the selected search location may be divided into multiple blocks in Step 400. The method for dividing the blocks is not limited herein. For example, the search location may be divided into n*n blocks. Another example is that the search location may be divided into n*m blocks. There are no restrictions on the shape of the divided blocks; for example, the divided blocks can be square or rectangular. Based on this, in step 401, the texture complexity corresponding to each divided block can be calculated. The method for calculating texture complexity is not limited here. In one optional calculation method, the pixel variance value of any block can be calculated to represent the texture complexity of the block. The pixel variance value is equal to the sum of the squares of the differences between each pixel in the block and the pixel mean of the block. In this calculation method, the pixel variance value of the block is used to quantify the texture complexity of the block. It should be understood that this calculation method is merely exemplary and this embodiment is not limited thereto. Other indicators can also be used to quantify the texture complexity of the block, and further examples are not provided here.In this way, the texture complexity of each block divided in the search position can be obtained as a basis for evaluation. Continuing with FIG. 4 , in step 402, it is detected whether the texture complexity of each block in the search position exceeds a preset complexity threshold. The preset complexity threshold can be flexibly set as needed. Based on this, in step 402, if the texture complexity of each block in the search position exceeds the preset complexity threshold, the search position is determined to meet the preset texture complexity requirement; otherwise, the search position is determined to not meet the preset texture complexity requirement. It will be understood that in the exemplary implementation shown in FIG. 4 , the preset texture complexity requirement is set as follows: the texture complexity of each block divided in the search position must exceed the preset complexity threshold. As mentioned above, texture complexity can be used to describe the complexity of texture in an image. Therefore, if the texture complexity of a block exceeds the preset complexity threshold, it can be indicated that the texture within the block is sufficiently complex. If the texture complexity of each block within the search location exceeds the preset complexity threshold, it can be indicated that the texture within each block within the search location is sufficiently complex, and furthermore, it can be indicated that the entire area within the search location has a complex texture. This ensures that the entire area within the watermark embedding location in the video frame has a complex texture, which further ensures that the watermark is not easily perceived by the human eye after embedding, thereby further reducing the video's noticeable effect. It should be understood that in addition to the preferred implementation described above, other implementations can be used in this embodiment to evaluate whether the search location selected in the video frame meets the preset texture complexity requirement, such as calculating whether the overall texture complexity of the search location exceeds a preset complexity threshold. This embodiment is not limited to this. In the above or following embodiments, to further improve watermark embedding efficiency, a preferred implementation scheme for the aforementioned step 102 is proposed as follows: For any video frame in the target video, pixels to be processed for representing the target watermark are determined at the corresponding watermark embedding location; the pixel values of each pixel to be processed are adjusted so that the adjusted pixel values of each pixel approach the same target pixel value, thereby completing the embedding of the target watermark. In this preferred implementation scheme, the video frame can be converted into a grayscale image to obtain the pixel values of each pixel in the video frame. Furthermore, the pixels at the watermark embedding location that are to be used for representing the target watermark can also be determined. It should be understood that the target watermark is also an image containing watermark content. For example, if the target watermark content is text, then in the image, the first type of pixels are used to represent the text, while the second type of pixels are left blank.To this end, this preferred implementation also provides a solution for determining which pixels in the watermark embedding location are used to present the target watermark. In this solution, the target watermark and the watermark embedding location can be pixel-aligned. If the binary code of the target pixel in the watermark embedding location that it aligns with in the target watermark is 1, the target pixel is determined to be a pixel to be processed. Pixels in the target watermark that are used to present the watermark content are binary-coded 1, while other pixels are binary-coded 0. Thus, after the target watermark and the watermark embedding location are aligned, the pixels in the watermark embedding location that align with the first type of pixels in the target watermark that are used to present the watermark content are the pixels to be processed for presenting the target watermark. Accordingly, pixels in the watermark embedding location that align with the second type of pixels in the target watermark that are empty do not require subsequent pixel value adjustment and can retain their original pixel values. Here, the pixel to be processed at the watermark embedding location is used to present the target watermark. This can be understood as the pixel to be embedded with the corresponding watermark content of the target watermark. Based on this, the preferred implementation proposes adjusting the pixel values of each pixel to be processed so that the adjusted pixel values of each pixel approach the same target pixel value to complete the embedding of the target watermark. It should be understood that when adjusting the pixel value of a pixel to be processed, the pixel value is not simply adjusted to the target pixel value, but rather adjusted to a reasonable pixel value close to the target pixel value. This reasonable pixel value not only preserves the original video content presented at the pixel as much as possible, but also covertly presents the corresponding watermark content of the target watermark. To this end, the effective implementation proposes a solution for determining the adjusted pixel value for the pixel to be processed. In this solution, for any pixel to be processed, the difference between the original pixel value and the target pixel value is multiplied by a preset coefficient to obtain the watermark embedding strength corresponding to the pixel. The difference between the original pixel value and the watermark embedding strength, or the difference between the watermark embedding strength and the target pixel value, is used as the adjusted pixel value for the pixel to be processed, so that the adjusted pixel value approaches the target pixel value. The target pixel value can be a value that is imperceptible to the human eye, such as 128. This is merely an example and is not limited to this. Furthermore, the preset coefficient can be set as needed; an exemplary value might be 0.3, for example.This solution proposes calculating the difference between the original pixel value of a pixel to be processed and the target pixel value to characterize the visual difference between the original video content presented at that pixel and the desired content that is less noticeable to the human eye. A certain proportion of this visual difference is used as the watermark embedding strength. Based on this, the original pixel value of that pixel can be adjusted based on the watermark embedding strength. This adjustment allows the pixel value to approach the target pixel value. In other words, the content ultimately presented at that pixel retains the original video content as much as possible while approaching the desired content that is less noticeable to the human eye. In summary, based on the preferred implementation scheme provided in this embodiment, the visual effect after embedding the target watermark in a video frame shows that the pixel values of the pixels representing the target watermark at the watermark embedding location are adjusted, resulting in a lower content continuity compared to other pixels at the watermark embedding location. Therefore, the target watermark content can be displayed. However, the pixel values of each pixel used to represent the target watermark are close to the target pixel values, making the content displayed by these pixels less noticeable to the human eye after adjustment. It can be seen that based on the above preferred implementation scheme, not only can the target watermark be displayed in the video frame, but the displayed target watermark can also be ensured to be less noticeable to the human eye. This can be understood as follows: after the watermark is embedded in the video frame, the target watermark can be seen in the captured video frame through screenshots or photos, and after careful identification. However, during video playback, the video frame playback time is very short, which does not provide the human eye with time to carefully identify it. The pixel values of the relevant pixels in the video frame are adjusted to be close to the target pixel values. Therefore, during video playback, the watermark in the video frame is less noticeable to the human eye. It should be understood that in addition to the preferred implementation scheme described above, other implementation methods may be used in this embodiment to embed the target watermark within the watermark embedding position in the video frame. For example, embedding the target watermark may be implemented using existing algorithms for embedding watermarks in the time domain. Further description of these implementation schemes is omitted here. The application scenarios of the method for embedding watermarks in videos described above and below are not limited. This method can support embedding the target watermark in the target video in offline scenarios. This method can also support embedding the target watermark in the target video in online scenarios. Typical online scenarios include adding the target watermark during the playback of the target video.For online scenarios, this embodiment provides a method for embedding watermarks in videos. It sequentially searches for watermark embedding locations for each frame in the target video and completes watermark embedding before the corresponding frame is played. If the watermark embedding location is not found in any frame, the frame is skipped and no watermark is embedded in it. For relevant technical details, please refer to the descriptions in the previous embodiments and will not be repeated here. In summary, based on the efficiency of this embodiment in selecting watermark embedding locations, the advantage of ensuring imperceptibility to the human eye during watermark embedding location selection, and the efficiency of watermark embedding, it supports real-time watermark embedding in videos. In this way, for online scenarios, watermark embedding can be completed before the corresponding frame is played, without affecting the normal playback of the target video, or some frames can be skipped as needed without watermark embedding. From a user perspective, this does not affect the smoothness of video playback, and the embedded watermark is also imperceptible to the human eye. Figure 5 is a flow chart of a method for embedding watermarks in images, provided by another exemplary embodiment of the present disclosure. This method can be performed by an image processing device, which can be implemented as software, hardware, or a combination of software and hardware. The image processing device can be integrated into a computing device. Referring to Figure 5 , the method may include: Step 500: Responding to a watermark embedding instruction, obtaining a target watermark to be embedded in a target image; Step 501: Searching the target image for a watermark embedding location that meets a preset texture complexity requirement using a random search method; Step 502: Embedding the target watermark in the target image based on the searched watermark embedding location. In this embodiment, the target image can be any image requiring watermark embedding, for example, a video frame within a video or an independent image, and this embodiment is not limited thereto. For the random search step in step 501, reference can be made to the technical details of the random search within the target video frame in the aforementioned embodiment, including calculating texture complexity and selecting search locations. To save space, this will not be repeated here, but this should not compromise the scope of protection of this disclosure. In summary, this embodiment proposes a solution for embedding watermarks in images. This solution employs a random search approach to search for watermark embedding locations within a target image that meet preset texture complexity requirements. This approach not only efficiently locates watermark embedding locations through random search, but also eliminates the need for a global position traversal of the target image. Furthermore, the watermark embedding locations found have complex textures, making them less noticeable to the human eye.Based on these two aspects, this embodiment can more efficiently search for watermark embedding locations in the target image that are insensitive to the human eye, thereby improving the efficiency of watermark embedding in the image and effectively reducing visually significant effects. It should be noted that some of the processes described in the above embodiments and accompanying figures include multiple operations that appear in a specific order. However, it should be understood that these operations may be executed in a different order or in parallel. Operation numbers such as 101 and 102 are merely used to distinguish between different operations and do not represent any specific execution order. Furthermore, these processes may include more or fewer operations, and these operations may be executed sequentially or in parallel. It should be noted that the terms "first" and "second" herein are used to distinguish between different pixels, and do not represent a sequential order, nor do they limit "first" and "second" to different types. Figure 6 is a schematic structural diagram of a computing device provided in another exemplary embodiment of the present disclosure. As shown in Figure 6, the computing device includes a memory 60, a processor 61, and a communication component 62. Processor 61 is coupled to memory 60 and communication component 62 and is configured to execute the computer program in memory 60. In some design solutions, processor 61 may be configured to embed a watermark in a video. In this case, processor 61 may be configured to: obtain a target watermark to be embedded in a target video in response to a watermark embedding instruction; search each video frame of the target video for a watermark embedding location that meets a preset texture complexity requirement using a random search method; and embed the target watermark in the corresponding video frame based on the searched watermark embedding location. In an optional embodiment, processor 61 may be configured to: determine not to embed the watermark in any video frame of the target video if no watermark embedding location that meets the preset texture complexity requirement has been found after the number of random searches in any video frame of the target video exceeds a preset threshold. In an optional embodiment, processor 61 may be configured to: determine, for any non-first video frame of the target video, the watermark embedding location in the previous video frame as the starting search location for the random search in the non-first video frame. In an optional embodiment, the processor 61 may also be used to: detect whether the target watermark has stayed continuously at the watermark embedding position in the previous video frame of the non-first video frame for more than a preset number of frames; if not, determine the watermark embedding position in the previous video frame as the starting position for random search in the non-first video frame; if exceeded, randomly select a starting search position in the non-first video frame.In an optional embodiment, the processor 61 may further be configured to: for any search position determined in any video frame of the target video, divide the search position into multiple blocks; calculate the texture complexity of each of the multiple blocks; and determine that the search position meets a preset texture complexity requirement if the texture complexity of each of the multiple blocks exceeds a preset complexity threshold. In an optional embodiment, when calculating the texture complexity of each of the multiple blocks, the processor 61 may specifically be configured to: for any block, calculate a pixel variance value of the block to represent the texture complexity of the block; wherein the pixel variance value is equal to the sum of the squares of the differences between each pixel in the block and the pixel mean of the block. In an optional embodiment, when embedding the target watermark in the corresponding video frame according to the searched watermark embedding position, the processor 61 may specifically be configured to: determine, for any video frame in the target video, a pixel point to be processed at the corresponding watermark embedding position for presenting the target watermark; and adjust the pixel values of each pixel point to be processed so that the adjusted pixel values of each pixel point to be processed approach the same target pixel value, thereby completing the embedding of the target watermark. In an optional embodiment, when adjusting the pixel values of each pixel point to be processed so that the adjusted pixel values of each pixel point to be processed approach the same target pixel value, the processor 61 may specifically be configured to: multiply, for any pixel point to be processed, the difference between the original pixel value and the target pixel value of the pixel point to be processed by a preset coefficient to obtain the watermark embedding strength corresponding to the pixel point to be processed; and use the difference between the original pixel value and the watermark embedding strength, or the difference between the watermark embedding strength and the target pixel value, as the adjusted pixel value of the pixel point to be processed, thereby ensuring that the adjusted pixel value approaches the target pixel value. In an optional embodiment, when the processor 61 determines the target watermark pixel to be processed at its corresponding watermark embedding location, the processor 61 may specifically: align the target watermark with the watermark embedding location; if the binary code of the pixel in the target watermark with which the target pixel at the watermark embedding location is aligned is 1, determine the target pixel as the target watermark pixel; wherein the binary code of the pixel in the target watermark used to present the watermark content is 1, and the binary code of the other pixels is 0. In an optional embodiment, the processor 61 may also: if the target watermark needs to be added during playback of the target video, search for the watermark embedding location for each video frame in the target video and complete the embedding of the target watermark before the corresponding video frame is played; if the watermark embedding location is not found in any video frame, skip the video frame and do not embed the watermark therein. In other design solutions, the processor 61 may be used to embed the watermark in the image.In this case, the processor 61 may be configured to: obtain a target watermark to be embedded in the target image in response to a watermark embedding instruction; search the target image for a watermark embedding location that meets a preset texture complexity requirement using a random search method; and embed the target watermark in the target image according to the searched watermark embedding location. Furthermore, as shown in FIG6 , the computing device also includes other components, such as a power supply component 63. FIG6 schematically illustrates only some components and does not imply that the computing device comprises only the components shown in FIG6 . It is worth noting that the technical details of the computing device embodiments described above can be found in the relevant descriptions of the aforementioned method embodiments. To save space, these details will not be repeated here, but this should not diminish the scope of protection of the present disclosure. Accordingly, embodiments of the present disclosure also provide a computer-readable storage medium storing a computer program. When executed, the computer program can implement the steps of the aforementioned method embodiments. Accordingly, embodiments of the present disclosure also provide a computer program product. When executed, the computer program contained therein can implement the steps of the aforementioned method embodiments. The memory in FIG. 5 is used to store computer programs and can be configured to store various other data to support operations on the computing platform. Examples of such data include instructions for any application or method operating on the computing platform, contact data, phone book data, messages, images, videos, and the like. The memory can be implemented using any type of volatile or non-volatile storage device, or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disks, or optical disks. The communication component in FIG. 5 is configured to facilitate wired or wireless communication between the device in which the communication component resides and other devices. The device in which the communication component resides can access a wireless network based on a communication standard. In one exemplary embodiment, the communication component receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel.In one exemplary embodiment, the communication component also includes a near-field communication (NFC) component to facilitate short-range communication. For example, the NFC component can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology, and other technologies. The power supply assembly in FIG5 provides power to various components of the device in which the power supply assembly resides. The power supply assembly may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the device in which the power supply assembly resides. According to another aspect of the present disclosure, a computer program is also provided. Optionally, when executed by a processor, the computer program implements any of the aforementioned methods. Those skilled in the art will appreciate that the embodiments of the present disclosure may be provided as methods, systems, or computer program products. Therefore, the present disclosure may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present disclosure may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, compact disc read-only memory (CD-ROM), optical storage, etc.) containing computer-usable program code. The present disclosure is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present disclosure. It should be understood that each process and / or block in the flowcharts and / or block diagrams, as well as combinations of processes and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, such that the instructions, executed by the processor of the computer or other programmable data processing device, produce means for implementing the functions specified in one or more processes in the flowcharts and / or one or more blocks in the block diagrams.These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means that implement the functions specified in one or more flow charts and / or one or more blocks in a block diagram. These computer program instructions may also be loaded onto a computer or other programmable data processing device, causing the computer or other programmable device to execute a series of operational steps to produce a computer-implemented process, whereby the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one or more flow charts and / or one or more blocks in a block diagram. It should also be noted that the terms "comprise," "include," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, product, or device comprising a series of elements may include not only those elements but also other elements not expressly listed, or elements inherent to such process, method, product, or device. In the absence of further restrictions, elements defined by the phrase "comprising a..." do not preclude the presence of other identical elements in the process, method, product, or device comprising the elements. It should be noted that 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, storage, and display, etc.) involved in this disclosure are all authorized by the user or fully authorized by all parties. The collection, use, and processing of the relevant data must comply with the relevant laws, regulations, and standards of the relevant countries and regions, and corresponding operation portals are provided for users to choose to authorize or deny. The above description is merely an embodiment of this disclosure and is not intended to limit it. Those skilled in the art will appreciate that various modifications and variations of this disclosure are possible. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of this disclosure are intended to be included within the scope of protection of this disclosure. Industrial Applicability: The solutions provided in the embodiments of this disclosure can be applied to embedding watermarks in videos. A random search method can be used to search for watermark embedding locations that meet preset texture complexity requirements in each frame of the target video. In this way, on the one hand, the watermark embedding position can be hit more efficiently through random search, without the need to traverse the global position of the video frame; on the other hand, the watermark embedding position hit is a complex texture, and embedding the watermark at such a position makes it difficult for the human eye to detect.Based on these two aspects, this embodiment can more efficiently search for watermark embedding locations within target video frames that are insensitive to the human eye, thereby improving the efficiency of watermark embedding within the video and effectively reducing the visually noticeable effect. In particular, in video playback scenarios, it can support the real-time embedding of watermarks that are imperceptible to the human eye within the playing video.
Claims
Claims 1. A method for embedding a watermark in a video, comprising: In response to the watermark embedding instruction, obtaining a target watermark to be embedded in the target video; In a random search manner, each video frame included in the target video is searched for a watermark embedding position that meets a preset texture complexity requirement; and according to the searched watermark embedding position, the target watermark is embedded in the corresponding video frame.
2. The method according to claim 1, wherein: The method further includes: in response to failing to find the watermark embedding position that meets the preset texture complexity requirement after the number of random searches in any video frame of the target video exceeds a preset number threshold, prohibiting embedding the target watermark in the video frame.
3. The method according to claim 1, wherein: The method further includes: for any non-first video frame in the target video, determining the watermark embedding position in the previous video frame as the starting search position for performing random search in the non-first video frame.
4. The method according to claim 3, wherein: It also includes: in response to the target watermark, the watermark embedding position in the previous video frame of the non-first video frame does not stay continuously for more than a preset number of frames, and the operation of determining the watermark embedding position in the previous video frame as the starting position for random search in the non-first video frame is performed; in response to the target watermark, the watermark embedding position in the previous video frame of the non-first video frame stays continuously for more than a preset number of frames, and the starting search position is randomly selected in the non-first video frame.
5. The method according to claim 1, wherein: The method further includes: dividing any search position determined in any video frame of the target video into a plurality of blocks; respectively calculating the texture complexity of the plurality of blocks; and determining that the search position meets the preset texture complexity requirement if the texture complexity of the plurality of blocks exceeds a preset complexity threshold.
6. The method according to claim 5, wherein: Calculating the texture complexity of the multiple blocks respectively includes: calculating a pixel variance value of any block among the multiple blocks to represent the texture complexity of the block; wherein the pixel variance value is equal to the sum of squares of differences between each pixel in the block and a pixel mean of the block.
7. The method according to claim 1, wherein: Embedding the target watermark in the corresponding video frame according to the searched watermark embedding position includes: for any video frame in the target video, determining a pixel point to be processed for presenting the target watermark in the watermark embedding position corresponding to the any video frame; The pixel value of each pixel to be processed is adjusted so that the adjusted pixel value of each pixel to be processed approaches the same target pixel value, thereby completing embedding the target watermark in the corresponding any one of the video frames.
8. The method according to claim 7, wherein: The pixel value of each of the pixel points to be processed is adjusted so that the adjusted pixel value of each of the pixel points to be processed approaches the same target pixel value, including: for any of the pixel points to be processed, multiplying the difference between the original pixel value of the pixel point to be processed and the target pixel value by a preset coefficient to obtain the watermark embedding strength corresponding to the pixel point to be processed; and using the difference between the original pixel value and the watermark embedding strength, or the difference between the watermark embedding strength and the target pixel value, as the adjusted pixel value of the pixel point to be processed, so that the adjusted pixel value approaches the target pixel value.
9. The method according to claim 7, wherein: Determining a pixel point to be processed for presenting the target watermark at its corresponding watermark embedding position, comprising: if the binary code of the pixel point aligned with the target pixel point in the target watermark embedding position is 1, determining the target pixel point as the pixel point to be processed; wherein the binary code of the pixel point in the target watermark for presenting the watermark content is 1, and the binary code of the other pixel points is 0.
10. The method according to claim 2, wherein: Also includes: When the target watermark is added during the playback of the target video, the watermark embedding position is searched for each video frame in the target video in turn, and the target watermark is embedded before the corresponding video frame is played; if the watermark embedding position is not found in any video frame, the video frame is skipped and the embedding of the target watermark in the video frame is prohibited.
11. A method for embedding a watermark in an image, wherein: include: In response to the watermark embedding instruction, obtaining a target watermark to be embedded in a target image; In a random search manner, a watermark embedding position that meets a preset texture complexity requirement is searched in the target image; and the target watermark is embedded in the target image according to the searched watermark embedding position.
12. A computing device, wherein: The device comprises a memory, a processor, and a communication component; the memory is used to store one or more computer instructions; the processor is coupled to the memory and the communication component, and is used to execute the one or more computer instructions to perform the method for embedding a watermark in a video according to any one of claims 1 to 10 or the method for embedding a watermark in an image according to claim 11.
13. A computer-readable storage medium storing a computer program, wherein: When the computer program is executed by one or more processors, the one or more processors are caused to execute the method for embedding a watermark in a video according to any one of claims 1 to 10 or the method for embedding a watermark in an image according to claim 11 . 18 14. A computer program product, wherein: The method comprises a computer program, which, when executed by one or more processors, causes the one or more processors to execute the method for embedding a watermark in a video according to any one of claims 1 to 10 or the method for embedding a watermark in an image according to claim 11.
15. A computer program, wherein When the computer program is executed by a processor, the method for embedding a watermark in a video according to any one of claims 1 to 10 or the method for embedding a watermark in an image according to claim 11 is implemented.