Virtual image generation method, device, electronic device and storage medium
By obtaining the initial image and virtual objects of the target object and generating dynamic virtual images with preset templates, the problem of complex and inefficient virtual image production in the existing technology is solved, and fast and simple virtual image generation is achieved.
Patent Information
- Application Number
- CN202110817264.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-07-20
- Publication Date
- 2025-03-25
- Estimated Expiration
- 2041-07-20
AI Technical Summary
The production of existing virtual images requires professional operation, which is complex and inefficient, resulting in a long production time period.
By obtaining the initial image of the target object, the target virtual object is obtained, and a dynamic virtual avatar is generated based on the target virtual object and preset template. The preset template includes preset virtual objects, preset motion trajectories, and their binding relationships.
It realizes the rapid generation of dynamic virtual images based on pictures, simplifies the operation process, shortens the production time period, and improves the efficiency of virtual image generation.
Smart Images

Figure CN113538642B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing technology, and in particular to a method, device, electronic device and storage medium for generating a virtual image. Background Art
[0002] With the continuous development of technology, the application of virtual images is common in people's entertainment methods. For example, virtual images are used in animation, live broadcast, short videos and other fields to enhance the user's fun.
[0003] At present, the production of virtual images usually requires professional operations, such as creation, drawing and driving, which requires strong artistic skills. In addition, the operation is cumbersome and complicated, and there are problems such as long production cycle and low output efficiency. Summary of the invention
[0004] In view of this, an object of the present invention is to provide a method, device, electronic device and storage medium for generating a virtual image.
[0005] In order to achieve the above purpose, the technical solution adopted by the embodiment of the present invention is as follows:
[0006] In a first aspect, the present invention provides a method for generating a virtual image, the method comprising:
[0007] Get an initial image containing the target object;
[0008] Obtaining a target virtual object corresponding to the target object;
[0009] A dynamic virtual image is obtained according to the target virtual object and a preset template; the preset template includes a preset virtual object, a preset motion trajectory, and a first binding relationship between the preset virtual object and the preset motion trajectory; the preset virtual object and the target virtual object have a first corresponding relationship.
[0010] In an optional implementation, the step of obtaining a dynamic virtual image according to the target virtual object and a preset template includes:
[0011] According to the target virtual object, a plurality of initial layers are obtained, wherein the plurality of initial layers include at least one layer to be repaired and one unrepaired layer;
[0012] Processing the layer to be repaired to obtain a target layer;
[0013] The dynamic virtual image is obtained according to a plurality of pending layers and the preset template; the plurality of pending layers include all target layers and all unrepaired layers.
[0014] In an optional implementation manner, the layer to be repaired includes at least one part of the target virtual object;
[0015] The step of processing the layer to be repaired to obtain a target layer includes:
[0016] Determining a to-be-repaired area in the to-be-repaired layer according to the parts included in the to-be-repaired layer;
[0017] The area to be repaired is repaired according to the contour pixel value of the area to be repaired to obtain the target layer.
[0018] In an optional implementation, the step of obtaining a dynamic virtual image according to the target virtual object and a preset template includes:
[0019] According to the first corresponding relationship, replacing the preset virtual object in the preset template with the target virtual object;
[0020] According to the first binding relationship, a second binding relationship between the target virtual object and the preset motion trajectory is established to obtain the dynamic virtual image.
[0021] In an optional embodiment, the target object is a target character; the target virtual object is a target virtual character; the target virtual character includes a plurality of character layers; the preset virtual object includes a plurality of preset layers, and the preset motion track includes a plurality of preset sub-motion tracks;
[0022] The step of obtaining a dynamic virtual image according to the target virtual object and the preset template includes:
[0023] According to the first corresponding relationship, each of the preset layers in the preset template is replaced with a corresponding character layer;
[0024] According to the first binding relationship, a second binding relationship between each character layer and one of the preset sub-motion tracks is established to obtain a dynamic virtual character; the dynamic virtual character is the dynamic virtual image.
[0025] In an optional embodiment, the step of acquiring an initial image containing the target object includes:
[0026] According to the user's interactive operation on the image generation interface, an initial image containing the target object is obtained.
[0027] In an optional embodiment, the method further comprises:
[0028] The dynamic virtual image is displayed on the image display interface according to the user's confirmation operation on the image generation interface.
[0029] In a second aspect, the present invention provides a virtual image generation device, the device comprising:
[0030] An acquisition module, used for acquiring an initial image containing a target object;
[0031] A processing module, used for obtaining a target virtual object corresponding to the target object;
[0032] A generation module is used to obtain a dynamic virtual image according to the target virtual object and a preset template; the preset template includes a preset virtual object, a preset motion trajectory, and a first binding relationship between the preset virtual object and the preset motion trajectory; the preset virtual object has a first corresponding relationship with the target virtual object.
[0033] In a third aspect, the present invention provides an electronic device, including a processor and a memory, wherein the memory stores a computer program, and when the processor executes the computer program, the method described in any one of the aforementioned embodiments is implemented.
[0034] In a fourth aspect, the present invention provides a storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described in any one of the aforementioned embodiments.
[0035] The virtual image generation method, device, electronic device and storage medium provided by the embodiment of the present invention obtain an initial image including a target object; then obtain a target virtual object corresponding to the target object; and then obtain a dynamic virtual image based on the target virtual object and a preset template, wherein the preset template includes a preset virtual object, a preset motion trajectory and a first binding relationship between the preset virtual object and the preset motion trajectory, and the target virtual object has a first corresponding relationship with the preset virtual object. Thus, a dynamic virtual image can be quickly generated based on a picture without manual intervention, and the operation is simple and convenient, thereby shortening the time cycle of virtual image production and improving the efficiency of generating virtual images.
[0036] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.
[0038] Figure 1A block diagram of an electronic device provided by an embodiment of the present invention is shown;
[0039] Figure 2 A schematic diagram of a flow chart of a method for generating a virtual image provided by an embodiment of the present invention is shown;
[0040] Figure 3 An example diagram showing a method for generating a virtual image provided by an embodiment of the present invention is shown;
[0041] Figure 4 Another schematic diagram of a flow chart of a method for generating a virtual image provided by an embodiment of the present invention is shown;
[0042] Figure 5 Another example diagram of the method for generating a virtual image provided by an embodiment of the present invention is shown;
[0043] Figure 6 Another example diagram of the method for generating a virtual image provided by an embodiment of the present invention is shown;
[0044] Figure 7 Another example diagram of the method for generating a virtual image provided by an embodiment of the present invention is shown;
[0045] Figure 8 Another example diagram of the method for generating a virtual image provided by an embodiment of the present invention is shown;
[0046] Fig. 9 Another example diagram of the method for generating a virtual image provided by an embodiment of the present invention is shown;
[0047] Fig.10 Another schematic diagram of a flow chart of a method for generating a virtual image provided by an embodiment of the present invention is shown;
[0048] Fig.11 Another example diagram of the method for generating a virtual image provided by an embodiment of the present invention is shown;
[0049] Fig.12 Another schematic diagram of a flow chart of a method for generating a virtual image provided by an embodiment of the present invention is shown;
[0050] Fig.13 Another example diagram of the method for generating a virtual image provided by an embodiment of the present invention is shown;
[0051] Fig.14 Another example diagram of the method for generating a virtual image provided by an embodiment of the present invention is shown;
[0052] Fig.15 Another example diagram of the method for generating a virtual image provided by an embodiment of the present invention is shown;
[0053] Fig.16 Another schematic diagram of a flow chart of a method for generating a virtual image provided by an embodiment of the present invention is shown;
[0054] Fig.17 Another example diagram of the method for generating a virtual image provided by an embodiment of the present invention is shown;
[0055] Fig.18 Another example diagram of the method for generating a virtual image provided by an embodiment of the present invention is shown;
[0056] Fig.19 A functional module diagram of a virtual image generating device provided by an embodiment of the present invention is shown.
[0057] Icons: 100 - electronic device; 110 - bus; 120 - processor; 130 - memory; 150 - I / O module; 170 - communication interface; 300 - virtual image generation device; 310 - acquisition module; 330 - processing module; 350 - generation module; 370 - response module. DETAILED DESCRIPTION
[0058] The following will be combined with the accompanying drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Generally, the components of the embodiments of the present invention described and shown in the drawings here can be arranged and designed in various different configurations.
[0059] Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention claimed for protection, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without making creative work are within the scope of protection of the present invention.
[0060] It should be noted that relational terms such as "first" and "second" are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0061] In the field of live broadcasting, virtual images can be used to assist anchors in live broadcasting to increase the fun of watching live broadcasts. In related technologies, the production of virtual images is relatively complicated and requires manual participation and the use of professional software for manual production, which makes the threshold for virtual image production high and the production cycle long.
[0062] The virtual image generation method provided by the embodiment of the present invention can obtain a dynamic virtual image by configuring a related virtual image template through a picture uploaded by a user, and has the effects of simple operation and short production time cycle. The virtual image generation method provided by the embodiment of the present invention is introduced below.
[0063] Please refer to Figure 1 , is a block diagram of an electronic device 100 provided by an embodiment of the present invention. The electronic device 100 includes a bus 110 , a processor 120 , a memory 130 , an I / O module 150 , and a communication interface 170 .
[0064] The bus 110 may be a circuit that connects the above elements to each other and transfers communications (eg, control messages) between the above elements.
[0065] The processor 120 may receive commands from the other elements described above (eg, the memory 130 , the I / O module 150 , the communication interface 170 , etc.) through the bus 110 , may interpret the received commands, and may perform calculations or data processing according to the interpreted commands.
[0066] The processor 120 may be an integrated circuit chip with signal processing capabilities. The processor 120 may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, and discrete hardware components.
[0067] The memory 130 may store commands or data received from the processor 120 or other elements (eg, the I / O module 150 , the communication interface 170 , etc.) or commands or data generated by the processor 120 or other elements.
[0068] The memory 130 can be, but is not limited to, a random access memory (RAM), a read only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), etc.
[0069] The I / O module 150 may receive commands or data input from a user via input-output means (e.g., a sensor, a keyboard, a touch screen, etc.), and may transmit the received commands or data to the processor 120 or the memory 130 via the bus 110. It is also used to display various information (e.g., multimedia data, text data) received, stored, and processed from the above elements, and may display videos, images, data, etc. to the user.
[0070] The communication interface 170 may be used to communicate signaling or data with other node devices.
[0071] Understandably, Figure 1 The structure shown is only a schematic diagram of the structure of the electronic device 100. The electronic device 100 may also include Figure 1 More or fewer components as shown, or with Figure 1 Different configurations shown. Figure 1 Each component shown in the figure can be implemented by hardware, software or a combination thereof.
[0072] The electronic device provided in the embodiment of the present invention may be a smart phone, a personal computer, a tablet computer, a wearable device, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), etc. The embodiment of the present invention does not impose any limitation on this.
[0073] The above-mentioned electronic device 100 will be used as an execution subject to execute each step in each method provided in the embodiment of the present invention and achieve corresponding technical effects.
[0074] See also Figure 2 , Figure 2 It is a flowchart of a method for generating a virtual image provided by an embodiment of the present invention.
[0075] Step S202, obtaining an initial image containing a target object;
[0076] The target object may be a person, an animal, or other objects, and the present invention does not limit this.
[0077] The initial image may be an image containing real people, animals or other objects.
[0078] Optionally, a designated initial image may be acquired based on a user operation; or the initial image may be acquired by the electronic device from local storage.
[0079] Step S204, obtaining a target virtual object corresponding to the target object;
[0080] The target virtual object is an image with a specific style generated based on the target object, such as a virtual object in a two-dimensional style.
[0081] Optionally, an image generator may be used to obtain the target virtual object. The image generator may be a generator trained based on a network structure such as GAN, VAE or Flow.
[0082] Optionally, the randomly generated features can be input into the image generator to obtain a randomly combined virtual image. Alternatively, based on the initial image, the initial image can be input into the feature encoder, and then the features corresponding to the initial image are obtained, and these special effects are input into the image generator again to obtain the target virtual object corresponding to the target object.
[0083] For ease of understanding, the present invention provides an example diagram. Figure 3 As shown, (a1) in the figure represents an initial image, which includes the target object, namely face A, and (a2) represents the virtual object corresponding to face A, namely the target virtual object. (b1) in the figure represents another initial layer, which includes the target object, namely face B, and (b2) represents the virtual object corresponding to face B, namely the target virtual object. It should be noted that this example figure is only used as an example, and the initial image can be a picture including people, animals and other objects, which is not limited in the embodiment of the present invention.
[0084] Step S206, obtaining a dynamic virtual image according to the target virtual object and the preset template;
[0085] The preset template includes a preset virtual object, a preset motion trajectory, and a first binding relationship between the preset virtual object and the preset motion trajectory.
[0086] The preset virtual object and the target virtual object have a first corresponding relationship.
[0087] Optionally, the target virtual object has a first corresponding relationship with the preset virtual object, and the preset virtual object has a first binding relationship with the preset motion trajectory. The engine driving technology can be used to make the target virtual object move according to the preset motion trajectory to obtain a dynamic virtual image.
[0088] It can be seen that based on the above design, by obtaining an initial image including a target object, then obtaining a target virtual object corresponding to the target object, and then obtaining a dynamic virtual image based on the target virtual object and a preset template, the preset template includes a preset virtual object, a preset motion trajectory, and a first binding relationship between the preset virtual object and the preset motion trajectory, and the target virtual object has a first corresponding relationship with the preset virtual object. Thus, a dynamic virtual image can be quickly generated based on a picture without manual intervention, and the operation is simple and convenient, thereby shortening the time cycle of virtual image production and improving the efficiency of generating virtual images.
[0089] Furthermore, in order to make the dynamic virtual image generated based on the picture more vivid, the present invention provides a possible implementation method. Figure 4 , wherein step S206 may include the following steps:
[0090] Step S206A-1, obtaining a plurality of initial layers according to the target virtual object;
[0091] It is understood that an image can be split into multiple layers.
[0092] Optionally, splitting rules can be predefined for different virtual objects, and corresponding splitting models can be trained based on the splitting rules; then the target virtual object is split based on the splitting model to obtain multiple initial layers, each of which includes at least one part of the target virtual object.
[0093] Optionally, in the embodiment of the present invention, an example is given in which the target object contained in the initial image is a person, and the corresponding target virtual object is a target virtual person.
[0094] For the target virtual character, it can be split into layers of front hair, back hair, sideburns, face, trunk, hands, feet, eyebrows, mouth, eyeballs, whites of eyes and other parts.
[0095] like Figures 5 to 7 As shown in FIG. 1 , there are several example diagrams provided by the embodiments of the present invention. Among them, Figure 5 It represents portrait segmentation; Figure 6 It represents facial segmentation; Figure 7 It indicates the division between the front and back hair.
[0096] like Figure 8As shown, it is another example diagram provided by an embodiment of the present invention, wherein (d0) represents a target virtual object, and (d1) to (d4) represent multiple initial layers obtained based on the target virtual object. Among them, the initial layer (d1) includes the front hair of the target virtual object, that is, the front hair layer, the initial layer (d2) includes the back hair of the target virtual object, that is, the back hair layer, the initial layer (d3) includes the face of the target virtual object, that is, the face layer, and the initial layer (d4) includes the body of the target virtual object, that is, the body layer.
[0097] Step S206A-3, processing the layer to be repaired to obtain a target layer;
[0098] It is understandable that, when a dynamic virtual image is directly generated based on a picture and moves along a preset motion trajectory, the dynamic virtual image may leak out empty areas due to the lack of image information from certain perspectives.
[0099] like Fig. 9 As shown in the figure, a hole area appears in the dynamic virtual image during the movement. This is because the area is blocked in the original image. During the movement, the blocked area may need to be revealed, but the initial layer obtained by splitting does not contain the image information of the blocked area, so the hole area appears.
[0100] Therefore, after splitting the target virtual object into layers, layer repair can also be performed to avoid the appearance of hollow areas in the generated dynamic virtual image.
[0101] Optionally, an initial layer to be repaired, i.e., a layer to be repaired, may be determined from multiple initial layers according to a preset motion trajectory in a preset template, and the layer to be repaired may be repaired using image repair technology (Inpainting) to obtain a target layer.
[0102] Step S206A-5, obtaining a dynamic virtual image according to the multiple layers to be determined and the preset template;
[0103] Among them, the pending layers include all target layers and all unrepaired layers.
[0104] Optionally, a dynamic virtual image may be obtained by establishing a correspondence relationship between the plurality of undetermined layers and a preset virtual image in a preset template, and establishing a binding relationship with a preset motion track in the preset template.
[0105] For the above step S206A-3, the embodiment of the present invention provides a possible implementation method. Fig.10 , wherein step S206A-3 may further include:
[0106] Step S206A-3-2, determining the area to be repaired in the layer to be repaired according to the parts included in the layer to be repaired;
[0107] It can be understood that the layer to be repaired includes at least one part of the target virtual image, and the area to be repaired in the layer to be repaired, ie, the area to be repaired, can be determined according to the part included in the layer to be repaired.
[0108] The following will Figure 8 It is understood that the initial layer may have a layer order attribute, and the target virtual character is divided into four layers: front hair, back hair, face and body. The front hair layer is the frontmost layer, that is, except for the front hair layer, the other three layers need to be repaired.
[0109] For the rear-hair layer, the union area of the front-hair layer and the face layer can be taken, and the preset value can be expanded along the contour based on the union area as the area to be repaired in the rear-hair layer. Fig.11 In the middle (e1), it indicates the area to be repaired in the subsequent layer.
[0110] For the facial layer, we can take the max(width, height) of the facial layer as the diameter to draw a circle, with the center of the circle at the X and Y axis positions of the facial layer, where X=0.5*width and Y=0.25*height respectively. The union of the part of the center of the circle where Y<0.5*height and the facial layer is the area to be repaired. Fig.11 In the middle (e2), it represents the area to be repaired in the face layer.
[0111] For the body layer, a body segmentation model can be pre-trained, and the complete body layer can be obtained based on the body segmentation model. After the complete body layer is subtracted from the body layer obtained based on the segmentation, the area to be repaired in the body layer can be obtained. Fig.11 (e3) in the figure represents the area to be repaired in the body layer.
[0112] Step S206A-3-4, repairing the area to be repaired according to the contour pixel value of the area to be repaired to obtain a target layer;
[0113] The contour pixel value represents the pixel value of the non-repaired area adjacent to the contour edge of the area to be repaired. The non-repaired area represents the area in the layer to be repaired that does not need to be repaired.
[0114] Optionally, the contour pixel value corresponding to the area to be repaired can be taken, the average pixel value of the contour pixel value can be calculated, and the area to be repaired can be filled based on the average pixel value to obtain the target layer. The pixel value gradient can also be set from the contour of the area to be repaired to the center of the area to be repaired to make it appear color penetration.
[0115] like Fig.11 (f1) in the figure shows the target layer corresponding to the subsequent layer obtained after the to-be-repaired area in the subsequent layer is repaired.
[0116] like Fig.11 (f2) in the figure shows the target layer corresponding to the facial layer obtained after the to-be-repaired area in the facial layer is repaired. It should be noted that in the facial repair layer, since the facial features are important parts of the virtual image, the facial features will be split into multiple layers. (f2) shows an example image after the facial layer removes the facial features texture, which is only used as an example.
[0117] like Fig.11 (f3) in the figure shows the target layer corresponding to the body layer obtained after the to-be-repaired area in the body layer is repaired.
[0118] Through the above steps, the target virtual object is split to obtain multiple initial layers; the layers to be repaired in the multiple initial layers are repaired to fill the areas to be repaired in the layers to be repaired to obtain the target layers; based on all the target layers and all the unrepaired layers and the preset template, a dynamic virtual image can be obtained. This avoids the occurrence of empty areas in the generated dynamic virtual image, makes the dynamic virtual image more vivid, and improves the presentation effect of the dynamic virtual image.
[0119] For the above step S206, the embodiment of the present invention provides a possible implementation method. Fig.12 , wherein step S206 may further include the following steps:
[0120] Step S206B-1, according to the first corresponding relationship, replacing the preset virtual object in the preset template with the target virtual object;
[0121] Step S206B-3, establishing a second binding relationship between the target virtual object and the preset motion trajectory according to the first binding relationship, and obtaining a dynamic virtual image;
[0122] Optionally, a graphics rendering technology such as E-mote, Spine, Live2D, etc. can be used to bind the target virtual object to multiple triangle patches for rendering, each triangle patch has a corresponding texture, that is, skin binding.
[0123] Through the skin binding, the preset virtual object in the preset template can be replaced with the target virtual object based on the first corresponding relationship. The preset virtual object has a first binding relationship with the preset motion trajectory, and based on the first binding relationship, a second binding relationship between the target virtual object and the preset motion trajectory can be established to obtain a dynamic virtual image.
[0124] With respect to the above-mentioned step S206B-1 and step S206B-3, a case where the target object is a target person and the target virtual object is a target virtual person is taken as an example for further explanation.
[0125] The target virtual character may include multiple character layers. For example, as described in the above embodiments, the target virtual character may be split into a front hair layer, a back hair layer, a face layer, and a body layer.
[0126] The preset virtual object in the preset template includes a plurality of preset layers, each of which includes at least one part of the preset virtual object. The preset motion track includes a plurality of preset sub-motion tracks.
[0127] The first corresponding relationship is the corresponding relationship between the character layer and the preset layer; the first binding relationship is the binding relationship between the preset layer and the preset sub-motion trajectory.
[0128] like Fig.13 As shown, the figure shows a schematic diagram of splitting a preset virtual object into multiple parts, each of which can be a preset layer. It should be noted that the figure is a figure that exemplarily displays multiple parts of a preset virtual object.
[0129] like Fig.14 (k0) in the figure represents the target virtual object, and (k1) to (k3) in the figure are three character layers obtained based on the target virtual object, that is, (k1) represents the front hair layer, (k2) represents the back hair layer, and (k3) represents the body layer. It should be noted that in this embodiment, the facial features and facial features of the target virtual object will adopt the layers containing the corresponding parts in the preset virtual object.
[0130] Based on the above step S206B-1, the target preset layer in the preset template can be replaced with the corresponding character layer according to the first corresponding relationship, and the target preset layer refers to the preset layer that has a corresponding relationship with the character in multiple preset layers. For example, the preset layer corresponding to the front hair layer, the back hair layer and the body layer is the target layer.
[0131] Based on the above step S206B-3, according to the binding relationship between the preset layer and the preset sub-motion trajectory, a second binding relationship between the character layer and the preset sub-motion trajectory is established, so that a dynamic virtual character can be obtained.
[0132] like Fig.15 As shown, it is based on the above Fig.13 The preset virtual object in the figure and the target virtual object in the figure 14 are used to obtain a dynamic virtual image. It can be understood that the Fig.15 Part of the information of the dynamic virtual image during operation is displayed.
[0133] In the above embodiment, a dynamic virtual image can be generated based on a picture, which can be applied in the field of live broadcasting, so that the anchor user can generate a dynamic virtual image that matches himself by uploading a picture containing his own face, which can be used to assist in live broadcasting and improve the fun of the live broadcast room. Furthermore, the embodiment of the present invention provides a possible implementation method. Please refer to Fig.16 , is a flow chart of a method for generating a virtual image provided by an embodiment of the present invention.
[0134] See also Fig.17 (n1) in FIG. 1 is an example diagram of an image generation interface provided by an embodiment of the present invention. The image generation interface includes an image acquisition area, a template acquisition area, and a confirmation area. The image acquisition area includes an upload sub-area and a photo taking sub-area. The template acquisition area displays a plurality of pre-set templates.
[0135] like Fig.17 In (n2), when the interactive operation of the anchor user in the image acquisition area is detected, the interactive operation is responded to. If the interactive operation is in the upload sub-area, the local picture in the electronic device is called, and based on the selection operation of the anchor user, the picture corresponding to the selection operation is obtained, that is, the initial image is obtained. If the interactive operation is in the photo sub-area, the photo function of the electronic device is called to obtain the captured image, that is, the initial image.
[0136] like Fig.17 In (n3), after the anchor user uploads the image, he selects a template in the template acquisition area. According to the anchor user's selection operation, the target template, i.e., Template 1, is acquired.
[0137] like Fig.17 In (n4), after uploading the image and selecting the template, the anchor user performs a confirmation operation in the confirmation area. In response to the confirmation operation, the above steps of generating a dynamic virtual image are performed according to the initial image and the target template obtained to generate a dynamic virtual image and display the dynamic virtual image. Fig.18 (m1) in.
[0138] like Fig.18 (m1) is an image display interface provided by an embodiment of the present invention, and the image display interface includes a preview area and a selection area. The preview area is used to display the generated dynamic virtual image. The selection area is used to confirm whether to save the dynamic virtual image generated this time.
[0139] like Fig.18 (m1) in the figure, when the host user detects the confirmation operation in the selection area of the image display interface, respond to the confirmation operation. If the confirmation operation corresponds to the "cancel" control, the following is displayed: Fig.17In the interface (n1), the interactive steps for generating a dynamic virtual image can be repeated. If the confirmation operation corresponds to the "Save" control, the following is displayed: Fig.18 If the anchor user chooses to save the dynamic virtual image, he can select the dynamic virtual image when opening the live broadcast room.
[0140] In order to execute the corresponding steps in the above embodiments and various possible methods, a method for implementing a virtual image generation device is provided below. Fig.19 , Fig.19 This is a functional module diagram of a virtual image generation device 300 provided in an embodiment of the present invention. It should be noted that the basic principle and technical effects of the virtual image generation device 300 provided in this embodiment are the same as those of the above embodiments. For the sake of brief description, for parts not mentioned in this embodiment, reference can be made to the corresponding contents in the above embodiments. The virtual image generation device 300 includes:
[0141] An acquisition module 310 is used to acquire an initial image containing a target object;
[0142] A processing module 330 is used to obtain a target virtual object corresponding to the target object;
[0143] The generation module 350 is used to obtain a dynamic virtual image according to the target virtual object and a preset template; the preset template includes a preset virtual object, a preset motion trajectory, and a first binding relationship between the preset virtual object and the preset motion trajectory; the preset virtual object has a first corresponding relationship with the target virtual object.
[0144] Optionally, the generating module 350 is further configured to obtain a plurality of initial layers according to the target virtual object, wherein the plurality of initial layers at least include a layer to be repaired and a layer not to be repaired;
[0145] Process the layer to be repaired to obtain the target layer;
[0146] A dynamic virtual image is obtained according to a plurality of pending layers and a preset template; the plurality of pending layers include all target layers and all unrepaired layers.
[0147] Optionally, the generating module 350 is further used to determine the to-be-repaired area in the to-be-repaired layer according to the part included in the to-be-repaired layer;
[0148] According to the contour pixel value of the area to be repaired, the area to be repaired is repaired to obtain the target layer.
[0149] Optionally, the generating module 350 is further configured to replace the preset virtual object in the preset template with the target virtual object according to the first corresponding relationship;
[0150] According to the first binding relationship, a second binding relationship between the target virtual object and the preset motion trajectory is established to obtain a dynamic virtual image.
[0151] Optionally, the generating module 350 is further configured to replace each preset layer in the preset template with a corresponding character layer according to the first corresponding relationship;
[0152] According to the first binding relationship, a second binding relationship between each character layer and a preset sub-motion trajectory is established to obtain a dynamic virtual character; the dynamic virtual character is a dynamic virtual image.
[0153] Optionally, the acquisition module 310 is further configured to acquire an initial image including the target object according to an interactive operation of the user on the image generation interface.
[0154] Optionally, the virtual image generating device 300 further includes a response module 370, and the response module 370 is used to display a dynamic virtual image on the image display interface according to the user's confirmation operation on the image generating interface.
[0155] An embodiment of the present invention further provides an electronic device, including a processor 120 and a memory 130, wherein the memory 130 stores a computer program, and when the processor executes the computer program, the method for generating a virtual image disclosed in the above embodiment is implemented.
[0156] The embodiment of the present invention further provides a storage medium on which a computer program is stored. When the computer program is executed by the processor 120, the method for generating a virtual image disclosed in the embodiment of the present invention is implemented.
[0157] In several embodiments provided by the present invention, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to multiple embodiments of the present invention. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing the specified logical functions. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order 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 flowchart, and the combination of boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.
[0158] In addition, the functional modules in the various embodiments of the present invention may be integrated together to form an independent part, or each module may exist independently, or two or more modules may be integrated to form an independent part.
[0159] If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0160] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for generating a virtual image, characterized in that: The method comprises: Get an initial image containing the target object; Obtaining a target virtual object corresponding to the target object; A dynamic virtual image is obtained according to the target virtual object and a preset template; the preset template includes a preset virtual object, a preset motion trajectory, and a first binding relationship between the preset virtual object and the preset motion trajectory; the preset virtual object and the target virtual object have a first corresponding relationship; The step of obtaining a dynamic virtual image according to the target virtual object and the preset template includes: Splitting the target virtual object to obtain a plurality of initial layers, wherein the plurality of initial layers at least includes a layer to be repaired and a layer not repaired; Processing the layer to be repaired to obtain a target layer; The dynamic virtual image is obtained according to a plurality of pending layers and the preset template; the plurality of pending layers include all target layers and all unrepaired layers.
2. The method according to claim 1, characterized in that The layer to be repaired includes at least one part of the target virtual object; The step of processing the layer to be repaired to obtain a target layer includes: Determining a to-be-repaired area in the to-be-repaired layer according to the parts included in the to-be-repaired layer; The area to be repaired is repaired according to the contour pixel value of the area to be repaired to obtain the target layer.
3. The method according to claim 1, characterized in that The step of obtaining a dynamic virtual image according to the target virtual object and the preset template includes: According to the first corresponding relationship, replacing the preset virtual object in the preset template with the target virtual object; According to the first binding relationship, a second binding relationship between the target virtual object and the preset motion trajectory is established to obtain the dynamic virtual image.
4. The method according to claim 3, characterized in that The target object is a target character; the target virtual object is a target virtual character; the target virtual character includes a plurality of character layers; the preset virtual object includes a plurality of preset layers, and the preset motion track includes a plurality of preset sub-motion tracks; The step of obtaining a dynamic virtual image according to the target virtual object and the preset template includes: According to the first corresponding relationship, each of the preset layers in the preset template is replaced with a corresponding character layer; According to the first binding relationship, a second binding relationship between each character layer and one of the preset sub-motion tracks is established to obtain a dynamic virtual character; the dynamic virtual character is the dynamic virtual image.
5. The method according to claim 1, characterized in that The step of obtaining an initial image containing the target object comprises: According to the user's interactive operation on the image generation interface, an initial image containing the target object is obtained.
6. The method according to claim 5, characterized in that The method further comprises: The dynamic virtual image is displayed on the image display interface according to the user's confirmation operation on the image generation interface.
7. A virtual image generating device, characterized in that: The device comprises: An acquisition module, used for acquiring an initial image containing a target object; A processing module, used for obtaining a target virtual object corresponding to the target object; A generating module, configured to obtain a dynamic virtual image according to the target virtual object and a preset template; the preset template includes a preset virtual object, a preset motion track, and a first binding relationship between the preset virtual object and the preset motion track; the preset virtual object and the target virtual object have a first corresponding relationship; The generation module is also used to: split the target virtual object to obtain multiple initial layers, and the multiple initial layers include at least one layer to be repaired and one unrepaired layer; process the layer to be repaired to obtain a target layer; obtain the dynamic virtual image according to the multiple pending layers and the preset template; the multiple pending layers include all target layers and all unrepaired layers.
8. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores a computer program, and when the processor executes the computer program, the method according to any one of claims 1 to 6 is implemented.
9. A storage medium, characterized in that: The storage medium stores a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
System and method for implementing dynamic virtual object
CN110310372A