Multi-layer adaptive hybrid watermark embedding method based on image protection
By using multi-layer adaptive hybrid watermark embedding method and opencv image processing library in the avatar watermark system, the problem of the existing system lacking multi-layer mixing and open source library support is solved, and a simple, fast, multi-functional customized avatar is achieved The watermark function improves the practicality and design flexibility of the system.
Patent Information
- Application Number
- CN202411280681.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-13
- Publication Date
- 2025-02-11
AI Technical Summary
The existing avatar watermarking system lacks the support of multi-layer mixed superposition application scenarios and open source image processing software library, and cannot provide simple, fast, multi-functional customized avatar watermarking function, which is poor in practicality.
Adopting multi-layer adaptive hybrid watermark embedding method based on image protection, using the opencv open source image processing software library, it supports multi-layer hybrid overlay, high text characteristics support, rich image watermark special effects, and can provide multi-functional customization easily and quickly Avatar watermark function.
It realizes the simple, fast, multi-functional customized avatar watermark function, supports layer fusion and rich text and picture watermark effects, improving the practicality and design flexibility of the system.
Smart Images

Figure CN119417683A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of head portrait watermark processing, and in particular to a multi-layer adaptive hybrid watermark embedding method based on image protection. Background Art
[0002] Digital watermarking technology is a technology that embeds specific information into digital media. This information is difficult to detect or remove without affecting the normal use of the media, thereby protecting copyright and preventing tampering. The avatar is a user's identity icon on the Internet, usually a square picture. In order to pursue exquisite details, we use high-pixel pictures as avatars and watermark materials.
[0003] The existing watermarking system does not adopt the application scenario of multiple layer mixing and superposition when in use, nor does it adopt the image processing algorithm of the open source image processing software library. It cannot provide a simple, fast, and multi-functional customized avatar watermarking function for niche designer groups, and has poor practicality. Therefore, it is necessary to design a practical multi-layer adaptive hybrid watermark embedding method based on image protection. Summary of the invention
[0004] The purpose of the present invention is to provide a multi-layer adaptive hybrid watermark embedding method based on image protection to solve the problems raised in the above background technology.
[0005] To achieve the above object, the present invention provides the following technical solution: a multi-layer adaptive hybrid watermark embedding method based on image protection, comprising the following steps:
[0006] S1. Prepare the base map
[0007] First, buy a custom avatar, save it to the desktop, import the necessary libraries into Python, and then read the base map. When reading the map, enter cv2.imread, select the avatar that has been purchased in the personal backpack column to read. You can view the dynamics of the purchased avatar and determine whether it has been watermarked in the first stage.
[0008] When the first-stage watermark is not printed, enter the first-stage printing of plain white, shading, and full-screen watermarks;
[0009] When adding a plain white watermark, create a pure color image of the same size as the original image, and use the inverse operation of the bitwise operation cv2.bitwise_and to directly assign the white image to the original image;
[0010] When making a shading watermark, a texture image is read, and its size is adjusted to match the original image, and then the texture is mixed with the original image using cv2.addWeighted.
[0011] When adding a full-screen watermark, you also need to read the watermark image, resize it, and use cv2.addWeighted to superimpose it on the original image.
[0012] When one stage of watermark has been printed, the subsequent border type watermark processing is carried out.
[0013] After reading the image, you need to add a border to the image. Read the four coordinates of the image and input cv2.rectangle(). The coordinates are given in (). The marked coordinates are the coordinates of the upper left corner and the lower right corner, and they include the border. Then you can save it and save the printed avatar to the album.
[0014] S2. Create a new layer
[0015] Create a new blank layer. This layer will be used to add watermarks. You can create three layers at the same time. After importing the base map, group and merge the three layers with the base map into a new layer one. Then you can continue to add new layers and merge them.
[0016] S3. Add text layer
[0017] To add text to an image, the cv2.putText() function is usually used. Specifically, you can enter cv2.putText(image, text, (text_x, text_y), font, font_scale, font_color, line_type) to draw text directly on the image represented by the image variable.
[0018] S4. Create a new tile layer
[0019] When you need to create a tiling watermark effect, you can first draw a watermark pattern, then duplicate the layer and adjust its position and size to form a tiling effect.
[0020] S5. Processing watermark layer
[0021] Adjust the opacity of the watermark layer: Use the cv2.addWeighted() function to simulate this effect, specifically cv2.addWeighted(image,alpha,background,beta,gamma).
[0022] S6. Image export
[0023] After completing the above steps, you can click Export to export the avatar with multiple layers added.
[0024] Preferably, the steps in steps S1 and S2 are the process steps of watermarking from the user's perspective, and the process of configuring the avatar watermarking by the operator is as follows:
[0025] S7. Commission a custom avatar and get a PNG image of the avatar.
[0026] S8. Encrypt and upload the avatar png image and configure it as an avatar product.
[0027] S9. Invite designers to design suitable watermarks for each set of avatars.
[0028] S10. Operation staff can convert the designer's watermark psd file into watermark json.
[0029] S11. Configure watermark json to add watermark.
[0030] S12. Contact the user and ask the user to choose to add a watermark to the avatar on the client.
[0031] S13. When problems occur, operations require help with manual watermarking.
[0032] Preferably, in S10, the operator uses Photoshop naming rules to export files to the watermark debugging background, uses the watermark debugging background to parse the psd file, obtains the layer information json, and the watermark pattern is the editing status of the background. It is edited and debugged by the watermark debugging background personnel, and the final layer json is exported. Then the obtained json is configured to the watermark management background to prepare for the watermark to be put on the shelf.
[0033] Preferably, each layer in S2 has a groupIndex indicating the group number of the layer. A text layer and a picture layer can be grouped into one group, and the position, rotation and other properties of the group can be adjusted as a whole.
[0034] Compared with the prior art, the present invention has the following beneficial effects:
[0035] 1. This is a multi-layer adaptive hybrid watermark embedding method based on image protection. The system refers to the application scenarios of multiple layer hybrid overlay of Photoshop and other image processing software, and adopts the image processing algorithm of OpenCV open source image processing software library. It provides a simple, fast, multi-functional customized avatar watermarking function for niche designer groups, and can support the fusion of layers in a certain hybrid mode. The text layer can be set to have a high degree of support for text characteristics. In addition to basic font, size, and color support, it also supports special effects such as text stroke, text shadow, and text bevel relief. Flexible text layout, support left-right-up-down layout, right-left-up-down layout, etc.; circular text can be set; the position and rotation of a single character can be fine-tuned; if there are too many words in the specified area, the size can be adaptively adjusted to adapt to the regional space.
[0036] Supports special effects such as external glow, Gaussian blur, bevel relief, etc. for image watermarks; supports masking.
[0037] 2. This is a multi-layer adaptive hybrid watermark embedding method based on image protection. The operator uses Photoshop naming rules to export files to the watermark debugging background, and uses the watermark debugging background to parse the psd file to obtain the layer information json. The watermark pattern is the editing status of the background. It is edited and debugged by the watermark debugging background personnel, and the final layer json is exported. Then the obtained json is configured to the watermark management background, and the watermark is ready to be put on the shelf to complete the watermark processing.
[0038] 3. This is a multi-layer adaptive hybrid watermark embedding method based on image protection. When establishing layers, each layer has a groupIndex indicating the group number of the layer. A text layer and a picture layer can be grouped into a group. The group can adjust the position, rotation and other properties as a whole for easy adjustment. Moreover, based on parameter conventions and in compliance with certain protocols, many different layer watermarks can be merged into the base map in sequence. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.
[0040] Figure 1 An internal flow chart of the layer grouping of the present invention;
[0041] Figure 2 This is a flow chart of watermarking from the user's perspective of the present invention;
[0042] Figure 3 A flow chart for configuring head portrait watermarking for the operator of the present invention;
[0043] Figure 4 This is a flow chart of watermark debugging and listing in the present invention. DETAILED DESCRIPTION
[0044] The following will be combined with the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0045] In the present invention, unless otherwise clearly specified and limited, the terms "installed", "connected", "connected", and "fixed" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, it can be the internal connection of two elements or the interaction relationship between two elements. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0046] See also Figure 1-4 , the present invention provides the following technical solutions:
[0047] A multi-layer adaptive hybrid watermark embedding method based on image protection includes the following steps:
[0048] S1. Prepare the base map
[0049] First, buy a custom avatar, save it to the desktop, import the necessary libraries into Python, and then read the base map. When reading the map, enter cv2.imread, select the avatar that has been purchased in the personal backpack column to read. You can view the dynamics of the purchased avatar and determine whether it has been watermarked in the first stage.
[0050] When the first-stage watermark is not printed, enter the first-stage printing of plain white, shading, and full-screen watermarks;
[0051] When adding a plain white watermark, create a pure color image of the same size as the original image, and use the inverse operation of the bitwise operation cv2.bitwise_and to directly assign the white image to the original image;
[0052] When making a shading watermark, a texture image is read, and its size is adjusted to match the original image, and then the texture is mixed with the original image using cv2.addWeighted.
[0053] When adding a full-screen watermark, you also need to read the watermark image, resize it, and use the cv2.addWeighted function to superimpose it on the original image.
[0054] When one stage of watermark has been printed, the subsequent border type watermark processing is carried out.
[0055] After reading the image, you need to add a border to the image. Read the four coordinates of the image and input cv2.rectangle(). The coordinates are given in (). The marked coordinates are the coordinates of the upper left corner and the lower right corner, and they include the border. Then you can save it and save the printed avatar to the album.
[0056] S2. Create a new layer
[0057] Create a new blank layer, which will be used to add watermarks. You can create three layers at the same time. After importing the base map, group and merge the three layers with the base map into a new layer. Then you can continue to add new layers and merge them. Each layer has a groupIndex indicating the group number of the layer. You can group a text layer and an image layer into a group, and the position, rotation and other properties of the group can be adjusted as a whole.
[0058] S3. Add text layer
[0059] To add text to an image, the cv2.putText() function is usually used. Specifically, you can enter cv2.putText(image, text, (text_x, text_y), font, font_scale, font_color, line_type) to draw text directly on the image represented by the image variable.
[0060] S4. Create a new tile layer
[0061] When you need to create a tiling watermark effect, you can first draw a watermark pattern, then duplicate the layer and adjust its position and size to form a tiling effect.
[0062] S5. Processing watermark layer
[0063] Adjust the opacity of the watermark layer: Use the cv2.addWeighted() function to simulate this effect, specifically cv2.addWeighted(image,alpha,background,beta,gamma).
[0064] S6. Image export
[0065] After completing the above steps, you can click Export to export the avatar with multiple layers added.
[0066] The steps in steps S1 and S2 are the process steps for watermarking from the user's perspective. The process for operators to configure avatar watermarking is as follows:
[0067] S7. Commission a custom avatar and get a PNG image of the avatar.
[0068] S8. Encrypt and upload the avatar png image and configure it as an avatar product.
[0069] S9. Invite designers to design suitable watermarks for each set of avatars.
[0070] S10. The operator can convert the designer's watermark psd file into watermark json. The operator uses Photoshop naming rules to export the file to the watermark debugging background, and uses the watermark debugging background to parse the psd file to obtain the layer information json. The watermark pattern is the editing status of the background. It is edited and debugged by the watermark debugging background staff, and the final layer json is exported. Then the obtained json is configured to the watermark management background, and the watermark is ready to be put on the shelf.
[0071] S11. Configure watermark json to add watermark.
[0072] S12. Contact the user and ask the user to choose to add a watermark to the avatar on the client.
[0073] S13. When problems occur, operations require help with manual watermarking.
[0074] It should be noted that, in this article, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the statement "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0075] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. A multi-layer adaptive hybrid watermark embedding method based on image protection, characterized in that: The following steps are involved: S1. Prepare the base map First, buy a custom avatar, save it to the desktop, import the necessary libraries into Python, and then read the base map. When reading the map, enter cv2.imread, select the avatar that has been purchased in the personal backpack column to read. You can view the dynamics of the purchased avatar and determine whether it has been watermarked in the first stage. When the first-stage watermark is not printed, it will enter the first-stage printing of plain white, shading, and full-screen watermarks; When adding a plain white watermark, create a pure color image of the same size as the original image, and use the inverse operation of the bitwise operation cv2.bitwise_and to directly assign the white image to the original image; When applying a shading watermark, a texture image is read and resized to match the original image, and then the texture is mixed with the original image using cv2.addWeighted; When adding a full-screen watermark, you also need to read the watermark image, resize it, and use cv2.addWeighted to overlay it on the original image; When one stage of watermark has been printed, the subsequent border type watermark processing is carried out; After reading the image, you need to add a border to the image. Read the four coordinates of the image and input cv2.rectangle(). The coordinates are given in (). The marked coordinates are the coordinates of the upper left corner and the lower right corner, and they include the border. Then you can save it and save the printed avatar to the album. S2. Create a new layer Create a new blank layer. This layer will be used to add watermarks. You can create three layers at the same time. After importing the base map, group and merge the three layers with the base map into a new layer 1. Then you can continue to add new layers and merge them. S3. Add text layer To add text to an image, we usually use the cv2.putText() function. Specifically, we can enter cv2.putText(image,text,(text_x,text_y),font,font_scale, The font_color, line_type) function draws the text directly on the image represented by the image variable; S4. Create a new tile layer When you need to create a tiling watermark effect, you can first draw a watermark pattern, then duplicate the layer and adjust its position and size to form a tiling effect; S5. Processing watermark layer Adjust the opacity of the watermark layer: Use the cv2.addWeighted() function to simulate this effect, specifically cv2.addWeighted(image,alpha,background,beta,gamma); S6. Image export After completing the above steps, you can click Export to export the avatar with multiple layers added.
2. According to claim 1, a multi-layer adaptive hybrid watermark embedding method based on image protection is characterized in that: The steps in steps S1 and S2 are the process steps of watermarking from the user's perspective. The process of configuring the avatar watermarking by the operator is as follows: S7. Get the PNG image of the avatar after commissioning a custom avatar; S8. Encrypt and upload the PNG image of the avatar and configure it as the avatar product; S9. Invite designers to design suitable watermarks for each group of avatars; S10. Operation staff can convert the designer's watermark psd file into watermark json; S11. Configure watermark json to add watermark; S12. Contact the user and ask the user to choose to add a watermark to the avatar on the client; S13. When problems occur, operations require help with manual watermarking.
3. According to claim 2, a multi-layer adaptive hybrid watermark embedding method based on image protection is characterized in that: In the S10, the operator uses the Photoshop naming rules to export files to the watermark debugging background, and uses the watermark debugging background to parse the psd file to obtain the layer information json. The watermark pattern is the editing status of the background. It is edited and debugged by the watermark debugging background personnel, and the final layer json is exported. Then the obtained json is configured to the watermark management background to prepare for the watermark to be put on the shelf.
4. According to claim 3, a multi-layer adaptive hybrid watermark embedding method based on image protection is characterized in that: Each layer in S2 has a groupIndex indicating the group number of the layer. A text layer and an image layer can be grouped into one group, and the position, rotation and other properties of the group can be adjusted as a whole.