Method and device for generating virtual objects, electronic device and storage medium
By dividing the target part of the virtual object into highlight, shadow and mid-tone areas and performing corresponding rendering processing, the problem of authenticity and naturalness of the virtual object in image change is solved, and more realistic and natural virtual object generation is achieved.
Patent Information
- Application Number
- CN202111137693.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-27
- Publication Date
- 2025-09-16
- Estimated Expiration
- 2041-09-27
AI Technical Summary
It is difficult in the existing technology to maintain the real and natural effect of the virtual object during the image change process, especially the change in color and image.
By obtaining the target part of the original virtual object, dividing it into highlight area, shadow area and mid-tone area according to the tone information, and performing tone matching rendering processing on each area, the target virtual object is generated.
The realism and naturalness of virtual objects are improved, so that the changed virtual objects maintain their original color distribution, with higher realism and natural effects.
Smart Images

Figure CN113870400B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer vision, and in particular to a method and device for generating a virtual object, an electronic device, and a storage medium. Background Art
[0002] With the development of computer vision technology, virtual objects that can interact with users have been increasingly used in people's lives, such as anthropomorphic objects in various smart devices.
[0003] However, as the application scenarios change, these anthropomorphic objects may need to undergo changes in image or color. How to ensure that the changed objects still have a relatively realistic and natural character effect has become a problem that needs to be solved urgently. Summary of the Invention
[0004] The present disclosure proposes a solution for generating virtual objects.
[0005] According to one aspect of the present disclosure, there is provided an image processing method, comprising:
[0006] Obtain a target part to be processed in the original virtual object; divide the target part into multiple target areas according to the hue information of the target part; render the multiple target areas according to preset color parameters to match the hue of the target areas to obtain multiple rendering results; and generate a target virtual object based on the multiple rendering results.
[0007] In a possible implementation, obtaining the target part to be processed in the original virtual object includes: obtaining the original virtual object, wherein the original virtual object is generated according to virtual information; and extracting the target part to be processed from the original virtual object according to the virtual information.
[0008] In a possible implementation, the virtual information includes: preset virtual object generation information, and / or virtual object control information generated in response to a user's action.
[0009] In one possible implementation, the hue information includes one or more of highlight information, shadow information, and midtone information; dividing the target part into multiple target areas based on the hue information of the target part includes one or more of the following operations: extracting a highlight area from the target part based on the highlight information of the target part; and / or extracting a shadow area from the target part based on the shadow information of the target part; and / or extracting a midtone area from the target part based on the midtone information of the target part.
[0010] In one possible implementation, the highlight area is extracted from the target part based on the highlight information of the target part, including: performing overlay blending based on the grayscale image of the target part to obtain a first blending result; determining a first transparency of the pixel points in the target part based on the first blending result; and extracting the pixel points in the target part based on a first preset transparency threshold and the first transparency to obtain the highlight area.
[0011] In one possible implementation, the shadow area is extracted from the target part based on the shadow information of the target part, including: performing positive overlay blending based on the inverse grayscale image of the target part to obtain a second blending result; determining the second transparency of the pixel points in the target part according to the second blending result; and extracting the pixel points in the target part according to a second preset transparency threshold and the second transparency to obtain the shadow area.
[0012] In one possible implementation, the midtone area is extracted from the target part based on the midtone information of the target part, including: performing exclusion blending based on the grayscale image of the target part to obtain a third blending result; determining a third transparency of the pixel points in the target part according to the third blending result; and extracting the pixel points in the target part according to a third preset transparency threshold and the third transparency to obtain the midtone area.
[0013] In one possible implementation, the rendering processing is performed on the multiple target areas according to preset color parameters to match the color tone of the target areas to obtain multiple rendering results, including: rendering the multiple target areas according to the preset color parameters to obtain multiple intermediate rendering results; determining the processing methods corresponding to the multiple target areas according to the color tone of the multiple target areas; and mixing the grayscale images of the target parts with the multiple intermediate rendering results according to the processing methods corresponding to the multiple target areas to obtain multiple rendering results.
[0014] In one possible implementation, the target area includes one or more of a highlight area, a shadow area, and a midtone area; and the processing methods corresponding to the multiple target areas are determined according to the color tones of the multiple target areas, including: when the target area includes a highlight area, determining that the processing method includes color filter blending; when the target area includes a shadow area, determining that the processing method includes overlay blending; when the target area includes a midtone area, determining that the processing method includes normal blending.
[0015] In one possible implementation, generating a target virtual object based on the multiple rendering results includes: superimposing the multiple rendering results to obtain a target rendering result; and rendering a target part of the original virtual object using the target rendering result based on preset rendering parameters to obtain the target virtual object.
[0016] In a possible implementation, the method further includes: in response to an interaction operation on the target virtual object, controlling the target virtual object to perform a virtual action matching the interaction information according to interaction information in the interaction operation.
[0017] According to one aspect of the present disclosure, there is provided an image processing apparatus, comprising:
[0018] An acquisition module is used to obtain the target part to be processed in the original virtual object; a division module is used to divide the target part into multiple target areas according to the color tone information of the target part; a rendering module is used to render the multiple target areas according to preset color parameters to match the color tone of the target areas, thereby obtaining multiple rendering results; and a generation module is used to generate the target virtual object based on the multiple rendering results.
[0019] In a possible implementation, the acquisition module is configured to: acquire an original virtual object, wherein the original virtual object is generated according to virtual information; and extract the target part to be processed from the original virtual object according to the virtual information.
[0020] In a possible implementation, the virtual information includes: preset virtual object generation information, and / or virtual object control information generated in response to a user's action.
[0021] In one possible implementation, the hue information includes one or more of highlight information, shadow information, and midtone information; the division module is used to: extract a highlight area from the target part based on the highlight information of the target part; and / or extract a shadow area from the target part based on the shadow information of the target part; and / or extract a midtone area from the target part based on the midtone information of the target part.
[0022] In one possible implementation, the division module is further used to: perform overlay blending based on the grayscale image of the target part to obtain a first blending result; determine the first transparency of the pixel points in the target part based on the first blending result; extract the pixel points in the target part based on a first preset transparency threshold and the first transparency to obtain the highlight area.
[0023] In one possible implementation, the segmentation module is further used to: perform overlay blending based on the inverse grayscale image of the target part to obtain a second blending result; determine the second transparency of the pixel points in the target part based on the second blending result; extract the pixel points in the target part based on a second preset transparency threshold and the second transparency to obtain the shadow area.
[0024] In one possible implementation, the segmentation module is further used to: perform exclusion blending based on the grayscale image of the target part to obtain a third blending result; determine a third transparency of the pixel points in the target part based on the third blending result; extract the pixel points in the target part based on a third preset transparency threshold and the third transparency to obtain the midtone area.
[0025] In one possible implementation, the rendering module is configured to: render the multiple target areas separately according to the preset color parameters to obtain multiple intermediate rendering results; determine, based on the color tones of the multiple target areas, corresponding processing methods to the multiple target areas; and mix the grayscale images of the target areas with the multiple intermediate rendering results according to the processing methods corresponding to the multiple target areas to obtain multiple rendering results.
[0026] In one possible implementation, the target area includes one or more of a highlight area, a shadow area, and a midtone area; the rendering module is further used to: when the target area includes a highlight area, determine that the processing method includes color filter blending; when the target area includes a shadow area, determine that the processing method includes overlay blending; when the target area includes a midtone area, determine that the processing method includes normal blending.
[0027] In a possible implementation, the generation module is configured to: superimpose the multiple rendering results to obtain a target rendering result; and based on preset rendering parameters, use the target rendering result to render a target part of the original virtual object to obtain the target virtual object.
[0028] In a possible implementation, the apparatus is further configured to: in response to an interactive operation on the target virtual object, control the target virtual object to perform a virtual action matching the interactive information according to interactive information in the interactive operation.
[0029] According to one aspect of the present disclosure, an electronic device is provided, comprising: a processor; and a memory for storing processor-executable instructions; wherein the processor is configured to: execute the above-mentioned image processing method.
[0030] According to one aspect of the present disclosure, a computer-readable storage medium is provided, on which computer program instructions are stored. When the computer program instructions are executed by a processor, the above-mentioned image processing method is implemented.
[0031] In an embodiment of the present disclosure, in response to obtaining a target portion to be processed in an original virtual object, the target portion is divided into multiple target regions based on the hue information of the target portion, and rendering is performed on each of the multiple target regions according to preset color parameters to match the hue of the target region, thereby obtaining multiple rendering results and generating a target virtual object based on the multiple rendering results. Through the above process, the target portion of the virtual object can be divided into multiple target regions based on the hue of the target portion, and the multiple target regions are rendered accordingly. Therefore, during the process of changing the image of the virtual object, the original hue information of the original virtual object can still be used to obtain a target virtual object with a relatively realistic and natural effect. For example, the target portion can be divided into a highlight region, a shadow region, and a midtone region based on the hues of highlights, shadows, and midtones. Therefore, during the rendering process of the highlight region, the rendering brightness is increased as much as possible, during the rendering process of the shadow region, the rendering brightness is reduced as much as possible, and during the rendering process of the midtone region, the rendering brightness is maintained as much as possible. This ensures that the rendering effect of the target virtual object matches the original hue distribution of the original virtual object, thereby improving the realism and naturalness of the target virtual object.
[0032] It should be understood that the above general description and the following detailed description are only exemplary and explanatory, rather than limiting the present disclosure. Other features and aspects of the present disclosure will become clear from the following detailed description of exemplary embodiments with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] The accompanying drawings herein are incorporated into and constitute a part of the specification. These drawings illustrate embodiments consistent with the present disclosure and, together with the specification, are used to explain the technical solutions of the present disclosure.
[0034] Figure 1 A flowchart of a method for generating a virtual object according to an embodiment of the present disclosure is shown.
[0035] Figure 2 A schematic diagram illustrating a target site according to an embodiment of the present disclosure.
[0036] Figure 3 A schematic diagram illustrating a first mixing result according to an embodiment of the present disclosure.
[0037] Figure 4 A schematic diagram illustrating a highlight area according to an embodiment of the present disclosure is shown.
[0038] Figure 5 A schematic diagram illustrating a second mixing result according to an embodiment of the present disclosure.
[0039] Figure 6 A schematic diagram illustrating a shaded area according to an embodiment of the present disclosure.
[0040] Figure 7 A schematic diagram illustrating a third mixing result according to an embodiment of the present disclosure.
[0041] Figure 8 A schematic diagram illustrating a midtone area according to an embodiment of the present disclosure.
[0042] Figure 9 A schematic diagram illustrating a rendering result of a highlight area according to an embodiment of the present disclosure.
[0043] Figure 10 A schematic diagram illustrating a rendering result of a shadow area according to an embodiment of the present disclosure.
[0044] Figure 11 A schematic diagram illustrating a rendering result of a midtone area according to an embodiment of the present disclosure.
[0045] Figure 12 A schematic diagram illustrating a target virtual object according to an embodiment of the present disclosure is shown.
[0046] Figure 13 A block diagram illustrating a device for generating a virtual object according to an embodiment of the present disclosure is shown.
[0047] Figure 14 A block diagram of an electronic device according to an embodiment of the present disclosure is shown.
[0048] Figure 15 A block diagram of an electronic device according to an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0049] Various exemplary embodiments, features, and aspects of the present disclosure will be described in detail below with reference to the accompanying drawings. The same reference numerals in the accompanying drawings represent elements with the same or similar functions. Although various aspects of the embodiments are shown in the accompanying drawings, the drawings are not necessarily drawn to scale unless otherwise indicated.
[0050] The word “exemplary” is used exclusively herein to mean “serving as an example, example, or illustration.” Any embodiment described herein as “exemplary” is not necessarily to be construed as preferred or advantageous over other embodiments.
[0051] The term "and / or" herein simply describes an association relationship between associated objects, indicating that three relationships can exist. For example, "A and / or B" can represent the existence of three situations: A alone, A and B simultaneously, and B alone. Furthermore, the term "at least one" herein refers to any combination of at least two of any one or more of a plurality of items. For example, "at least one of A, B, and C" can represent any one or more elements selected from the set consisting of A, B, and C.
[0052] In addition, numerous specific details are provided in the following detailed description to better illustrate the present disclosure. Those skilled in the art will appreciate that the present disclosure can be practiced without certain specific details. In some instances, methods, means, components, and circuits well known to those skilled in the art are not described in detail in order to highlight the main points of the present disclosure.
[0053] Figure 1 A flowchart of a method for generating a virtual object according to an embodiment of the present disclosure is shown. The method can be applied to an image processing device or an image processing system, and the image processing device can be a terminal device, a server, or other processing device. The terminal device can be a user equipment (UE), a mobile device, a user terminal, a terminal, a cellular phone, a cordless phone, a personal digital assistant (PDA), a handheld device, a computing device, an in-vehicle device, a wearable device, etc. In one example, the image processing method can be applied to a cloud server or a local server, and the cloud server can be a public cloud server or a private cloud server, which can be flexibly selected according to actual circumstances.
[0054] In some possible implementations, the image processing method may also be implemented by a processor calling computer-readable instructions stored in a memory.
[0055] like Figure 1 As shown, in a possible implementation, the image processing method may include:
[0056] Step S11: obtaining the target part to be processed in the original virtual object.
[0057] Among them, the original virtual object can be any virtual object with the need to change its image, for example, it can be a digital virtual object displayed on the screen of a smart device such as a computer and interacting with the user, such as a digital human, or a virtual object displayed on the screen and can be driven according to the user's actions and act according to the user's actions, such as an Avatar or other online virtual image.
[0058] The target part can be any part of the original virtual object that needs to be transformed. The target part includes which parts and its implementation form can be flexibly determined according to actual conditions. For example, the target part can be the hair part, the face part, the lip part or the eye part, etc. As the target part is different, the way of processing the original virtual object can also be flexibly changed.
[0059] The implementation of step S11 can be flexibly determined according to actual conditions. Please refer to the following disclosed embodiments for details, which will not be expanded here.
[0060] Step S12: dividing the target part into a plurality of target areas according to the hue information of the target part.
[0061] The hue information can reflect the relative brightness of the target area. The information content of the hue information can be flexibly determined according to actual conditions. In one possible implementation, the hue information can include one or more of highlight information, shadow information, and mid-tone information.
[0062] Among them, highlight information can reflect the area with higher brightness in the target part, shadow information can reflect the area with lower brightness in the target part, and midtone information can reflect the area with brightness between highlight and shadow in the target part.
[0063] Different hue information can be determined from the target area using different hue methods. In some possible implementations, the hue information can be directly obtained based on the brightness of pixels in the target area. In some possible implementations, the target area can also be processed in different ways to obtain different hue information. The methods for obtaining hue information can be found in the following disclosed embodiments and will not be elaborated here.
[0064] The region type and region position included in the target region can be flexibly determined based on the actual situation of the hue information in the target part. There may be overlapping regions between multiple target regions, or they may be independent of each other, which is not limited in the disclosed embodiment.
[0065] In some possible implementations, the target area may include one or more of a highlight area, a shadow area, and a mid-tone area.
[0066] The method for dividing the target part into multiple target areas based on the hue information can be flexibly changed depending on the hue information. For example, the pixels in the target part can be divided into highlight areas, shadow areas, and midtone areas based on the acquired highlight information, shadow information, and midtone information. Some possible implementations of step S12 can be found in the following disclosed embodiments and will not be elaborated here.
[0067] Step S13 , performing rendering processing on the multiple target areas according to the preset color parameters so as to match the color tone of the target areas, and obtaining multiple rendering results.
[0068] The preset color parameters may be colors related to rendering the target area, and may be in the form of color values or RGB channel values. For multiple target areas, the preset color parameters corresponding to different target areas may be the same or different, and may be flexibly set based on actual conditions, without being limited to the embodiments of the present disclosure.
[0069] The rendering result may be the result obtained after the target area is rendered. Depending on the target area, the rendering process may also vary. Therefore, corresponding rendering processes may be performed on multiple target areas to obtain multiple rendering results. Some possible implementations of step S13 can be found in the following disclosed embodiments and will not be expanded upon here.
[0070] Step S14: generating a target virtual object according to the multiple rendering results.
[0071] The target virtual object may be a virtual object obtained by modifying or processing the target portion of the original virtual object. The method for generating the target virtual object can be flexibly determined based on actual circumstances. For example, multiple rendering results may be fused to obtain the target virtual object, or multiple rendering results may be fused with the original virtual object to obtain the target virtual object. In some possible implementations, the multiple rendering results may also belong to multiple layers. In this case, the target virtual object can be obtained by overlaying the layers.
[0072] Some possible implementations of step S14 can be found in the following disclosed embodiments and will not be expanded here.
[0073] In an embodiment of the present disclosure, in response to obtaining a target portion to be processed in an original virtual object, the target portion is divided into multiple target regions based on the hue information of the target portion, and rendering is performed on each of the multiple target regions according to preset color parameters to match the hue of the target region, thereby obtaining multiple rendering results and generating a target virtual object based on the multiple rendering results. Through the above process, the target portion of the virtual object can be divided into multiple target regions based on the hue of the target portion, and the multiple target regions are rendered accordingly. Therefore, during the process of changing the image of the virtual object, the original hue information of the original virtual object can still be used to obtain a target virtual object with a relatively realistic and natural effect. For example, the target portion can be divided into a highlight region, a shadow region, and a midtone region based on the hues of highlights, shadows, and midtones. Therefore, during the rendering process of the highlight region, the rendering brightness is increased as much as possible, during the rendering process of the shadow region, the rendering brightness is reduced as much as possible, and during the rendering process of the midtone region, the rendering brightness is maintained as much as possible. This ensures that the rendering effect of the target virtual object matches the original hue distribution of the original virtual object, thereby improving the realism and naturalness of the target virtual object.
[0074] In a possible implementation, step S11 may include:
[0075] Acquire an original virtual object, wherein the original virtual object is generated according to the virtual information;
[0076] According to the virtual information, the target part to be processed is extracted from the original virtual object.
[0077] The implementation of the original virtual object can refer to the above disclosed embodiments, which will not be described in detail here. In a possible implementation, the original virtual object can be generated according to the virtual information.
[0078] Virtual information can be electronic data or information stored in various smart devices or servers. The information content included in the virtual information may also change with the type of virtual object.
[0079] For example, for virtual objects such as digital humans that interact with users according to system control, the virtual information may include virtual object generation information preset in the system. The preset virtual object generation information can be used to generate the original virtual object. The information content included is not limited in the embodiments of the present disclosure. For example, it may include an image of the target part in the original virtual object or the position of the target part in the original image of the original virtual object.
[0080] In one example, for virtual objects such as avatars that can be driven based on user actions, the virtual information may include preset virtual object generation information and / or virtual object control information generated in response to the user's actions. This control information may control the actions and sounds of the original virtual object in response to the user's actions, thereby enabling interaction between the original virtual object and the user. The information content included in this control information is also not limited in the embodiments of the present disclosure. In one example, the control information may also include an image of a target part in the original virtual object or the position of the target part in the original image of the original virtual object.
[0081] As described in the above disclosed embodiments, the virtual information may contain different information content, so the method of obtaining the target part according to the virtual information can be flexibly selected. For example, the image of the target part can be directly obtained from the virtual information, such as directly obtaining a hair map, a lip map, or an eye map. Figure 2 A schematic diagram of a target part according to an embodiment of the present disclosure is shown. As can be seen from the figure, in one example, a hair map can be directly obtained from virtual information to obtain the target part.
[0082] In some possible implementations, the image of the target part may be obtained by intercepting or extracting it from the original image of the original virtual object according to the position of the target part in the virtual information.
[0083] Through the embodiments of the present disclosure, the target part to be processed can be directly obtained based on the virtual information of the original virtual object. The acquisition method is simple and fast, thereby improving the efficiency of the entire virtual object generation process.
[0084] In a possible implementation, step S12 may include one or more of the following operations:
[0085] Step S121: extracting a highlight area from the target part based on the highlight information of the target part. And / or,
[0086] Step S122: extracting a shadow area from the target part based on the shadow information of the target part. And / or,
[0087] Step S123 : extracting a mid-tone area from the target part based on the mid-tone information of the target part.
[0088] The numbers of step S121, step S122, and step S123 are used only to distinguish the different steps described above and do not limit the order in which the different steps are implemented. The different steps can be performed simultaneously or sequentially, and the order is not limited in the embodiments of the present disclosure. Step S12 can include all three steps described above, or selectively perform some of the steps.
[0089] Through the embodiments of the present disclosure, the target part can be flexibly divided into one or more of highlight area, shadow area and midtone area according to one or more of highlight information, shadow information and midtone information, thereby effectively improving the flexibility of processing the target part and facilitating the flexible and rapid generation of virtual objects.
[0090] In a possible implementation, step S121 may include:
[0091] Performing a positive overlay blend based on the grayscale image of the target part to obtain a first blending result;
[0092] Determining a first transparency of a pixel point in the target portion according to the first mixing result;
[0093] According to the first preset transparency threshold and the first transparency, pixel points in the target part are extracted to obtain a highlight area.
[0094] The grayscale image of the target area may be an image obtained by grayscale processing the target area. The multiplication mixing based on the grayscale image of the target area may be multiplying the grayscale image of the target area itself to obtain the first mixed result. Specifically, the grayscale image of the target area may be copied and then multiplied based on the two identical grayscale images to obtain the first mixed result. Figure 3 A schematic diagram of a first mixing result according to an embodiment of the present disclosure is shown. As shown in the figure, in one example, the first mixing result obtained by processing the grayscale image can reflect the highlight information of the target part.
[0095] Therefore, based on the first mixed result, the highlight area in the target part can be further determined.
[0096] Specifically, the alpha channel value of each pixel in the first mixed result can be obtained. This alpha channel value can be mapped to a transparency value through a mapping relationship between grayscale and transparency, thereby determining the first transparency of each pixel in the target area. The specific mapping method of the mapping relationship can be flexibly set according to actual conditions and is not limited in the present embodiment.
[0097] The first preset threshold may be a preset threshold for screening pixel points belonging to the highlight area in the target part. The specific value of the first preset threshold is not limited in the embodiment of the present disclosure.
[0098] According to the first preset threshold, it can be determined whether the first transparency of each pixel point in the target part is within the range of the first preset threshold. If so, it is determined that the pixel point belongs to the highlight area; otherwise, it is considered that the pixel point belongs to the area outside the highlight area. Through the above screening process, multiple pixel points belonging to the highlight area can be screened from the target part, and then the pixel points belonging to the highlight area in the target part are extracted to obtain the highlight area. Figure 4 A schematic diagram of a highlight area according to an embodiment of the present disclosure is shown. It can be seen from the figure that the highlight area can be effectively and accurately extracted from the target part through the method proposed in the embodiment of the present disclosure.
[0099] Through the embodiment of the present disclosure, a first mixing result reflecting highlight information can be obtained by performing overlay mixing on the grayscale image of the target part, and then a highlight area can be extracted from the target part based on the mixing result. This method of obtaining highlight information is fast and convenient, and has high accuracy. While improving the processing efficiency of the target part, it can effectively improve the accuracy of the target part after processing, and then improve the real effect of the generated target virtual object.
[0100] In a possible implementation, step S122 may include:
[0101] Based on the inverse grayscale image of the target part, perform positive overlay blending to obtain a second blending result;
[0102] determining a second transparency of the pixel points in the target area according to the second mixing result;
[0103] According to the second preset transparency threshold and the second transparency, pixel points in the target part are extracted to obtain a shadow area.
[0104] The inverse grayscale image of the target part may be an image obtained by performing inverse grayscale processing on each pixel in the target part. The inverse grayscale may linearly or nonlinearly invert the grayscale range of the image of the target part to obtain an image opposite to the grayscale image of the target part. The overlay mixing based on the inverse grayscale image of the target part may be performed by overlaying the inverse grayscale image of the target part itself to obtain a second mixed result. The implementation method thereof may refer to the method of performing overlay mixing based on the grayscale image of the target part to obtain the first mixed result, and will not be described in detail here. Figure 5 A schematic diagram of a second mixed result according to an embodiment of the present disclosure is shown. As shown in the figure, in one example, the second mixed result obtained by processing the grayscale image can reflect the shadow information of the target part.
[0105] Therefore, based on the second mixed result, the shadow area in the target part can be further determined.
[0106] Specifically, the alpha channel value of each pixel in the second mixed result can be obtained. This alpha channel value can be mapped to a transparency value through a mapping relationship between grayscale and transparency, thereby determining the second transparency of each pixel in the target area. The mapping relationship can be referred to in the above-disclosed embodiment and will not be repeated here.
[0107] The second preset threshold may be a preset threshold for screening pixels in the target area that belong to the shadow area. The specific value of the second preset threshold is not limited in the embodiment of the present disclosure. In one possible implementation, the second preset threshold and the first preset threshold have different values.
[0108] According to the second preset threshold, it can be determined whether the second transparency of each pixel point in the target part is within the range of the second preset threshold. If so, it is determined that the pixel point belongs to the shadow area; otherwise, it is considered that the pixel point belongs to the area outside the shadow area. Through the above screening process, multiple pixel points belonging to the shadow area can be screened from the target part, and then the pixel points belonging to the shadow area in the target part are extracted to obtain the shadow area. Figure 6 A schematic diagram of a shadow area according to an embodiment of the present disclosure is shown. It can be seen from the figure that the shadow area can be effectively and accurately extracted from the target part through the method proposed in the embodiment of the present disclosure.
[0109] Through the embodiment of the present disclosure, the reverse grayscale image of the target part can be used to perform overlay blending to obtain a second blending result reflecting the shadow information, and thus the shadow area can be extracted from the target part based on the blending result. This method of obtaining shadow information is fast and convenient, and is convenient for batch processing at the same time as the method of obtaining highlight information, with high accuracy, further improving the efficiency of determining the target part and the processing accuracy, thereby improving the display effect of the target virtual object.
[0110] In a possible implementation, step S123 may include:
[0111] Based on the grayscale image of the target part, perform exclusion blending to obtain a third blending result;
[0112] determining a third transparency of the pixel points in the target portion according to the third mixing result;
[0113] Pixel points in the target portion are extracted according to the third preset transparency threshold and the third transparency to obtain a mid-tone area.
[0114] The implementation of the grayscale image of the target area can refer to the above-mentioned disclosed embodiments and will not be described in detail here. Exclusion blending based on the grayscale image of the target area can be performed by performing exclusion blending on the grayscale image of the target area itself to obtain a third blending result. The implementation of this can refer to the above-mentioned disclosed embodiments and will not be described in detail here. Exclusion blending can be an image blending mode in Photoshop editing software that can change the brightness and grayscale of an image. Based on the result of this exclusion blending, the midtone information of the target area can be obtained. Figure 7 A schematic diagram of a third mixed result according to an embodiment of the present disclosure is shown. As shown in the figure, in one example, the third mixed result obtained by processing the grayscale image can reflect the mid-tone information of the target part.
[0115] Therefore, based on the third mixing result, the mid-tone area in the target area can be further determined.
[0116] Specifically, the alpha channel value of each pixel in the third mixed result can be obtained. This alpha channel value can be mapped to a transparency value through a mapping relationship between grayscale and transparency, thereby determining the third transparency of each pixel in the target area. The mapping relationship can be referred to in the above-disclosed embodiment and will not be repeated here.
[0117] The third preset threshold may be a preset threshold for screening pixels in the target area belonging to the midtone region. The specific value of the third preset threshold is not limited in the disclosed embodiments. In one possible implementation, the third preset threshold is different from the values of the second preset threshold and the first preset threshold.
[0118] According to the third preset threshold, it can be determined whether the third transparency of each pixel point in the target part is within the range of the third preset threshold. If so, it is determined that the pixel point belongs to the midtone area; otherwise, it is considered that the pixel point belongs to the area outside the midtone area. Through the above screening process, multiple pixel points belonging to the midtone area can be screened from the target part, and then the pixel points belonging to the midtone area in the target part are extracted to obtain the midtone area. Figure 8 A schematic diagram of a mid-tone region according to an embodiment of the present disclosure is shown. It can be seen from the figure that the mid-tone region can be effectively and accurately extracted from the target part through the method proposed in the embodiment of the present disclosure.
[0119] Through the embodiments of the present disclosure, a third mixed result reflecting midtone information can be obtained by performing exclusion mixing on the grayscale image of the target part, and then a midtone area can be extracted from the target part based on the mixed result. This method of obtaining midtone information is fast and convenient, and is convenient for batch processing at the same time as the method of obtaining highlight information and shadow information, thereby improving the overall efficiency of virtual object generation and the display effect of virtual objects as a whole.
[0120] In a possible implementation, step S13 may include:
[0121] In step S131 , multiple target areas are rendered respectively according to preset color parameters to obtain multiple intermediate rendering results.
[0122] Step S132 , determining processing methods corresponding to the multiple target areas according to the color tones of the multiple target areas.
[0123] In step S133 , the grayscale image of the target part is mixed with the multiple intermediate rendering results according to the processing methods corresponding to the multiple target areas, to obtain multiple rendering results.
[0124] The intermediate rendering result may be the rendering result obtained after rendering the target area with the preset color parameters. The implementation of the preset color parameters can refer to the above-mentioned disclosed embodiments. The preset color parameters can be flexibly set according to needs.
[0125] Among multiple target areas, different target areas can correspond to the same preset color parameters or different preset color parameters, which can be flexibly selected according to actual conditions. In one possible implementation, each target area can be mixed with the corresponding preset color parameters to obtain an intermediate rendering result corresponding to each target area.
[0126] Since different target areas can be divided based on different hue information, different target areas can correspond to different hues, such as the highlight area corresponding to highlight, the shadow area corresponding to shadow, and the midtone area corresponding to midtone in the above-mentioned disclosed embodiment.
[0127] Target areas of different hues may be processed in different ways. The correspondence between hues and processing ways can be found in the following disclosed embodiments, which will not be elaborated here.
[0128] After determining the processing method for each target area, the target area can be mixed with each intermediate rendering result according to the processing method to obtain multiple rendering results.
[0129] Through the embodiments of the present disclosure, each target area can be mixed with the corresponding processing method according to the color tone corresponding to the different target areas to obtain the rendering results of each target area, so that different target areas can have rendering effects corresponding to the color tone, effectively improving the accuracy and richness of the overall generation effect of the virtual object, and also improving the flexibility of the virtual object generation process.
[0130] In a possible implementation, step S132 may include:
[0131] In the case where the target area includes a highlight area, determining that the processing method includes color filter blending;
[0132] In the case where the target area includes a shadow area, determining that the processing method includes multiply blending;
[0133] In the case where the target area includes a midtone area, it is determined that the processing method includes normal blending.
[0134] It can be seen from the above disclosed embodiments that when the target area is a highlight area, the intermediate rendering result of the highlight area and the target part can be mixed in a color filter mixing manner to obtain the rendering result of the highlight area. Figure 9 A schematic diagram of the rendering result of the highlight area according to an embodiment of the present disclosure is shown. As can be seen from the figure, color filter blending can make the blending result brighter, thereby fully preserving the tonal properties of the highlight area and improving the processing effect.
[0135] In the case that the target area is a shadow area, the intermediate rendering effect of the shadow area and the target part may be mixed in a multiply blending manner to obtain a rendering result of the shadow area. Figure 10 A schematic diagram of the rendering result of the shadow area according to an embodiment of the present disclosure is shown. As can be seen from the figure, the overlay blending can darken the blending result, thereby fully preserving the tonal properties of the shadow area and improving the processing effect.
[0136] When the target area is a mid-tone area, the intermediate rendering effect of the mid-tone area and the target part may be mixed in a normal mixing manner to obtain a rendering result of the mid-tone area. Figure 11 A schematic diagram of the rendering result of the midtone area according to an embodiment of the present disclosure is shown. It can be seen from the figure that normal mixing has little effect on the brightness of the mixing result, thereby fully preserving the tonal properties of the midtone area and improving the processing effect.
[0137] It can be seen from the above-mentioned disclosed embodiments that by using different mixing methods for the tones of different target areas, the obtained rendering results can be consistent with the original tonal properties of the target parts, thereby greatly improving the authenticity of the generated target virtual objects.
[0138] In a possible implementation, step S14 may include:
[0139] Step S141, superimposing multiple rendering results to obtain a target rendering result;
[0140] Step S142: Render the target lip makeup result and the target part in the original virtual object according to a preset rendering to obtain a target user image.
[0141] In one possible implementation, the above-mentioned multiple target areas can be determined in multiple layers respectively. In this case, the multiple rendering results obtained can also belong to multiple layers respectively. Therefore, in one example, the rendering results in multiple layers can be superimposed to obtain the target rendering result.
[0142] The superposition method can be flexibly determined according to the actual situation. For example, it can be a direct superposition between layers. In some possible implementation methods, superposition can also be achieved through some or some mixed methods. For example, multiple layers can be mixed and superimposed by overlaying.
[0143] In a possible implementation, multiple rendering results may be directly fused or mixed to obtain a target rendering result.
[0144] After obtaining the target rendering result, the target rendering result and the target part in the original virtual object can be rendered according to the preset rendering parameters to obtain the target virtual object. The rendering method is also not limited in the embodiment of the present disclosure. For example, the pixel values of the pixel points at the same position can be added or multiplied to achieve rendering, or the pixel values of the pixel points at the same position can be weightedly fused.
[0145] The fusion weight of the target rendering result in the weighted fusion may be determined according to preset rendering parameters. The preset rendering parameters may be pre-set parameter values for indicating the weight of the target rendering result in the rendering process.
[0146] In one possible implementation, the preset rendering parameter may be transparency. The target virtual object may be obtained by multiplying the target rendering result by the transparency and then adding the result to the target part of the original virtual object. By changing the transparency in the preset rendering parameter, the transparency effect of the entire target virtual object may be changed.
[0147] Figure 12A schematic diagram of a target virtual object according to an embodiment of the present disclosure is shown. It can be seen from the figure that through the virtual object generation method proposed in each embodiment of the present disclosure, a target virtual object with a relatively realistic and natural effect can be obtained.
[0148] Through the embodiments of the present disclosure, the target part of the original virtual object can be rendered using the target rendering result according to the preset rendering parameters to obtain the target virtual object. By changing the preset rendering parameters, the effect of the target virtual object can be easily adjusted, thereby improving the flexibility and autonomy of the entire target virtual object generation process.
[0149] In a possible implementation, the method proposed in the embodiment of the present disclosure may further include:
[0150] In response to an interaction operation on a target virtual object, the target virtual object is controlled to perform a virtual action matching the interaction information according to interaction information in the interaction operation.
[0151] The interactive operation may be an interactive instruction issued by the user to the target virtual object, such as controlling the target virtual object to change its action or speak, or transmitting information to the target virtual object.
[0152] The interaction information may be relevant information input by the user during the interaction operation, such as text instruction information, voice instruction information, or touch instruction information.
[0153] According to the interaction information, the target virtual object can be controlled to perform virtual actions that match the interaction information. For example, the interaction information can instruct the target virtual object to perform actions such as dancing or directing, and the target virtual object can be controlled to perform such actions according to the interaction information.
[0154] Through the embodiments of the present disclosure, interaction between a target virtual object and a user can be achieved, thereby improving the application scope and practicality of the generated target virtual object.
[0155] Figure 13 A block diagram of a device for generating a virtual object according to an embodiment of the present disclosure is shown. As shown in the figure, the virtual object generating device 20 may include:
[0156] The acquisition module 21 is used to acquire the target part to be processed in the original virtual object.
[0157] The division module 22 is configured to divide the target part into a plurality of target areas according to the hue information of the target part.
[0158] The rendering module 23 is configured to perform rendering processing on each of the plurality of target areas according to preset color parameters so as to match the color tone of the target areas, thereby obtaining a plurality of rendering results.
[0159] The generating module 24 is configured to generate a target virtual object based on the multiple rendering results.
[0160] In a possible implementation, the acquisition module is configured to: acquire an original virtual object, wherein the original virtual object is generated according to virtual information; and extract a target part to be processed from the original virtual object according to the virtual information.
[0161] In a possible implementation, the virtual information includes: preset virtual object generation information, and / or virtual object control information generated in response to a user's action.
[0162] In one possible implementation, the tonal information includes one or more of highlight information, shadow information, and midtone information; the division module is used to: extract a highlight area from the target part based on the highlight information of the target part; and / or extract a shadow area from the target part based on the shadow information of the target part; and / or extract a midtone area from the target part based on the midtone information of the target part.
[0163] In one possible implementation, the segmentation module is further used to: perform overlay blending based on the grayscale image of the target part to obtain a first blending result; determine the first transparency of the pixel points in the target part based on the first blending result; extract the pixel points in the target part based on the first preset transparency threshold and the first transparency to obtain a highlight area.
[0164] In one possible implementation, the segmentation module is further used to: perform positive overlay blending based on the inverse grayscale image of the target part to obtain a second blending result; determine the second transparency of the pixel points in the target part according to the second blending result; extract the pixel points in the target part according to the second preset transparency threshold and the second transparency to obtain a shadow area.
[0165] In one possible implementation, the segmentation module is further used to: perform exclusion blending based on the grayscale image of the target part to obtain a third blending result; determine the third transparency of the pixel points in the target part based on the third blending result; extract the pixel points in the target part based on the third preset transparency threshold and the third transparency to obtain a mid-tone area.
[0166] In one possible implementation, the rendering module is used to: render multiple target areas separately according to preset color parameters to obtain multiple intermediate rendering results; determine the processing methods corresponding to the multiple target areas according to the color tones of the multiple target areas; and mix the grayscale images of the target areas with the multiple intermediate rendering results according to the processing methods corresponding to the multiple target areas to obtain multiple rendering results.
[0167] In one possible implementation, the target area includes one or more of a highlight area, a shadow area, and a midtone area; the rendering module is further used to: when the target area includes a highlight area, determine that the processing method includes color filter blending; when the target area includes a shadow area, determine that the processing method includes overlay blending; when the target area includes a midtone area, determine that the processing method includes normal blending.
[0168] In a possible implementation, the generation module is used to: superimpose multiple rendering results to obtain a target rendering result; based on preset rendering parameters, use the target rendering result to render a target part of the original virtual object to obtain a target virtual object.
[0169] In a possible implementation, the apparatus is further configured to: in response to an interactive operation on a target virtual object, control the target virtual object to perform a virtual action matching the interactive information according to interactive information in the interactive operation.
[0170] The present disclosure relates to the field of augmented reality. By acquiring image information of a target object in a real-world environment, the relevant features, states, and attributes of the target object are detected or identified using various vision-related algorithms, thereby achieving an AR effect that combines virtual and real life and matches the specific application. For example, the target object may be a face, limbs, gestures, movements, etc. related to the human body, or an identifier or marker related to an object, or a sandbox, display area, or display items related to a venue or location. Vision-related algorithms may involve visual positioning, SLAM, 3D reconstruction, image registration, background segmentation, key point extraction and tracking of objects, and object pose or depth detection. Specific applications can involve not only interactive scenarios such as guided tours, navigation, explanations, reconstruction, and virtual effect overlay displays related to real scenes or objects, but also special effects processing related to people, such as makeup beautification, body beautification, special effects display, and virtual model display. Detection or identification of the relevant features, states, and attributes of the target object can be achieved using a convolutional neural network. The above-mentioned convolutional neural network is a network model obtained by model training based on a deep learning framework.
[0171] Application scenario examples
[0172] In the field of computer vision, how to change the hair color of the original virtual object and generate a target virtual object with more realistic and natural hair effects has become a problem that needs to be solved urgently.
[0173] The present application example proposes a method for generating a virtual object, including the following process:
[0174] The hair map of the original virtual object is obtained, and grayscale processing is performed on the hair map to obtain a grayscale image x.
[0175] Based on the grayscale image x, the highlight, shadow and mid-tone regions of the hair are separated to obtain three target regions: the highlight region, the shadow region and the mid-tone region.
[0176] The process of highlight separation can include:
[0177] Perform a multiply blend of x and x itself to obtain a first blended result. Obtain the alpha channel value in the first blended result and, based on the black-white relationship of the alpha channel value, map the alpha channel value to a transparency, thereby obtaining a first transparency for each pixel in the target area. Based on the first transparency, select pixels in the highlight area from the hair area to obtain a highlight area.
[0178] The shadow separation process can include:
[0179] Performing inverse grayscale processing on x to obtain an inverse grayscale image, performing a multiply blend of the inverse grayscale image and itself to obtain a second blended result. Obtaining the alpha channel value in the second blended result, mapping the alpha channel value to a transparency based on the black-white relationship of the alpha channel value, thereby obtaining a second transparency for each pixel in the target area. Based on the second transparency, pixels belonging to the shadow area are filtered from the hair area to obtain the shadow area.
[0180] The process of midtone separation can include:
[0181] Perform exclusion blending on x and x itself to obtain a third blended result. Obtain the alpha channel value in the third blended result and, based on the black-white relationship of the alpha channel value, map the alpha channel value to a transparency, thereby obtaining a third transparency for each pixel in the target area. Based on the third transparency, select pixels in the midtone region from the hair area to obtain a midtone region.
[0182] After obtaining the highlight area, shadow area, and mid-tone area respectively, the preset color parameters can be mixed with the highlight area, shadow area, and mid-tone area respectively to obtain intermediate rendering results a, b, and c, respectively.
[0183] Perform color filtering on the intermediate rendering result a and x to obtain the rendering result d;
[0184] Perform a multiplication blend of the intermediate rendering result b and x to obtain the rendering result e;
[0185] The intermediate rendering result c is normally mixed with x to obtain the rendering result f.
[0186] The three layers containing the rendering results d, e, and f are superimposed, that is, packaged into a group to obtain the target rendering result g. The target rendering result g can be used to render the hair part of the original virtual object to obtain the target virtual object. Changing the transparency of g can change the transparency effect of the target virtual object. The target rendering result g can be mixed with the original virtual object through normal mixing.
[0187] The image processing method proposed in the application example of the present disclosure can make the hair dyeing effect more natural and achieve a what-you-see-is-what-you-get processing effect by processing the target areas of different tones. Moreover, the method proposed in the embodiment of the present disclosure can realize more parameter definitions, such as the change of the preset color parameters of different target areas, the change of the preset rendering parameters of the target rendering result and the original virtual object, etc., so that the generation effect of the virtual object is more controllable and the relevant parameters are convenient to customize. Compared with the related method of saving the hair map as a PSD file in a PS operation process and changing the rendering effect of the hair in the virtual object by changing the result of the PSD, the unity designer can manually change the hair color of the virtual object through the method proposed in the application example of the present disclosure, and directly display the target virtual object after the change. The unity developer can also make underlying settings based on the method of the application example of the present disclosure and retain the interface for modifying the hair color so that the relevant users can directly implement the color change to obtain the target virtual object, etc.
[0188] It can be understood that the above-mentioned various method embodiments mentioned in the present disclosure can be combined with each other to form combined embodiments without violating the principle logic. Due to space limitations, the present disclosure will not elaborate on them.
[0189] Those skilled in the art will understand that in the above-mentioned method of the specific implementation method, the writing order of each step does not mean a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of each step should be determined by its function and possible internal logic.
[0190] The present disclosure also provides a computer-readable storage medium having computer program instructions stored thereon, wherein the computer program instructions implement the above method when executed by a processor. The computer-readable storage medium may be a volatile computer-readable storage medium or a non-volatile computer-readable storage medium.
[0191] An embodiment of the present disclosure further proposes an electronic device, comprising: a processor; and a memory for storing instructions executable by the processor; wherein the processor is configured to perform the above method.
[0192] In practical applications, the above-mentioned memory can be a volatile memory (volatile memory), such as RAM; or a non-volatile memory (non-volatile memory), such as ROM, flash memory, hard disk drive (HDD) or solid-state drive (SSD); or a combination of the above types of memory, and provide instructions and data to the processor.
[0193] The processor may be at least one of an ASIC, a DSP, a DSPD, a PLD, an FPGA, a CPU, a controller, a microcontroller, and a microprocessor. It is understood that for different devices, the electronic device used to implement the functions of the processor may also be other, and the embodiments of the present disclosure do not specifically limit this.
[0194] The electronic device may be provided as a terminal, a server, or other forms of devices.
[0195] Based on the same technical concept as the aforementioned embodiment, an embodiment of the present disclosure further provides a computer program, which implements the aforementioned method when executed by a processor.
[0196] Figure 14 8 is a block diagram of an electronic device 800 according to an embodiment of the present disclosure. For example, the electronic device 800 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, or the like.
[0197] Reference Figure 14 , the electronic device 800 may include one or more of the following components: a processing component 802 , a memory 804 , a power component 806 , a multimedia component 808 , an audio component 810 , an input / output (I / O) interface 812 , a sensor component 814 , and a communication component 816 .
[0198] The processing component 802 generally controls the overall operation of the electronic device 800, such as operations associated with display, phone calls, data communications, camera operation, and recording operations. The processing component 802 may include one or more processors 820 to execute instructions to perform all or part of the steps of the above-described method. In addition, the processing component 802 may include one or more modules to facilitate interaction between the processing component 802 and other components. For example, the processing component 802 may include a multimedia module to facilitate interaction between the multimedia component 808 and the processing component 802.
[0199] The memory 804 is configured to store various types of data to support operations on the electronic device 800. Examples of such data include instructions for any application or method operating on the electronic device 800, contact data, phone book data, messages, pictures, videos, etc. The memory 804 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 memory, flash memory, magnetic disk, or optical disk.
[0200] The power supply component 806 provides power to the various components of the electronic device 800. The power supply component 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the electronic device 800.
[0201] The multimedia component 808 includes a screen that provides an output interface between the electronic device 800 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen can be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor can not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 808 includes a front camera and / or a rear camera. When the electronic device 800 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera can receive external multimedia data. Each front camera and rear camera can be a fixed optical lens system or have a focal length and optical zoom capability.
[0202] The audio component 810 is configured to output and / or input audio signals. For example, the audio component 810 includes a microphone (MIC), which is configured to receive external audio signals when the electronic device 800 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signal can be further stored in the memory 804 or transmitted via the communication component 816. In some embodiments, the audio component 810 also includes a speaker for outputting audio signals.
[0203] I / O interface 812 provides an interface between processing component 802 and peripheral interface modules, such as a keyboard, click wheel, buttons, etc. These buttons may include but are not limited to: a home button, volume buttons, a start button, and a lock button.
[0204] The sensor assembly 814 includes one or more sensors for providing various aspects of status assessment for the electronic device 800. For example, the sensor assembly 814 can detect the open / closed state of the electronic device 800, the relative positioning of components, such as the display and keypad of the electronic device 800. The sensor assembly 814 can also detect changes in the position of the electronic device 800 or a component of the electronic device 800, the presence or absence of user contact with the electronic device 800, the orientation or acceleration / deceleration of the electronic device 800, and temperature changes of the electronic device 800. The sensor assembly 814 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 814 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 may also include an accelerometer, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
[0205] The communication component 816 is configured to facilitate wired or wireless communication between the electronic device 800 and other devices. The electronic device 800 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 816 receives a broadcast signal or broadcast-related personnel information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 816 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
[0206] In an exemplary embodiment, the electronic device 800 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 above methods.
[0207] In an exemplary embodiment, a non-volatile computer-readable storage medium is also provided, such as a memory 804 including computer program instructions. The computer program instructions can be executed by the processor 820 of the electronic device 800 to perform the above method.
[0208] Figure 15 1 is a block diagram of an electronic device 1900 according to an embodiment of the present disclosure. For example, the electronic device 1900 may be provided as a server. Figure 15The electronic device 1900 includes a processing component 1922, which further includes one or more processors, and a memory resource represented by a memory 1932 for storing instructions executable by the processing component 1922, such as an application. The application stored in the memory 1932 may include one or more modules, each corresponding to a set of instructions. In addition, the processing component 1922 is configured to execute the instructions to perform the above-described method.
[0209] The electronic device 1900 may further include a power supply component 1926 configured to perform power management of the electronic device 1900, a wired or wireless network interface 1950 configured to connect the electronic device 1900 to a network, and an input / output (I / O) interface 1958. The electronic device 1900 may operate based on an operating system stored in the memory 1932, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, or the like.
[0210] In an exemplary embodiment, a non-volatile computer-readable storage medium is also provided, such as a memory 1932 including computer program instructions that can be executed by the processing component 1922 of the electronic device 1900 to perform the above method.
[0211] The present disclosure may be a system, method and / or computer program product. The computer program product may include a computer-readable storage medium carrying computer-readable program instructions for causing a processor to implement various aspects of the present disclosure.
[0212] A computer-readable storage medium can be a tangible device that can hold and store instructions for use by an instruction execution device. A computer-readable storage medium can be, for example, but not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination thereof. More specific examples (a non-exhaustive list) of computer-readable storage media include: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a static random access memory (SRAM), a portable compact disc read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanical encoding device, such as a punch card or a raised structure in a groove on which instructions are stored, and any suitable combination thereof. As used herein, a computer-readable storage medium is not to be construed as a transient signal per se, such as a radio wave or other freely propagating electromagnetic wave, an electromagnetic wave propagating through a waveguide or other transmission medium (e.g., a light pulse through a fiber optic cable), or an electrical signal transmitted through an electrical wire.
[0213] The computer-readable program instructions described herein can be downloaded from a computer-readable storage medium to each computing / processing device, or downloaded to an external computer or external storage device via a network, such as the Internet, a local area network, a wide area network, and / or a wireless network. The network can include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers, and / or edge servers. The network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions to be stored in the computer-readable storage medium in each computing / processing device.
[0214] The computer program instructions for performing the operation of the present disclosure can be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-related instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, wherein the programming language includes object-oriented programming languages such as Smalltalk, C++, and conventional procedural programming languages such as "C" language or similar programming languages. Computer-readable program instructions can be executed entirely on a user's computer, partially on a user's computer, executed as an independent software package, partially on a user's computer and partially on a remote computer, or executed entirely on a remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer via any type of network including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computer (such as by using an Internet service provider to connect via the Internet). In some embodiments, by utilizing the state personnel information of computer-readable program instructions to personalize an electronic circuit, such as a programmable logic circuit, a field programmable gate array (FPGA) or a programmable logic array (PLA), the electronic circuit can execute computer-readable program instructions, thereby realizing various aspects of the present disclosure.
[0215] Various aspects of the present disclosure are described herein with reference to flowcharts and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the present disclosure. It should be understood that each block of the flowcharts and / or block diagrams, and combinations of blocks in the flowcharts and / or block diagrams, can be implemented by computer-readable program instructions.
[0216] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine, so that when these instructions are executed by the processor of the computer or other programmable data processing device, a device is generated that implements the functions / actions specified in one or more blocks in the flowchart and / or block diagram. These computer-readable program instructions can also be stored in a computer-readable storage medium, where these instructions cause the computer, programmable data processing device, and / or other device to operate in a specific manner. Thus, the computer-readable medium storing the instructions comprises an article of manufacture that includes instructions for implementing various aspects of the functions / actions specified in one or more blocks in the flowchart and / or block diagram.
[0217] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operational steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to implement the functions / actions specified in one or more blocks in the flowchart and / or block diagram.
[0218] The flow charts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the systems, methods and computer program products according to multiple embodiments of the present disclosure. In this regard, each box in the flow chart or block diagram can represent a part of a module, program segment or instruction, and the part of the module, program segment or instruction contains one or more executable instructions for realizing the prescribed logical function. In some alternative implementations, the functions marked in the box can also occur in a sequence different from that marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flow chart, and the combination of the boxes in the block diagram and / or flow chart can be implemented by a dedicated hardware-based system that performs the prescribed function or action, or can be implemented by a combination of dedicated hardware and computer instructions.
[0219] While various embodiments of the present disclosure have been described above, the foregoing description is intended to be illustrative, non-exhaustive, and not limited to the disclosed embodiments. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is selected to best explain the principles of the embodiments, their practical applications, or technological improvements in the marketplace, or to enable others skilled in the art to understand the embodiments disclosed herein.
Claims
1. A method for generating a virtual object, characterized in that: include: Obtaining the target part to be processed in the original virtual object; Dividing the target part into a plurality of target areas according to the hue information of the target part; According to preset color parameters, rendering processing is performed on the multiple target areas respectively so as to match the color tone of the target areas to obtain multiple rendering results; generating a target virtual object based on the multiple rendering results; The rendering process of performing rendering processing on the multiple target areas according to the preset color parameters so as to match the color tones of the target areas to obtain multiple rendering results includes: rendering the multiple target areas according to the preset color parameters to obtain multiple intermediate rendering results; determining processing methods corresponding to the multiple target areas according to the color tones of the multiple target areas; and mixing the grayscale images of the target areas with the multiple intermediate rendering results according to the processing methods corresponding to the multiple target areas to obtain multiple rendering results. The target area includes one or more of a highlight area, a shadow area and a midtone area; and the processing methods corresponding to the multiple target areas are determined according to the color tones of the multiple target areas, including: when the target area includes a highlight area, determining that the processing method includes color filter blending; when the target area includes a shadow area, determining that the processing method includes multiply blending; when the target area includes a midtone area, determining that the processing method includes normal blending.
2. The method according to claim 1, characterized in that The step of obtaining the target part to be processed in the original virtual object includes: Acquire an original virtual object, wherein the original virtual object is generated according to virtual information; The target part to be processed is extracted from the original virtual object according to the virtual information.
3. The method according to claim 2, characterized in that The virtual information includes: preset virtual object generation information, and / or virtual object control information generated in response to a user's action.
4. The method according to any one of claims 1 to 3, characterized in that The tone information includes one or more of highlight information, shadow information, and mid-tone information; The step of dividing the target part into a plurality of target areas according to the hue information of the target part includes one or more of the following operations: Extracting a highlight area from the target part based on the highlight information of the target part; and / or, extracting a shadow area from the target part based on the shadow information of the target part; and / or, A mid-tone area is extracted from the target part based on the mid-tone information of the target part.
5. The method according to claim 4, characterized in that The step of extracting a highlight area from the target part based on the highlight information of the target part includes: Performing a positive overlay blending operation based on the grayscale image of the target part to obtain a first blending result; determining a first transparency of a pixel point in the target portion according to the first mixing result; Pixel points in the target part are extracted according to a first preset transparency threshold and the first transparency to obtain the highlight area.
6. The method according to claim 4, characterized in that The step of extracting a shadow area from the target part based on the shadow information of the target part includes: Performing positive overlay blending based on the inverse grayscale image of the target part to obtain a second blending result; determining a second transparency of the pixel points in the target part according to the second mixing result; According to a second preset transparency threshold and the second transparency, pixel points in the target part are extracted to obtain the shadow area.
7. The method according to any one of claims 4, characterized in that The extracting a mid-tone area from the target part based on the mid-tone information of the target part includes: Performing exclusion blending based on the grayscale image of the target part to obtain a third blending result; determining a third transparency of the pixel points in the target portion according to the third mixing result; Pixel points in the target portion are extracted according to a third preset transparency threshold and the third transparency to obtain the mid-tone area.
8. The method according to any one of claims 1 to 3, characterized in that Generating a target virtual object based on the multiple rendering results includes: Superimposing the multiple rendering results to obtain a target rendering result; Based on preset rendering parameters, the target part of the original virtual object is rendered using the target rendering result to obtain the target virtual object.
9. The method according to any one of claims 1 to 3, characterized in that The method further comprises: In response to an interaction operation on the target virtual object, the target virtual object is controlled to perform a virtual action matching the interaction information according to interaction information in the interaction operation.
10. A device for generating a virtual object, characterized in that: include: An acquisition module, used for acquiring a target part to be processed in the original virtual object; a division module, configured to divide the target part into a plurality of target areas according to the hue information of the target part; A rendering module, configured to perform rendering processing on the plurality of target areas respectively so as to match the color tone of the target areas according to preset color parameters, to obtain a plurality of rendering results; A generating module, configured to generate a target virtual object based on the plurality of rendering results; The rendering module is configured to render the plurality of target areas according to the preset color parameters to obtain a plurality of intermediate rendering results; determine processing methods corresponding to the plurality of target areas according to the color tones of the plurality of target areas; and mix the grayscale image of the target area with the plurality of intermediate rendering results according to the processing methods corresponding to the plurality of target areas to obtain a plurality of rendering results. The target area includes one or more of a highlight area, a shadow area, and a midtone area; the rendering module is further used to: when the target area includes a highlight area, determine that the processing method includes color filter blending; when the target area includes a shadow area, determine that the processing method includes multiply blending; when the target area includes a midtone area, determine that the processing method includes normal blending.
11. An electronic device, characterized in that: include: processor; a memory for storing processor-executable instructions; The processor is configured to call the instructions stored in the memory to execute the method according to any one of claims 1 to 9.
12. A computer-readable storage medium having computer program instructions stored thereon, characterized in that: When the computer program instructions are executed by a processor, the method according to any one of claims 1 to 9 is implemented.
Citation Information
Patent Citations
Image processing method and device
CN111031242A
Makeup trying processing method and device for face image, computer equipment and storage medium
CN111369644A
Image processing method and device, electronic equipment and storage medium
CN112767285A