Watermark generation methods, devices, media and electronic equipment
By generating a watermarked page with the same size as the target page and mapping the watermark block to a blank area, the problem of watermark interference in pages with a lot of text and images is solved, achieving a balance between copyright protection and browsing experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- NEUSOFT CORP
- Filing Date
- 2022-12-08
- Publication Date
- 2026-06-30
AI Technical Summary
In existing technologies, adding watermarks to pages with a lot of text and images can easily cause interference and affect the browsing experience.
Generate a watermarked page with the same size as the target page, and map the watermark block to a blank area of the target page, ensuring that the watermark block does not overlap with the text and images.
While protecting copyright, it reduces the interference of watermarks on page images and text, thus improving the browsing experience.
Smart Images

Figure CN116051346B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of computer technology, and more specifically, to a watermark generation method, apparatus, medium, and electronic device. Background Technology
[0002] With the rapid development of computer and internet technologies, the amount of data on the internet is increasing dramatically. However, due to the low cost of infringement, pirates can easily and widely disseminate unauthorized data, seriously affecting the interests of data creators. Therefore, data protection has become an urgent issue to address. Currently, the main method of data protection uses watermarking technology, such as report watermarks. Watermarks are information identifiers embedded in data. Currently, watermarks are typically used as copyright identifiers. By embedding these copyright identifiers into the data, the copyright of the data is protected, ensuring the legitimate rights and interests of the copyright holder.
[0003] When a page (e.g., a report) containing a lot of text and images (i.e., images and text) is to be watermarked, frequent coverage of the text and images by the watermark can cause interference with the page (e.g., ...). Figure 1 As shown in the image, watermarks can negatively impact the browsing experience of a page. Therefore, it is clear that generating low-interference watermarks on a page is crucial for improving the browsing experience. Summary of the Invention
[0004] In order to overcome the problems existing in the related technologies, this disclosure provides a watermark generation method, apparatus, medium and electronic device.
[0005] To achieve the above objectives, in a first aspect, this disclosure provides a watermark generation method, comprising:
[0006] In response to a watermark generation command for the target page, determine the watermark content and watermark generation parameters;
[0007] Based on the watermark content and the watermark generation parameters, a watermark page containing at least one watermark block is generated, wherein the watermark page has the same size as the target page;
[0008] If a target watermark block exists in the watermark page, the target watermark block is mapped to the corresponding position in the target page, wherein the corresponding area of the target watermark block in the target page is a blank area.
[0009] Optionally, the presence of the target watermark block in the watermark page can be determined by the following methods:
[0010] Identify target objects in the target page, wherein the target objects include image blocks and text blocks, and the blank areas are other areas in the target page besides the target objects;
[0011] For each watermark block in the watermark page, determine the target location of the watermark block;
[0012] If the target object does not exist at the location corresponding to the target position on the target page, then the watermark block is determined as the target watermark block.
[0013] Optionally, the presence of the target watermark block in the watermark page can be determined by the following methods:
[0014] Identify target objects in the target page, wherein the target objects include image blocks and text blocks, and the blank areas are other areas in the target page besides the target objects;
[0015] The target object is mapped to the corresponding position in the watermark page to obtain a mapping page, wherein the mapping page includes the at least one watermark block and a mapping object of the target object;
[0016] If there is a watermark block in the mapping page that does not overlap with the mapping object, then it is determined that the target watermark block exists in the watermark page.
[0017] Optionally, identifying image blocks in the target page includes:
[0018] Identify image regions in the target page;
[0019] For each of the image regions, determine whether the image region contains a target block with an area greater than a preset area threshold and a target color. The image region includes multiple unconnected blocks, and the target color is the background color of the target page.
[0020] If the image region contains the target block, then the other regions in the image region excluding the target block are determined as image blocks in the target page;
[0021] The method further includes:
[0022] Adjust the color of each target block in the target page to colorless.
[0023] Optionally, the method further includes:
[0024] If the target watermark block does not exist in the watermark page, the target object is mapped to the corresponding position in the watermark page to obtain a mapping page, which includes the at least one watermark block and a mapping object of the target object.
[0025] Determine the sum of the overlapping areas between each watermark block and the mapped object in the mapped page;
[0026] If the preset cutoff condition is not met, the watermark generation parameters are adjusted, and the process returns to the step of generating a watermark page containing at least one watermark block based on the watermark content and the watermark generation parameters.
[0027] If the preset cutoff condition is met, then each watermark block in the mapping page with the smallest overlap area is mapped to the corresponding position in the target page.
[0028] Optionally, the preset cutoff condition includes one of the following:
[0029] The watermark generation parameters are adjusted a preset number of times;
[0030] The time interval between the current moment and the moment the watermark generation instruction is received reaches a preset duration.
[0031] Optionally, the watermark generation parameters include tilt angle, starting position, horizontal spacing, vertical spacing, and horizontal offset, wherein the horizontal spacing is used to characterize the distance between adjacent watermark blocks in the same watermark row, the vertical distance is the distance between adjacent watermark rows, and the horizontal offset is the distance of the first watermark block of the adjacent watermark row in the direction of the watermark row.
[0032] The adjustment of the watermark generation parameters includes at least one of the following:
[0033] Adjust the tilt angle;
[0034] The starting position is adjusted with the target width as the movement step, wherein the target width is half the width of the characters represented by the target font size and target font of the watermark content;
[0035] Increase the target width by increasing the horizontal spacing;
[0036] Increase the target width by increasing the vertical spacing;
[0037] Increase the target width by increasing the lateral offset.
[0038] Secondly, this disclosure provides a watermark generation apparatus, comprising:
[0039] The first determining module is used to determine the watermark content and watermark generation parameters in response to receiving a watermark generation instruction for the target page.
[0040] The generation module is used to generate a watermark page containing at least one watermark block according to the watermark content and the watermark generation parameters, wherein the watermark page has the same size as the target page;
[0041] The first mapping module is used to map the target watermark block to a corresponding position on the target page if the target watermark block exists on the watermark page, wherein the corresponding area of the target watermark block on the target page is a blank area.
[0042] Thirdly, this disclosure provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the watermark generation method provided in the first aspect of this disclosure.
[0043] Fourthly, this disclosure provides an electronic device, comprising:
[0044] A memory on which computer programs are stored;
[0045] A processor is configured to execute the computer program in the memory to implement the steps of the watermark generation method provided in the first aspect of this disclosure.
[0046] In the above technical solution, upon receiving a watermark generation instruction for the target page, the watermark content and watermark generation parameters are first determined. Then, based on the watermark content and watermark generation parameters, a watermark page containing at least one watermark block is generated, wherein the watermark page has the same size as the target page. If the watermark page contains a target watermark block whose corresponding area on the target page is a blank area, the target watermark block is mapped to the corresponding position on the target page. Since the corresponding area of the target watermark block on the target page is a blank area, mapping it to the corresponding position on the target page will not overlap with the text and images on the target page, i.e., it will not interfere with the effective content such as text and images on the target page. Therefore, it can ensure the copyright protection of the target page while also taking into account the browsing experience of the target page.
[0047] Other features and advantages of this disclosure will be described in detail in the following detailed description section. Attached Figure Description
[0048] The accompanying drawings are provided to further illustrate the present disclosure and form part of the specification. They are used together with the following detailed description to explain the present disclosure, but do not constitute a limitation thereof. In the drawings:
[0049] Figure 1 This is a schematic diagram of report watermarking in related technologies.
[0050] Figure 2 This is a flowchart illustrating a watermark generation method according to an exemplary embodiment.
[0051] Figure 3 This is a schematic diagram illustrating spacing information according to an exemplary embodiment.
[0052] Figure 4 This is a schematic diagram illustrating a watermarked page according to an exemplary embodiment.
[0053] Figure 5 This is a schematic diagram illustrating a target page according to an exemplary embodiment.
[0054] Figure 6 From Figure 5 The diagram shows the target object in the target page.
[0055] Figure 7 According to an exemplary embodiment Figure 5 A screenshot of the page after adding a watermark.
[0056] Figure 8 This is a flowchart illustrating a watermark generation method according to another exemplary embodiment.
[0057] Figure 9 This is a block diagram illustrating a watermark generation apparatus according to an exemplary embodiment.
[0058] Figure 10 This is a block diagram illustrating an electronic device according to an exemplary embodiment.
[0059] Figure 11 This is a block diagram illustrating an electronic device according to an exemplary embodiment. Detailed Implementation
[0060] The specific embodiments of this disclosure will be described in detail below with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are for illustration and explanation only and are not intended to limit this disclosure.
[0061] It should be noted that all actions involving the acquisition of signals, information, or data in this disclosure are carried out in compliance with the relevant data protection laws and policies of the country where the location is situated, and with authorization from the owner of the relevant device.
[0062] Figure 2 This is a flowchart illustrating a watermark generation method according to an exemplary embodiment. For example... Figure 2 As shown, the method may include the following steps S101 to S103.
[0063] In S101, in response to the watermark generation instruction for the target page, the watermark content and watermark generation parameters are determined.
[0064] In this disclosure, the target page can be a webpage, an application page, a document page (e.g., a report page), etc., and this disclosure does not specifically limit the type of the target page.
[0065] Watermark content can be text, images, QR codes, barcodes, etc. Furthermore, the watermark content can be default content or user-defined content. For example, if the watermark generation instruction includes the watermark content to be added, then the watermark content to be added can be obtained by parsing the watermark generation instruction.
[0066] In addition, different types of watermark content correspond to different watermark generation parameters. These watermark generation parameters can be default values or user-defined values. For example, watermark generation instructions include watermark generation parameters.
[0067] For text-based watermark content, the corresponding watermark generation parameters include, but are not limited to, the following: font, font size, color, tilt angle, starting position, horizontal spacing, vertical spacing, and horizontal offset. For example, Figure 1 and Figure 3 As shown, when generating a page watermark, the watermark content is arranged sequentially on the page, starting from the initial watermark position and according to the tilt angle and spacing information (horizontal spacing, vertical spacing, and horizontal offset). The initial position refers to the center position of the watermark block closest to the top left corner of the page, such as... Figure 3 The location of the center point of the watermark block in the top left corner. Horizontal spacing is used to characterize the distance between adjacent watermark blocks within the same watermark row, for example... Figure 3 The distance d1 between the second and third watermark blocks in the third row of watermarks shown is an example. The vertical distance is the distance between adjacent watermark rows. Figure 3 The distance d2 between the second and third rows of watermarks is shown in the diagram. The lateral offset is the distance of the first watermark block of the adjacent watermark row in the direction of the watermark row. For example, Figure 3 The distance between the first watermark block in the second row of watermarks and the first watermark block in the third row of watermarks in the direction of the watermark rows.
[0068] For example, both the horizontal and vertical spacing are greater than 5 times the line height, where the line height is the target font size of the watermark content and the height of the characters represented by the target font. Figure 4 The height of a Chinese character within the watermark block.
[0069] For image-type watermark content, the corresponding watermark generation parameters include, but are not limited to, the following: image height, image width, starting position, horizontal spacing, vertical spacing, and horizontal offset.
[0070] The watermark content for QR code and barcode types includes, but is not limited to, the following watermark generation parameters: code height, code width, starting position, horizontal spacing, vertical spacing, and horizontal offset.
[0071] In S102, a watermark page including at least one watermark block is generated according to the watermark content and watermark generation parameters.
[0072] Among them, the watermark page has the same size as the target page. Specifically, watermark blocks containing the watermark content can be generated according to the attribute information of the watermark content (such as font size, font, height, width, etc.). Then, starting from the watermark starting position, the watermark blocks are arranged in sequence according to the tilt angle and spacing information (horizontal spacing, vertical spacing, and horizontal offset) into a blank page that is exactly the same size as the target page to obtain the watermark page.
[0073] Exemplarily, the watermark content is the text "Wang Xiaoming 8866", and the target font size of this watermark content is 10, and the target font is Song typeface. At this time, "Wang Xiaoming 8866" with a size of 20 and a font of Song typeface can be generated according to the target font and target font size of the watermark content "Wang Xiaoming 8866", that is, the watermark block is obtained. Then, starting from the watermark starting position, the watermark block is arranged in sequence according to the target tilt angle and target spacing information into the blank page to obtain the watermark page as shown in Figure 4 the figure.
[0074] In S103, if there is a target watermark block in the watermark page, the target watermark block is mapped to the corresponding position in the target page.
[0075] In the present disclosure, the corresponding area of the target watermark block in the target page is a blank area, that is, there is no text or image in the area corresponding to the target watermark block in the target page. It can be seen that the target watermark block varies with the different target pages and is adapted to the target page.
[0076] Specifically, the target watermark block can be mapped to the corresponding position in the target page in the following way: First, the target position of the target watermark block in the watermark page (that is, the target position where the watermark block is located) can be determined. Then, the corresponding position is determined from the target page. After that, the target watermark block is added to the corresponding position in the target page. The target position where the watermark block is located is the area occupied by the watermark block in the watermark page.
[0077] The watermark page and the target page have exactly the same size, and the corresponding area of the target watermark block in the target page is a blank area. Therefore, after the target watermark block is mapped to the corresponding position in the target page, it will not overlap with the image or text in the target page, that is, it will not interfere with the valid content such as text and image in the target page.
[0078] In the above technical solution, upon receiving a watermark generation instruction for the target page, the watermark content and watermark generation parameters are first determined. Then, based on the watermark content and watermark generation parameters, a watermark page containing at least one watermark block is generated, wherein the watermark page has the same size as the target page. If the watermark page contains a target watermark block whose corresponding area on the target page is a blank area, the target watermark block is mapped to the corresponding position on the target page. Since the corresponding area of the target watermark block on the target page is a blank area, mapping it to the corresponding position on the target page will not overlap with the text and images on the target page, i.e., it will not interfere with the effective content such as text and images on the target page. Therefore, it can ensure the copyright protection of the target page while also taking into account the browsing experience of the target page.
[0079] Furthermore, in this disclosure, the presence of a target watermark block in a watermark page can be determined in various ways. In one embodiment, this can be achieved through the following steps [1] to [5]:
[0080] Step [1]: Identify the target object in the target page.
[0081] In this disclosure, the target object includes image blocks and text blocks, and the blank area is the area on the target page other than the target object.
[0082] Step [2]: For each watermark block in the watermark page, determine the target location of the watermark block.
[0083] Step [3]: Determine whether the target object exists in the target page at the location corresponding to the target location.
[0084] If there is no target object in the target page at the location corresponding to the target position, it indicates that after the watermark block is mapped to the corresponding location on the target page, it will not overlap with the image or text on the target page. In this case, the watermark block can be identified as the target watermark block, and the following steps are performed [4]. If there is a target object in the target page at the location corresponding to the target position, it indicates that after the watermark block is mapped to the corresponding location on the target page, it will overlap with the image or text on the target page. In this case, the watermark block is not suitable for mapping to the target page. In this case, it can be determined that the watermark block is not the target watermark block, and the following steps are performed [5]. Thus, it can be determined whether there is a target watermark block in the watermark page.
[0085] Step [4]: Identify the watermark block as the target watermark block.
[0086] Step [5]: Determine that the watermark block is not the target watermark block.
[0087] In another implementation, the presence of a target watermark block in the watermark page can be determined by the following steps (1) to (3):
[0088] Step (1): Identify the target object on the target page.
[0089] Step (2): Map the target object to the corresponding position on the watermark page to obtain the mapped page.
[0090] The mapping page includes at least one watermark block and a mapping object of the target object. When the target page and the watermark page are exactly the same size, the size of the target object and the size of its mapping object are also exactly the same.
[0091] Alternatively, a similar method to mapping the target watermark block to the corresponding position on the target page in S103 above can be used to map the target object to the corresponding position on the watermark page, which will not be elaborated here.
[0092] Step (3): If there is a watermark block in the mapping page that does not overlap with the mapping object, then it is determined that there is a target watermark block in the watermark page.
[0093] In this disclosure, the watermark page and the target page have the same size. The mapping page is obtained by mapping each target object in the target page to the corresponding position in the watermark page. Therefore, the position of the target object in the mapping page is exactly the same as its position in the target page. Thus, if a watermark block in the mapping page does not overlap with the mapped object of the target object, it means that after mapping the watermark block to the corresponding position in the target page, it will not overlap with the image or text in the target page. In this case, it can be determined that the watermark block is the target watermark block, that is, there is a watermark block in the mapping page that does not overlap with the mapped object. If a watermark block in the mapping page overlaps with the mapped object, it means that after mapping the watermark block to the corresponding position in the target page, it will overlap with the image or text in the target page. In this case, it can be determined that the watermark block is not the target watermark block.
[0094] If a watermark block that does not overlap with the mapped object exists in the mapped page, then the target watermark block is determined to exist in the watermark page; if a watermark block that does not overlap with the mapped object does not exist in the mapped page, then the target watermark block is determined to not exist in the watermark page.
[0095] The following is a detailed description of the specific implementation methods for identifying the target object in the target page in steps [1] and (1) above. Specifically, it can be implemented through various methods. In one implementation method, each text block in the target page can be identified by a text detection model, wherein the text block includes at least one character. At the same time, the image region in the target page can be identified by an image detection model, and the image region can be directly determined as an image block.
[0096] In another implementation, a text detection model can be used to identify text blocks in the target page, where each text block includes at least one character. Simultaneously, an image detection model can be used to identify image regions in the target page. Then, for each image region, it is determined whether the image region contains a target block with an area greater than a preset area threshold and a target color. The image region includes multiple unconnected blocks, and the target color is the background color of the target page. If the image region contains a target block, then the other areas in the image region excluding the target block are determined as image blocks in the target page. If the image region does not contain a target block, then the image region is determined as an image block in the target page.
[0097] At this point, the above method can also include the following step: adjusting the color of each target block on the target page to colorless. Since watermarks are mostly located at the bottom layer, adjusting the color of the target blocks to colorless allows the colorless target blocks to serve as watermark addition areas without interfering with the text and images, thereby improving the watermark effect.
[0098] For example, the target page is Figure 5 The report page shown, from which text blocks are identified, such as... Figure 6 The black area shown. Additionally, from... Figure 5 The identified image region includes the rectangular frame containing the person's image. The background color of the target page is white. The areas within this rectangular frame, excluding the connected component containing the person's image, are also white and their areas exceed a preset area threshold. Therefore, the areas within this rectangular frame, excluding the connected component containing the person's image, can be defined as the target block. Thus, from... Figure 5 In the report page, the image block identified is the connected region containing the portrait. At this point, the color of the area outside the connected region within the rectangle (excluding the portrait area) can be adjusted to be colorless. This allows watermarks to be added to this colorless area later (e.g., ...). Figure 7 (As shown).
[0099] Figure 8 This is a flowchart illustrating a watermark generation method according to another exemplary embodiment. For example... Figure 8 As shown, the above method may further include the following steps S104 to S108.
[0100] In S104, if the target watermark block does not exist in the watermark page, the target object is mapped to the corresponding position in the watermark page to obtain the mapped page.
[0101] The mapping page includes at least one watermark block and a mapping object of the target object.
[0102] In S105, the sum of the overlapping areas between each watermark block in the mapped page and the mapped object is determined.
[0103] In this disclosure, the sum of the overlapping areas between each watermark block in the mapped page and the mapped object is the aforementioned sum of overlapping areas.
[0104] In S106, determine whether the preset cutoff condition is met.
[0105] In this disclosure, the preset cutoff condition can be that the number of times the watermark generation parameters are adjusted reaches a preset number, or that the time between the current time and the time when the watermark generation instruction is received reaches a preset duration.
[0106] If the preset cutoff condition is not met, then execute S107 below, and then return to S102 above. If the preset cutoff condition is met, then execute S108 below.
[0107] In S107, adjust the watermark generation parameters.
[0108] In S108, each watermark block in the mapping page with the smallest overlap area is mapped to the corresponding position in the target page.
[0109] Before adjusting the watermark generation parameters, a watermark page was generated. After each subsequent adjustment of the watermark generation parameters, a corresponding watermark page is generated based on the adjusted parameters. This results in N+1 watermark pages, where N is the number of times the watermark generation parameters have been adjusted. When a preset cutoff condition is met, the target mapping page with the smallest overlap between the watermark block and the text / image area on the target page is determined from the N+1 watermark pages. Each watermark block on this target mapping page is then mapped to its corresponding position on the target page.
[0110] In the above implementation, by adjusting the watermark generation parameters multiple times, different watermark pages are obtained. Then, the mapping page with the smallest overlap area with the text and images on the target page is found from the mapping pages corresponding to the different watermark pages. Each watermark block in the mapping page with the smallest overlap area is mapped to the corresponding position on the target page. In this way, the interference of the watermark on the text and images on the target page can be minimized, and the browsing experience of the target page can be improved.
[0111] The following is a detailed description of the specific implementation method for adjusting the watermark generation parameters in step S107 above. Specifically, step S107 includes at least one of steps ① to ⑤:
[0112] Step 1: Adjust the tilt angle.
[0113] In this disclosure, the tilt angle can be adjusted within the range of [10°, 45°].
[0114] For example, the tilt angle can be randomly adjusted within the above range, or it can be adjusted according to a preset rule, such as adding 1° to the current tilt angle.
[0115] Step 2: Adjust the starting position using the target width as the moving step size.
[0116] The target width is half the width of the characters represented by the target font size and target font of the watermark content. For example, Figure 4 Half the width of a Chinese character in the watermark block.
[0117] Adjusting the starting position by using the target width as the movement step means moving the current starting position in a preset direction (e.g., up, down, left, right, etc.) by the target width.
[0118] Step 3: Increase the horizontal spacing to the target width.
[0119] Since a larger horizontal spacing results in less overlap between the generated watermark and the text / image, in order to minimize the interference of the watermark on the text / image on the target page, the current horizontal spacing can be increased to the target width.
[0120] Step 4: Increase the vertical spacing to the target width.
[0121] Since the larger the vertical spacing, the less overlap there is between the generated watermark and the text / images, in order to minimize the interference of the watermark on the text / images on the target page, the current vertical spacing can be increased to the target width.
[0122] Step 5: Increase the horizontal offset to the target width.
[0123] Since a larger horizontal offset results in less overlap between the generated watermark and the text / image, in order to minimize the interference of the watermark on the text / image on the target page, the current horizontal offset can be increased by the target width.
[0124] In addition, the watermark generation parameters can be adjusted by modifying the attributes of the watermark content (such as font size, font, height, width, etc.). Since a smaller font size results in less overlap between the generated watermark and the text / image, reducing the font size is a good way to minimize interference from the watermark on the target page's text and images.
[0125] Figure 9 This is a block diagram illustrating a watermark generation apparatus according to an exemplary embodiment. Figure 9 As shown, the device 900 includes:
[0126] The first determining module 901 is used to determine the watermark content and watermark generation parameters in response to the watermark generation instruction for the target page.
[0127] The generation module 902 is used to generate a watermark page containing at least one watermark block according to the watermark content and the watermark generation parameters, wherein the watermark page has the same size as the target page.
[0128] The first mapping module 903 is used to map the target watermark block to a corresponding position on the target page if the target watermark block exists on the watermark page, wherein the corresponding area of the target watermark block on the target page is a blank area.
[0129] In the above technical solution, upon receiving a watermark generation instruction for the target page, the watermark content and watermark generation parameters are first determined. Then, based on the watermark content and watermark generation parameters, a watermark page containing at least one watermark block is generated, wherein the watermark page has the same size as the target page. If the watermark page contains a target watermark block whose corresponding area on the target page is a blank area, the target watermark block is mapped to the corresponding position on the target page. Since the corresponding area of the target watermark block on the target page is a blank area, mapping it to the corresponding position on the target page will not overlap with the text and images on the target page, i.e., it will not interfere with the effective content such as text and images on the target page. Therefore, it can ensure the copyright protection of the target page while also taking into account the browsing experience of the target page.
[0130] Optionally, the device 900 further includes a second determining module for determining whether the target watermark block exists in the watermark page, wherein the second determining module includes:
[0131] An object recognition submodule is used to identify target objects in the target page, wherein the target objects include image blocks and text blocks, and the blank area is other areas in the target page other than the target objects;
[0132] The first determining submodule is used to determine the target location of each watermark block in the watermark page.
[0133] The second determining submodule is used to determine the watermark block as the target watermark block if the target object does not exist in the target page at the position corresponding to the target position.
[0134] Optionally, the device 900 further includes a second determining module for determining whether the target watermark block exists in the watermark page, wherein the second determining module includes:
[0135] An object recognition submodule is used to identify target objects in the target page, wherein the target objects include image blocks and text blocks, and the blank area is other areas in the target page other than the target objects;
[0136] A mapping submodule is used to map the target object to a corresponding position in the watermark page to obtain a mapping page, wherein the mapping page includes the at least one watermark block and a mapping object of the target object;
[0137] The third determining submodule is used to determine that the target watermark block exists in the watermark page if there is a watermark block in the mapping page that does not overlap with the mapping object.
[0138] Optionally, the object recognition submodule includes:
[0139] The image recognition submodule is used to identify image regions in the target page;
[0140] The fourth determining submodule is used to determine, for each of the image regions, whether the image region contains a target block with an area greater than a preset area threshold and a target color, wherein the image region includes multiple unconnected blocks and the target color is the background color of the target page; the fifth determining submodule is used to determine, if the image region contains the target block, other areas in the image region except the target block as image blocks in the target page;
[0141] The device 900 further includes:
[0142] The color adjustment module is used to adjust the color of each target block in the target page to colorless.
[0143] Optionally, the device 900 further includes:
[0144] The second mapping module is used to map the target object to the corresponding position in the watermark page if the target watermark block does not exist in the watermark page, thereby obtaining a mapping page. The mapping page includes the at least one watermark block and a mapping object of the target object.
[0145] The third determining module is used to determine the sum of the overlapping areas between each watermark block and the mapping object in the mapping page;
[0146] The triggering module is used to adjust the watermark generation parameters and trigger the generation module 902 to generate a watermark page containing at least one watermark block according to the watermark content and the watermark generation parameters if the preset cutoff condition is not met.
[0147] The third mapping module is used to map each watermark block in the mapping page with the smallest overlap area to the corresponding position in the target page if the preset cutoff condition is met.
[0148] Optionally, the preset cutoff condition includes one of the following:
[0149] The watermark generation parameters are adjusted a preset number of times;
[0150] The time interval between the current moment and the moment the watermark generation instruction is received reaches a preset duration.
[0151] Optionally, the watermark generation parameters include tilt angle, starting position, horizontal spacing, vertical spacing, and horizontal offset, wherein the horizontal spacing is used to characterize the distance between adjacent watermark blocks in the same watermark row, the vertical distance is the distance between adjacent watermark rows, and the horizontal offset is the distance of the first watermark block of the adjacent watermark row in the direction of the watermark row.
[0152] The color adjustment module includes at least one of the following:
[0153] The first adjustment submodule is used to adjust the tilt angle;
[0154] The second adjustment submodule is used to adjust the starting position with the target width as the movement step, wherein the target width is half the width of the characters represented by the target font size and target font of the watermark content;
[0155] The third adjustment submodule is used to increase the target width by increasing the horizontal spacing;
[0156] The fourth adjustment submodule is used to increase the target width by increasing the longitudinal spacing;
[0157] The fifth adjustment submodule is used to increase the target width by increasing the lateral offset.
[0158] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.
[0159] This disclosure also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the watermark generation method described above.
[0160] Figure 10 This is a block diagram illustrating an electronic device 700 according to an exemplary embodiment. For example... Figure 10 As shown, the electronic device 700 may include a processor 701 and a memory 702. The electronic device 700 may also include one or more of a multimedia component 703, an input / output (I / O) interface 704, and a communication component 705.
[0161] The processor 701 controls the overall operation of the electronic device 700 to complete all or part of the steps in the watermark generation method described above. The memory 702 stores various types of data to support the operation of the electronic device 700. This data may include, for example, instructions for any application or method operating on the electronic device 700, and application-related data such as contact data, sent and received messages, pictures, audio, video, etc. The memory 702 can be implemented by 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 disk, or optical disk. Multimedia component 703 may include a screen and an audio component. The screen may be, for example, a touchscreen, and the audio component is used to output and / or input audio signals. For example, the audio component may include a microphone for receiving external audio signals. The received audio signals may be further stored in memory 702 or transmitted via communication component 705. The audio component also includes at least one speaker for outputting audio signals. I / O interface 704 provides an interface between processor 701 and other interface modules, such as a keyboard, mouse, buttons, etc. These buttons may be virtual or physical buttons. Communication component 705 is used for wired or wireless communication between the electronic device 700 and other devices. Wireless communication, such as Wi-Fi, Bluetooth, Near Field Communication (NFC), 2G, 3G, 4G, NB-IoT, eMTC, or other 5G technologies, or combinations thereof, is not limited here. Therefore, the corresponding communication component 705 may include: a Wi-Fi module, a Bluetooth module, an NFC module, etc.
[0162] In an exemplary embodiment, the electronic device 700 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the watermark generation method described above.
[0163] In another exemplary embodiment, a computer-readable storage medium including program instructions is also provided, which, when executed by a processor, implement the steps of the watermark generation method described above. For example, the computer-readable storage medium may be the memory 702 including the program instructions, which may be executed by the processor 701 of the electronic device 700 to complete the watermark generation method described above.
[0164] Figure 11 This is a block diagram illustrating an electronic device 1900 according to an exemplary embodiment. For example, the electronic device 1900 may be provided as a server. (Refer to...) Figure 11 The electronic device 1900 includes a processor 1922, which may be one or more, and a memory 1932 for storing a computer program executable by the processor 1922. The computer program stored in the memory 1932 may include one or more modules, each corresponding to a set of instructions. Furthermore, the processor 1922 may be configured to execute the computer program to perform the watermark generation method described above.
[0165] Additionally, the electronic device 1900 may also include a power supply component 1926 and a communication component 1950. The power supply component 1926 can be configured to perform power management of the electronic device 1900, and the communication component 1950 can be configured to enable communication of the electronic device 1900, such as wired or wireless communication. Furthermore, the electronic device 1900 may also include an input / output (I / O) interface 1958. The electronic device 1900 can operate on an operating system stored in memory 1932.
[0166] In another exemplary embodiment, a computer-readable storage medium including program instructions is also provided, which, when executed by a processor, implement the steps of the watermark generation method described above. For example, the non-transitory computer-readable storage medium may be the memory 1932 including the program instructions, which may be executed by the processor 1922 of the electronic device 1900 to complete the watermark generation method described above.
[0167] In another exemplary embodiment, a computer program product is also provided, the computer program product comprising a computer program executable by a programmable device, the computer program having a code portion for performing the watermark generation method described above when executed by the programmable device.
[0168] The preferred embodiments of the present disclosure have been described in detail above with reference to the accompanying drawings. However, the present disclosure is not limited to the specific details of the above embodiments. Within the scope of the technical concept of the present disclosure, various simple modifications can be made to the technical solutions of the present disclosure, and these simple modifications all fall within the protection scope of the present disclosure.
[0169] It should also be noted that the various specific technical features described in the above embodiments can be combined in any suitable manner without contradiction. To avoid unnecessary repetition, this disclosure will not describe the various possible combinations separately.
[0170] Furthermore, various different embodiments of this disclosure can be combined in any way, as long as they do not violate the spirit of this disclosure, they should also be regarded as the content disclosed in this disclosure.
Claims
1. A watermark generation method characterized by, include: In response to a watermark generation command for the target page, determine the watermark content and watermark generation parameters; Based on the watermark content and the watermark generation parameters, a watermark page containing at least one watermark block is generated, wherein the watermark page has the same size as the target page; If a target watermark block exists in the watermark page, the target watermark block is mapped to the corresponding position in the target page, wherein the corresponding area of the target watermark block in the target page is a blank area; Identify target objects in the target page, wherein the target objects include image blocks and text blocks, and the blank areas are other areas in the target page besides the target objects; If the target watermark block does not exist in the watermark page, the target object is mapped to the corresponding position in the watermark page to obtain a mapping page, which includes the at least one watermark block and a mapping object of the target object. Determine the sum of the overlapping areas between each watermark block and the mapped object in the mapped page; If the preset cutoff condition is not met, the watermark generation parameters are adjusted, and the process returns to the step of generating a watermark page containing at least one watermark block based on the watermark content and the watermark generation parameters. If the preset cutoff condition is met, then each watermark block in the mapping page with the smallest overlap area is mapped to the corresponding position in the target page.
2. The method of claim 1, wherein, The presence of the target watermark block in the watermark page is determined using the following method: For each watermark block in the watermark page, determine the target location of the watermark block; If the target object does not exist at the location corresponding to the target position on the target page, then the watermark block is determined as the target watermark block.
3. The method of claim 1, wherein, The presence of the target watermark block in the watermark page is determined using the following method: The target object is mapped to the corresponding position in the watermark page to obtain a mapping page, wherein the mapping page includes the at least one watermark block and a mapping object of the target object; If there is a watermark block in the mapping page that does not overlap with the mapping object, then it is determined that the target watermark block exists in the watermark page.
4. The method according to claim 2 or 3, characterized in that, Identifying image blocks in the target page includes: Identify image regions in the target page; For each of the image regions, determine whether the image region contains a target block with an area greater than a preset area threshold and a target color. The image region includes multiple unconnected blocks, and the target color is the background color of the target page. If the image region contains the target block, then the other regions in the image region excluding the target block are determined as image blocks in the target page; The method further includes: Adjust the color of each target block in the target page to colorless.
5. The method according to claim 1, characterized in that, The preset cutoff condition includes one of the following: The watermark generation parameters are adjusted a preset number of times; The time interval between the current moment and the moment the watermark generation instruction is received reaches a preset duration.
6. The method according to claim 1, characterized in that, The watermark generation parameters include tilt angle, starting position, horizontal spacing, vertical spacing, and horizontal offset. The horizontal spacing is used to characterize the distance between adjacent watermark blocks in the same watermark row, the vertical spacing is the distance between adjacent watermark rows, and the horizontal offset is the distance of the first watermark block in the adjacent watermark row in the direction of the watermark row. The adjustment of the watermark generation parameters includes at least one of the following: Adjust the tilt angle; The starting position is adjusted with the target width as the movement step, wherein the target width is half the width of the characters represented by the target font size and target font of the watermark content; Increase the target width by increasing the horizontal spacing; Increase the target width by increasing the vertical spacing; Increase the target width by increasing the lateral offset.
7. A watermark generation device, characterized in that, include: The first determining module is used to determine the watermark content and watermark generation parameters in response to the watermark generation instruction for the target page. The generation module is used to generate a watermark page containing at least one watermark block according to the watermark content and the watermark generation parameters, wherein the watermark page has the same size as the target page; The first mapping module is used to map the target watermark block to a corresponding position on the target page if the target watermark block exists on the watermark page, wherein the corresponding area of the target watermark block on the target page is a blank area. Identify target objects in the target page, wherein the target objects include image blocks and text blocks, and the blank areas are other areas in the target page besides the target objects; If the target watermark block does not exist in the watermark page, the target object is mapped to the corresponding position in the watermark page to obtain a mapping page, which includes the at least one watermark block and a mapping object of the target object. Determine the sum of the overlapping areas between each watermark block and the mapped object in the mapped page; If the preset cutoff condition is not met, the watermark generation parameters are adjusted, and the process returns to the step of generating a watermark page containing at least one watermark block based on the watermark content and the watermark generation parameters. If the preset cutoff condition is met, then each watermark block in the mapping page with the smallest overlap area is mapped to the corresponding position in the target page.
8. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the program implements the steps of the method described in any one of claims 1-6.
9. An electronic device, characterized in that, include: A memory on which computer programs are stored; A processor for executing the computer program in the memory to implement the steps of the method according to any one of claims 1-6.