Image processing method and device, terminal equipment and storage medium
Patent Information
- Application Number
- CN201910094626.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-01-30
- Publication Date
- 2026-01-16
- Estimated Expiration
- 2039-01-30
Smart Images

Figure CN109816586B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer, and in particular to an image processing method and device, a terminal device and a storage medium. BACKGROUND
[0002] With the continuous development of the times, most of the camera applications or image processing applications of the terminal device currently have a watermark function, which can add a watermark to the photographed image, such as adding a hat watermark to a person in the image, or adding a text watermark in the image, etc., which adds the interest of the image. The method of adding a watermark to an image is usually to directly paste the watermark to be added at the corresponding position in the image, or to extract part of the features of a certain image element in the image and directly put it into the watermark.
[0003] The watermark added by this method cannot be well integrated with the image, making the image after adding the watermark appear relatively rigid, and therefore, how to obtain a high-quality watermark image in the field of image processing has become a research hotspot. SUMMARY
[0004] The embodiments of the present application provide an image processing method, device, terminal device and storage medium, which can obtain a high-quality watermark image.
[0005] In a first aspect, the embodiments of the present application provide an image processing method, comprising:
[0006] obtaining a to-be-processed image;
[0007] obtaining a watermark to be added and determining a target image element in the to-be-processed image based on the watermark to be added;
[0008] obtaining a three-dimensional model corresponding to the watermark to be added;
[0009] performing watermark processing on the to-be-processed image based on the three-dimensional model corresponding to the watermark to be added and the target image element, to obtain a target image.
[0010] Optionally, the determining of the target image element in the to-be-processed image based on the watermark to be added comprises:
[0011] determining a watermark type to which the watermark to be added belongs;
[0012] extracting each image element included in the to-be-processed image;
[0013] determining an image element matched with the watermark type among the each image element as the target image element in the to-be-processed image.
[0014] Optionally, the performing of the watermark processing on the to-be-processed image based on the three-dimensional model corresponding to the watermark to be added and the target image element, to obtain the target image, comprises:
[0015] render the stereoscopic model to be added with the watermark based on the target image element;
[0016] replace the target image element in the image to be processed with the rendered stereoscopic model;
[0017] use the image to be processed after the replacement as the target image.
[0018] Optionally, the rendering of the stereoscopic model to be added with the watermark based on the target image element comprises:
[0019] generating a rendering layer according to the target image element;
[0020] rendering the rendering layer to a corresponding structure of the stereoscopic model according to a structural feature of the stereoscopic model.
[0021] Optionally, the obtaining of the watermark to be added comprises:
[0022] displaying a watermark set corresponding to the image to be processed on a user interface;
[0023] when a selection operation on the watermark set corresponding to the image to be processed is received, determining the watermark corresponding to the selection operation as the watermark to be added.
[0024] Optionally, the image processing method further comprises:
[0025] if the number of image elements matching the watermark type in each image element is at least two, outputting a prompt information, the prompt information being used to prompt the user to select the target image element;
[0026] when an image element selection operation is received, determining the image element corresponding to the image element selection operation as the target image element in the image to be processed.
[0027] Optionally, after the target image is obtained by performing the watermark processing on the image to be processed based on the stereoscopic model corresponding to the watermark to be added and the target image element, the method further comprises:
[0028] displaying a preview image corresponding to the target image on a user interface;
[0029] when a confirmation operation on the preview image is received, storing the target image.
[0030] In a second aspect, an image processing apparatus is provided, comprising an obtaining unit and a processing unit:
[0031] the obtaining unit is configured to obtain an image to be processed, the image to be processed comprising at least one image element that can be stereoscopically watermarked;
[0032] the obtaining unit is further configured to obtain a watermark to be added.
[0033] a processing unit configured to determine a target image element in the image to be processed based on the watermark to be added;
[0034] the acquisition unit is further configured to acquire a three-dimensional model corresponding to the watermark to be added;
[0035] the processing unit is further configured to perform watermark processing on the target image element based on the three-dimensional model corresponding to the watermark to be added, to obtain the target image.
[0036] Optionally, when determining the target image element in the image to be processed based on the watermark to be added, the processing unit performs the following operations:
[0037] determining a watermark type to which the watermark to be added belongs;
[0038] extracting each image element included in the image to be processed;
[0039] determining an image element matching the watermark type as the target image element in the image to be processed.
[0040] Optionally, when performing watermark processing on the image to be processed based on the three-dimensional model corresponding to the watermark to be added and the target image element, to obtain the target image, the processing unit performs the following operations:
[0041] rendering the three-dimensional model of the watermark to be added based on the target image element;
[0042] replacing the target image element in the image to be processed with the rendered three-dimensional model;
[0043] taking the replaced image to be processed as the target image.
[0044] Optionally, when rendering the three-dimensional model of the watermark to be added based on the target image element, the processing unit performs the following operations:
[0045] generating a rendering layer according to the target image element;
[0046] rendering the rendering layer to a corresponding structure of the three-dimensional model according to a structural feature of the three-dimensional model.
[0047] Optionally, when acquiring the watermark to be added, the acquisition unit performs the following operations:
[0048] displaying a watermark set corresponding to the image to be processed on a user interface;
[0049] when receiving a selection operation on the watermark set corresponding to the image to be processed, determining the watermark corresponding to the selection operation as the watermark to be added.
[0050] Optionally, the processing unit is further configured to:
[0051] If the number of image elements matching the watermark type in each image element is at least two, output a prompt information, the prompt information is used to prompt the user to select a target image element;
[0052] When receiving the image element selection operation, determine the image element corresponding to the image element selection operation as the target image element in the image to be processed.
[0053] Optionally, the processing unit is further configured to:
[0054] display a preview image corresponding to the target image on the user interface;
[0055] When receiving a confirmation operation on the preview image, store the target image.
[0056] In a third aspect, an embodiment of the present application provides a terminal device, comprising a processor, a sending device, a receiving device and a memory, the processor, the sending device, the receiving device and the memory are connected with each other, wherein the memory is configured to store a computer program supporting the terminal device to execute the method described above, the computer program comprises program instructions, the processor is configured to invoke the program instructions to execute the image processing method of the first aspect and any optional image processing method thereof.
[0057] In a fourth aspect, an embodiment of the present application provides a computer readable storage medium, the computer readable storage medium stores a computer program, the computer program comprises program instructions, the program instructions make the processor execute the image processing method of the first aspect and any optional image processing method thereof when the processor executes the program instructions.
[0058] In the embodiment of the present application, after the terminal device acquires the image to be processed and the watermark to be added, the target image element in the image to be processed is determined based on the watermark to be added, and further, the image to be processed is processed based on the three-dimensional model corresponding to the watermark to be added and the target image element, so as to obtain the target image, the target image is obtained based on the three-dimensional model corresponding to the watermark to be added and the target image element, therefore, the target image not only includes the shape of the watermark to be added but also includes the characteristics of the target image element, the combination of the watermarking of the image to be processed and the watermark to be added is realized, and a high-quality watermark image can be obtained. BRIEF DESCRIPTION OF DRAWINGS
[0059] In order to more clearly illustrate the technical solutions of the embodiments of the present application or the prior art, the following will briefly introduce the drawings needed to be used in the embodiments or the prior art description. Obviously, the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can also be obtained without creative labor based on these drawings.
[0060] Figure 1ais a flow chart of adding watermark to image provided by an embodiment of the present application;
[0061] Figure 1b is another flow chart of adding watermark to image provided by an embodiment of the present application;
[0062] Figure 2 is a flow chart of image processing method provided by an embodiment of the present application;
[0063] Figure 3 is another flow chart of image processing method provided by an embodiment of the present application;
[0064] Figure 4 is another flow chart of adding watermark to image provided by an embodiment of the present application;
[0065] Figure 5 is a structure diagram of image processing device provided by an embodiment of the present application;
[0066] Figure 6 is a structure diagram of terminal device provided by an embodiment of the present application. DETAILED DESCRIPTION
[0067] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all the other embodiments obtained by those skilled in the art without creative work fall within the protection scope of the present application.
[0068] In the research of adding watermark to image, it is found that the way of adding watermark to the image to be processed can include two-dimensional (2Dimensions, 2d) and three-dimensional (3Dimensions, 3d) ways. The so-called 2d way is to directly paste the watermark to be added to the target image element position of the image to be processed, or to extract the details of the target image element in the image to be processed and directly paste them to the watermark to be added. In an embodiment, the flow chart of adding watermark to the image to be processed in the 2d way can be as shown in Figure 1a and Figure 1b
[0069] In one embodiment, adding a watermark to the to-be-processed image in a 3D manner mainly refers to changing a target image element in the to-be-processed image into a shape of the watermark to be added, that is, synthesizing the target image element and the watermark to be added through 3D operation, so as to realize the watermarking combination of the to-be-processed image and the watermark to be added. It should be understood that adding the watermark to the to-be-processed image in the 3D manner can realize the watermarking combination of the to-be-processed image and the watermark to be added, and obtain a watermark image with high quality. The following embodiments of the present application will specifically introduce the watermark adding method in the 3D manner.
[0070] Reference Figure 2 The image processing method provided by the embodiments of the present application mainly adds a watermark to a to-be-processed image in a 3D manner. The image processing method can be executed by a terminal device, specifically by a processor of the terminal device. Figure 2 The image processing method can include the following steps.
[0071] S201, the terminal device acquires a to-be-processed image.
[0072] In one embodiment, the to-be-processed image refers to an image to be processed for watermarking. The to-be-processed image includes at least one image element that can be stereoscopically processed for watermarking. The image element refers to the existence form of a shooting object in an image. For example, a shooting device shoots a shooting object, such as a person and a tree, to obtain an image. The person and the tree are referred to as image elements in the image.
[0073] In one embodiment, the terminal device can acquire the to-be-processed image in the following manner: the terminal device calls a shooting device in the terminal device to shoot a shooting object, and takes the obtained image as the to-be-processed image. In another embodiment, the terminal device can acquire the to-be-processed image in the following manner: the terminal device selects any one of the historical images obtained by shooting as the to-be-processed image. For example, when the terminal device detects a selection image selection operation input by a user, all historical images can be displayed to the user for selection. When the terminal device detects a selection operation of any one of the images by the user, the terminal device takes the any one of the images as the to-be-processed image. In one embodiment, the terminal device can divide the image elements included in the to-be-processed image into different categories, and the image element categories include a person, a landscape, a building, and others.
[0074] S202, the terminal device acquires a watermark to be added, and determines a target image element in the to-be-processed image based on the watermark to be added.
[0075] In one embodiment, the watermark refers to an image (2D image or 3D image) or text that can be added to an image. Adding a watermark to an image can increase the interest of the image. For example, adding a watermark to an image can be adding a hat to a person in the image, or changing the hairstyle of the person in the image, or adding a text watermark to the image, etc.
[0076] In one embodiment, the manner of obtaining the watermark to be added can be: displaying the watermarks corresponding to the image to be processed on the user interface; and determining the watermark corresponding to the selection operation as the watermark to be added when receiving the selection operation on the watermark corresponding to the image to be processed. Optionally, the terminal device can set a corresponding watermark set for each image element in advance, such as the watermark set set by the terminal device for the human image element, which can include hats, hairstyles, and various human or cartoon animal images, etc.; the terminal device sets a corresponding watermark set for the landscape image element or the building image element, which can include text watermarks and building decoration images, etc. After the terminal device obtains the image to be processed, the watermark set corresponding to the image to be processed can be displayed according to each image element included in the image to be processed for the user to select, and the terminal device determines the watermark corresponding to the selection operation as the watermark to be added when receiving the selection operation of the user on the watermark set. In other embodiments, the terminal device can combine the watermark sets corresponding to all different image elements into one watermark set, and take the watermark set as the watermark set corresponding to the image to be processed.
[0077] In other embodiments, the manner of obtaining the watermark to be added can also be: the terminal device obtains the watermark to be added according to the image element type to which each image element in the image to be processed belongs and the record of the historical watermark processing of the image element type. Specifically, after the terminal device judges the image element type to which each image element in the image to be processed belongs, the terminal device obtains the watermark used most frequently in the historical watermark processing process of the terminal device on the image element type in a predetermined period of time, and determines the watermark used most frequently as the watermark to be added. For example, the image element included in the image to be processed is a human, and the terminal device detects that the watermark used most frequently in the watermark processing of the human image in the past month is the Guantouqiang image, so the terminal device can determine Guantouqiang as the watermark to be added. Optionally, the terminal device can also obtain the watermark used continuously more than a threshold value in the historical watermark processing process of the terminal device on the image element type in a predetermined period of time, and determine the watermark as the watermark to be added.
[0078] In an embodiment, after obtaining the watermark to be added, the terminal device further determines a target image element in the image to be processed, the number of the target image element being at least one, and the target image element being an image element in the image to be processed that needs to be processed with the watermark. In an embodiment, the terminal device can determine the target image element in the image to be processed based on the watermark to be added, specifically, the terminal device takes an image element in the image to be processed that matches the watermark to be added as the target image element. In other embodiments, the terminal device can also determine the target image element in the image to be processed based on the obtained user operation, specifically, the terminal device detects an image element selection operation of the user on the user interface, and determines an image element corresponding to the image element selection operation as the target image element. The above are only two feasible implementation manners listed by the embodiments of the present application, and the terminal device can also determine the target image element in the image to be processed in other manners.
[0079] S203. The terminal device obtains a three-dimensional model corresponding to the watermark to be added.
[0080] In an embodiment, the watermark to be added in the embodiments of the present application is a three-dimensional watermark, or a 3D watermark, and the terminal device can pre-store a correspondence between a three-dimensional model of at least one set of 3D watermarks and a 2D image corresponding to the 3D watermark in a database, for example, a 2D image of the 3D watermark stored in the terminal device is an image of a cartoon character Gou Touqiang, and a corresponding three-dimensional model is a Gou Touqiang 3D model. In an embodiment, the terminal device displays a plurality of 2D images corresponding to 3D watermarks in the user interface for the user to select a watermark to be added, and after obtaining the watermark to be added selected by the user, the terminal device can obtain a three-dimensional model corresponding to the watermark to be added (i.e., the 2D image) from the database. In other embodiments, the terminal device can also be configured to directly display a plurality of 3D watermarks on the user interface, and after obtaining the watermark to be added selected by the user from the plurality of 3D watermarks, the terminal device can directly obtain a three-dimensional model corresponding to the watermark to be added.
[0081] S204. The terminal device processes the image to be processed with the watermark based on the three-dimensional model corresponding to the watermark to be added and the target image element, to obtain a target image.
[0082] In an embodiment, processing the image to be processed with the watermark based on the three-dimensional model corresponding to the watermark to be added and the target image element can mean processing the three-dimensional model corresponding to the watermark to be added according to the image features of the target image element, replacing a position of the target image element in the image to be processed with the processed three-dimensional model, or covering the position of the target image element in the image to be processed with the processed three-dimensional model, so that the image to be processed and the watermark to be added can be combined, and the watermark processed image has a natural and not stiff watermark effect, and a high-quality watermark image is obtained.
[0083] In one embodiment, after obtaining the target image, the terminal device can display a preview image corresponding to the image on the user interface; when receiving a confirmation operation for the preview image, the terminal device stores the target image. It should be understood that displaying the preview image on the user interface can allow the user to verify the target image to determine whether the target image is the effect the user wants, and if so, the user inputs the confirmation operation, and if not, the user can input a reprocessing operation.
[0084] In the embodiment of the present application, after the terminal device obtains the to-be-processed image and the to-be-added watermark, the target image element in the to-be-processed image is determined based on the to-be-added watermark. Further, the to-be-processed image is processed based on the three-dimensional model corresponding to the to-be-added watermark and the target image element, and the target image is obtained. The target image is obtained based on the three-dimensional model corresponding to the to-be-added watermark and the target image element. Therefore, the target image includes the shape of the to-be-added watermark and the features of the target image element, and the combination of the to-be-processed image and the watermarking of the to-be-added watermark is realized, and a high-quality watermark image can be obtained.
[0085] Reference Figure 3 Another image processing method is provided in the embodiment of the present application. The image processing method mainly adds a watermark to a to-be-processed image based on a 3D method. The image processing method can be executed by a terminal device, and specifically executed by a processor of the terminal device. Figure 3 The image processing method can include:
[0086] S301, the terminal device obtains a to-be-processed image.
[0087] In one embodiment, some feasible implementation manners included in step S301 can be referred to the description of corresponding steps in Figure 2 , and will not be described here.
[0088] S302, the terminal device obtains a to-be-added watermark and determines a watermark type to which the to-be-added watermark belongs.
[0089] In one embodiment, after obtaining the to-be-processed image through step S301, the terminal device can obtain the to-be-added watermark, and can determine a target image element in the to-be-processed image based on the to-be-added watermark. Specifically, the terminal device can determine the target image element in the to-be-processed image through steps S302-S304.
[0090] In step S302, the watermark type can include a character watermark, a decoration watermark, a text watermark, and other watermarks, etc. The character watermark refers to a watermark that can be added to a character in an image, such as a hat, a hairstyle, lipstick, a beard, a cartoon character, etc. The decoration watermark refers to a watermark that can be added to a character, a building, or other image elements in an image, such as a Christmas tree decoration. The text watermark can refer to a text that can be added to an image element.
[0091] In step S303, the terminal device extracts each image element included in the to-be-processed image.
[0092] In step S304, the terminal device determines, as a target image element in the to-be-processed image, an image element that matches the watermark type among the image elements.
[0093] In an embodiment, the watermark type and the image element can correspond to each other. For example, the image element is a character, and the corresponding watermark type is a character watermark. The terminal device can determine the target image element from the to-be-processed image according to the obtained to-be-added watermark type.
[0094] Specifically, the terminal device determines the target image from the to-be-processed image based on the watermark type to which the to-be-added watermark belongs, as shown in steps S303 and S304, that is, extracts each image element included in the to-be-processed image, and determines, as a target image element in the to-be-processed image, an image element that matches the watermark type among the image elements.
[0095] In an embodiment, the number of target image elements is at least one. If the number of image elements that match the watermark type among the image elements is one, the terminal device determines the one image element as the target image element, and the number of target image elements is one. If the number of image elements that match the watermark type among the image elements is at least two, the terminal device can determine at least two matched image elements as target image elements, or the terminal device can output at least two matched image elements to the user for the user to select a target image element therefrom, so as to improve the user experience. Specifically, if the number of image elements that match the watermark type among the image elements is at least two, a prompt information is outputted, the prompt information is used to prompt the user to select a target image element. When an image element selection operation is received, an image element corresponding to the image element selection operation is determined as a target image in the to-be-processed image.
[0096] In step S305, the terminal device obtains a three-dimensional model corresponding to the to-be-added watermark, and renders the three-dimensional model based on the target image element.
[0097] In step S306, the terminal device replaces the target image element in the to-be-processed image with the rendered three-dimensional model, to obtain a target image.
[0098] In one embodiment, the image processing method of the present embodiment is mainly to fuse the 3D watermark with the image to be processed naturally, and thus the image to be processed needs to satisfy the stereoscopic watermark processing condition. Therefore, in order to save the power consumption of the terminal, before the terminal device performs the step of acquiring the stereoscopic model corresponding to the watermark to be added in step S305, the terminal device determines whether the target image element satisfies the stereoscopic watermark processing condition. If the stereoscopic watermark condition is satisfied, the terminal device performs the step of acquiring the stereoscopic model corresponding to the watermark to be added. Otherwise, the terminal device can not perform the step of acquiring the stereoscopic model corresponding to the watermark to be added. In one embodiment, determining whether the target image element satisfies the stereoscopic watermark condition can include determining whether the target image element is an image element that can be stereoscopically processed. If the target image element is an image element that can be stereoscopically processed, it is determined that the target image element satisfies the stereoscopic watermark processing condition.
[0099] In another embodiment, if the terminal device determines that the target image element does not satisfy the stereoscopic watermark processing condition, the terminal device can perform 2D watermark processing on the image to be processed according to the selected watermark to be added and the determined target image element. Or the terminal device can also output a prompt information for prompting that the image cannot be processed by 3D watermarking.
[0100] In one embodiment, after the terminal device acquires the stereoscopic model corresponding to the watermark to be added, the terminal device can perform watermark processing on the image to be processed based on the stereoscopic model corresponding to the watermark to be added and the target image element to obtain a target image. Specifically, the terminal device performs watermark processing on the image to be processed based on the stereoscopic model corresponding to the watermark to be added and the target image element to obtain a target image element, including steps S305 and S306. Specifically: rendering the stereoscopic model of the watermark to be added based on the target image element; replacing the target image element in the image to be processed with the rendered stereoscopic model; and taking the replaced image to be processed as the target image.
[0101] In one embodiment, the way of rendering the stereoscopic model of the watermark to be added based on the target image element can be: generating a rendering layer according to the target image element; and rendering the rendering layer to the corresponding structure of the stereoscopic model according to the structural characteristics of the stereoscopic model. It should be understood that rendering the stereoscopic model with the rendering layer generated according to the target image element can make the rendered stereoscopic model include both the shape of the watermark to be added and the characteristics of the target image element. In this way, when the rendered stereoscopic model is combined with the image to be processed, a natural effect can be achieved.
[0102] In one embodiment, if the target image element is a person or an animal, the rendering layer generated according to the target image element can be skin, each stereoscopic model corresponds to a vertex and a bone, and the structural feature of the stereoscopic model refers to the vertex and bone features included in the stereoscopic model. The terminal device renders the rendering layer to the corresponding structure of the stereoscopic model, that is, to the corresponding bone of the stereoscopic model, according to the structural feature of the stereoscopic model. In one embodiment, the terminal device can render the rendering layer to the corresponding bone of the stereoscopic model by using an Open Graphics Library (OpenGL) method.
[0103] For example, assuming that the watermark to be added is a light head, if the target image element is a person, the rendering layer is skin generated according to the characteristics of the person, and the terminal device can use OpenGL to render the generated skin to the corresponding bone in the stereoscopic model of the light head.
[0104] In one embodiment, after the terminal device renders the stereoscopic model according to the rendering layer, the terminal device can process the image to be processed based on the rendered stereoscopic model to obtain a target image in the following manner: replacing the target image element in the image to be processed with the rendered stereoscopic model, or covering the target image element with the rendered stereoscopic model.
[0105] For example, referring to Figure 4 The image processing method provided in the embodiment of the present application assumes that the terminal device obtains a light head as the watermark to be added, determines a person as the target image element of the image to be processed based on the watermark to be added, and then obtains the 3D model of the light head corresponding to the watermark to be added. Further, the terminal device generates skin based on the target image element, and then renders the generated skin to the corresponding bone in the 3D model of the light head by using an OpenGL method. Then, the terminal device deletes the target image element in the image to be processed, and draws the rendered 3D model of the light head to the position of the target image element, thereby obtaining a target image.
[0106] In the embodiment of the present application, after the terminal device obtains the image to be processed and the watermark to be added, the terminal device determines the target image element in the image to be processed based on the watermark to be added. Further, the terminal device processes the image to be processed based on the stereoscopic model corresponding to the watermark to be added and the target image element, thereby obtaining a target image. The target image is obtained based on the stereoscopic model corresponding to the watermark to be added and the target image element. Therefore, the target image includes both the shape of the watermark to be added and the characteristics of the target image element, and the watermarking of the image to be processed and the watermark to be added is combined, thereby obtaining a high-quality watermark image.
[0107] For example, referring to Figure 5A structural schematic diagram of an image processing device provided by an embodiment of the present application is shown in FIG. 1. The image processing device shown in FIG. 1 can include an acquisition unit 501 and a processing unit 502. Figure 5 The acquisition unit 501 is configured to acquire a to-be-processed image, and the to-be-processed image includes at least one image element that can be stereoscopic watermark processed.
[0108] The acquisition unit 501 is configured to acquire a to-be-processed image, and the to-be-processed image includes at least one image element that can be stereoscopic watermark processed.
[0109] The acquisition unit 501 is configured to acquire a to-be-processed image, and the to-be-processed image includes at least one image element that can be stereoscopic watermark processed.
[0110] The processing unit 502 is configured to determine a target image element in the to-be-processed image based on the to-be-added watermark.
[0111] The acquisition unit 501 is configured to acquire a to-be-processed image, and the to-be-processed image includes at least one image element that can be stereoscopic watermark processed.
[0112] The processing unit 502 is further configured to perform watermark processing on the to-be-processed element based on the stereoscopic model corresponding to the to-be-added watermark, to obtain a target image.
[0113] Optionally, when the processing unit 502 determines the target image element in the to-be-processed image based on the to-be-added watermark, the processing unit 502 performs the following operations:
[0114] Determine the watermark type to which the to-be-added watermark belongs;
[0115] Extract each image element included in the to-be-processed image;
[0116] Determine the image element that matches the watermark type in each image element as the target image element in the to-be-processed image.
[0117] Optionally, when the processing unit 502 performs watermark processing on the to-be-processed image based on the stereoscopic model corresponding to the to-be-added watermark and the target image element to obtain a target image, the processing unit 502 performs the following operations:
[0118] Render the stereoscopic model of the to-be-added watermark based on the target image element;
[0119] Replace the target image element in the to-be-processed image with the rendered stereoscopic model;
[0120] The replaced to-be-processed image is used as the target image.
[0121] Optionally, when the processing unit 502 renders the stereoscopic model of the to-be-added watermark based on the target image element, the processing unit 502 performs the following operations:
[0122] Generate a rendering layer according to the target image element;
[0123] Render the rendering layer to the corresponding structure of the stereoscopic model according to the structural characteristics of the stereoscopic model.
[0124] Optionally, the acquisition unit 501 performs the following operation when acquiring the watermark to be added:
[0125] displaying, on the user interface, a set of watermarks corresponding to the image to be processed;
[0126] determining, as the watermark to be added, the watermark corresponding to the selection operation on the set of watermarks corresponding to the image to be processed.
[0127] Optionally, the processing unit 502 is further configured to:
[0128] if the number of image elements matching the watermark type in each image element is at least two, outputting prompt information, the prompt information prompting the user to select a target image element;
[0129] determining, as the target image element in the image to be processed, the image element corresponding to the image element selection operation.
[0130] Optionally, the processing unit 502 is further configured to:
[0131] displaying, on the user interface, a preview image corresponding to the target image;
[0132] storing the target image when receiving a confirmation operation on the preview image.
[0133] In the embodiment of the application, after the acquisition unit 501 acquires the image to be processed and the watermark to be added, the processing unit 502 determines the target image element in the image to be processed based on the watermark to be added, and further performs watermark processing on the image to be processed according to the three-dimensional model corresponding to the watermark to be added and the target image element, to obtain a target image. The target image is obtained based on the three-dimensional model corresponding to the watermark to be added and the target image element, and therefore, the target image includes both the shape of the watermark to be added and the features of the target image element, which realizes the combination of watermarking of the image to be processed and the watermark to be added, and a high-quality watermark image can be obtained.
[0134] It can be understood that the functions of each functional unit of the image processing apparatus in the embodiment and the functions of the units can be implemented according to the methods in the method embodiments described above. Figure 2 and Figure 3 The specific implementation process can refer to the related descriptions of the method embodiments described above. Figure 2 and Figure 3 The specific implementation process can refer to the related descriptions of the method embodiments described above.
[0135] Reference is made to Figure 6Fig. 1 is a structural schematic diagram of a terminal device provided by an embodiment of the present application. The terminal device can include one or more processors 601, one or more sending devices 602, one or more receiving devices 603, and a memory 604. The processor 601, the sending device 602, the receiving device 603, and the memory 604 are connected through a bus 605. The memory 604 is configured to store a computer program, and the computer program includes program instructions. The processor 601 is configured to execute the program instructions stored in the memory 604. The processor 601 is configured to invoke the program instructions to perform the following steps:
[0136] obtaining a to-be-processed image;
[0137] obtaining a to-be-added watermark, and determining a target image element in the to-be-processed image based on the to-be-added watermark;
[0138] obtaining a three-dimensional model corresponding to the to-be-added watermark;
[0139] performing watermark processing on the to-be-processed image based on the three-dimensional model corresponding to the to-be-added watermark and the target image element, to obtain a target image.
[0140] Optionally, the processor 601 performs the following operation when determining the target image element in the to-be-processed image based on the to-be-conditioned watermark:
[0141] determining a watermark type to which the to-be-added watermark belongs;
[0142] extracting each image element included in the to-be-processed image;
[0143] determining an image element matched with the watermark type in each image element as the target image element in the to-be-processed image.
[0144] Optionally, the processor 602 performs the following operation when performing watermark processing on the to-be-processed image based on the three-dimensional model corresponding to the to-be-added watermark and the target image element, to obtain the target image:
[0145] rendering the three-dimensional model of the to-be-added watermark based on the target image element;
[0146] replacing the target image element in the to-be-processed image with the rendered three-dimensional model;
[0147] taking the replaced to-be-processed image as the target image.
[0148] Optionally, the processor 601 performs the following operation when rendering the three-dimensional model of the to-be-added watermark based on the target image element:
[0149] generating a rendering layer according to the target image element;
[0150] According to the structural features of the stereoscopic model, the rendering layer is rendered to the corresponding structure of the stereoscopic model.
[0151] Optionally, the processor 601 performs the following operation when obtaining the watermark to be added:
[0152] displaying a set of watermarks corresponding to the image to be processed on the user interface;
[0153] determining the watermark corresponding to the selection operation as the watermark to be added when receiving the selection operation on the set of watermarks corresponding to the image to be processed.
[0154] Optionally, the processor 601 configured to invoke program instructions further performs:
[0155] outputting prompt information if the number of image elements matching the watermark type in each image element is at least two, the prompt information prompting the user to select a target image element;
[0156] determining the image element corresponding to the image element selection operation as the target image element in the image to be processed when receiving the image element selection operation.
[0157] Optionally, the processor 601 configured to invoke program instructions further performs:
[0158] displaying a preview image corresponding to the target image on the user interface;
[0159] storing the target image when receiving the confirmation operation on the preview image.
[0160] It should be understood that, in the embodiments of the present application, the processor 601 can be a central processing unit (CPU), and the processor can also be other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor.
[0161] The sending device 602 is configured to send data, and the receiving device 603 is configured to receive data.
[0162] The memory 603 can include a read-only memory and a random access memory, and provide instructions and data to the processor 601. A portion of the memory 603 can also include a non-volatile random access memory. For example, the memory 603 can also store device type information.
[0163] In a specific implementation, the processor 601 described in the embodiments of the present application can execute Figure 2 and Figure 3 The implementation manner described in the embodiments of the image processing method provided can also be executed Figure 5 The implementation manner of the image processing apparatus described will not be repeated here.
[0164] In the embodiments of the present application, a computer readable storage medium is provided, which stores a computer program. The computer program includes program instructions, and the program instructions are executed by a processor to implement Figure 2 and Figure 3 The implementation manner described in the embodiments of the image processing method provided can also be executed Figure 5 The implementation manner of the image processing apparatus described will not be repeated here.
[0165] It can be understood by those skilled in the art that all or part of the processes in the above-mentioned embodiments can be completed by a computer program instructing related hardware. The program can be stored in a computer readable storage medium, and when the program is executed, the processes of the above-mentioned embodiments can be included. The storage medium can be a magnetic disc, an optical disc, a read-only memory (ROM) or a random access memory (RAM), etc.
[0166] The above only discloses a preferred embodiment of the present application, and of course cannot limit the scope of the present application. Those skilled in the art can understand that all or part of the above-mentioned embodiments can be implemented, and equivalent changes made according to the claims of the present application still fall within the scope of the present application.
Claims
1. An image processing method, characterized by, The method comprises the following steps: acquiring a to-be-processed image, wherein the to-be-processed image comprises at least one image element capable of being stereoscopic watermark processed, and each image element is provided with a corresponding set of watermarks; acquiring a to-be-added watermark, comprising: displaying the watermarks corresponding to the to-be-processed image on a user interface, and determining the watermark corresponding to the selection operation as the to-be-added watermark when receiving the selection operation for the watermark corresponding to the to-be-processed image; or acquiring the to-be-added watermark according to the image element type to which each image element in the to-be-processed image belongs and the historical record of watermark processing on the image element type; determining a target image element in the to-be-processed image based on the to-be-added watermark, comprising: determining the watermark type to which the to-be-added watermark belongs; extracting each image element included in the to-be-processed image; and determining the image element matching the watermark type in the image elements as the target image element in the to-be-processed image; acquiring a stereoscopic model corresponding to the to-be-added watermark; performing watermark processing on the to-be-processed image based on the stereoscopic model corresponding to the to-be-added watermark and the target image element to obtain a target image, comprising: rendering the stereoscopic model of the to-be-added watermark based on the target image element; replacing the target image element in the to-be-processed image with the rendered stereoscopic model; and taking the to-be-processed image after the replacement processing as the target image.
2. The method of claim 1, wherein, The rendering of the stereoscopic model of the to-be-added watermark based on the target image element comprises: generating a rendering layer according to the target image element; rendering the rendering layer to the corresponding structure of the stereoscopic model according to the structural characteristics of the stereoscopic model.
3. The method of claim 1, wherein, The acquiring of the to-be-added watermark comprises: displaying the set of watermarks corresponding to the to-be-processed image on a user interface; determining the watermark corresponding to the selection operation as the to-be-added watermark when receiving the selection operation for the set of watermarks corresponding to the to-be-processed image.
4. The method of claim 1, wherein, The method further comprises: if the number of image elements matching the watermark type in the image elements is at least two, outputting prompt information for prompting the user to select a target image element; when receiving an image element selection operation, determining the image element corresponding to the image element selection operation as the target image element in the to-be-processed image.
5. The method of claim 1, wherein, After the watermark processing on the to-be-processed image based on the stereoscopic model corresponding to the to-be-added watermark and the target image element to obtain a target image, the method further comprises: displaying a preview image corresponding to the target image on a user interface; when receiving a confirmation operation for the preview image, storing the target image.
6. An image processing apparatus characterized by comprising: The method comprises the following steps: an acquiring unit is configured to acquire a to-be-processed image, wherein the to-be-processed image comprises at least one image element capable of being stereoscopic watermark processed, and each image element is provided with a corresponding set of watermarks; The acquisition unit is further configured to acquire a watermark to be added, including: displaying a watermark corresponding to the to-be-processed image on a user interface, and determining the watermark corresponding to the selection operation as the watermark to be added when receiving a selection operation on the watermark corresponding to the to-be-processed image; or acquiring the watermark to be added according to an image element type to which each image element in the to-be-processed image belongs and a historical record of watermark processing on the image element type; The processing unit is configured to determine a target image element in the to-be-processed image based on the watermark to be added, including: determining a watermark type to which the watermark to be added belongs; extracting each image element included in the to-be-processed image; and determining an image element matching the watermark type from the each image element as the target image element in the to-be-processed image; The acquisition unit is further configured to acquire a three-dimensional model corresponding to the watermark to be added. The processing unit is further configured to perform watermark processing on the to-be-processed image based on the three-dimensional model corresponding to the watermark to be added and the target image element, to obtain a target image, including: rendering the three-dimensional model of the watermark to be added based on the target image element; replacing the target image element in the to-be-processed image with the rendered three-dimensional model; and taking the to-be-processed image after the replacement processing as the target image.
7. A terminal device, characterized by, including: A processor, a sending device, a receiving device and a memory, the processor, the sending device, the receiving device and the memory are connected to each other, the memory is configured to store a computer program, the computer program includes program instructions, the processor is configured to invoke the program instructions to execute the image processing method in any one of claims 1-5.
8. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a computer program, the computer program includes program instructions, the program instructions make the processor execute the image processing method in any one of claims 1-5 when the processor executes the program instructions.
Citation Information
Patent Citations
Video processing method and device
CN108696699A
Special effect processing method, device and electronic device based on three-dimensional model
CN109147037A